On 05/01/2017 16:26, Bernhard Voelker wrote:
On 01/05/2017 01:17 PM, Dave Plater wrote:
I'm having a problem dvdisaster's bash-based-configure script where it checks for make. It fails in Factory but passes in 42.2 downwards. This is it:
# Check for tools #
function REQUIRE_GMAKE() { if test -n "$cfg_help_mode"; then return 0 fi
echo -n "Checking for gmake: "
if (gmake -v | grep "GNU Make") > /dev/null 2>&1 ; then echo "yes" echo "MAKE = `which gmake`" >>Makefile.config return 0 fi;
if (make -v | grep "GNU Make") > /dev/null 2>&1 ; then echo "yes" echo "MAKE = `which make`" >>Makefile.config return 0 fi;
echo "no" echo "This package requires GNU make (gmake)." exit 1; } The output of make -v is identical in Tumbleweed and 42.2 all I can think of is either bash or grep have changed. I worked around the problem by patching in "echo "MAKE = `which make`"
Makefile.config" as an else statement but I'd love to know what is actually wrong. Thanks
Dave P
It seems that gmake behaves differently in this construct if stderr is pointing to the same file descriptor as stdout:
$ ( gmake -v | grep GNU ) >/dev/null 2>/dev/null && echo OK || echo FAIL OK
$ ( gmake -v | grep GNU ) >/dev/null 2>&1 && echo OK || echo FAIL FAIL
Really odd ... could be a bash-4.4 bug/feature.
For your case, I'd personally go with something like for now:
if gmake -v 2>/dev/null | grep -qF "GNU Make"; then echo "yes" echo "MAKE = $(which make)" >>Makefile.config return 0 fi
as the additional subshell is redundant, and you'd probably want to be informed about grep errors, won't you?
Have a nice day, Berny
Thanks for your confirmation, I'll know where to look the next time I get a misbehaving script in a package, I'm going to go with "if gmake -v >/dev/null", the script doesn't even check make's version and if make's not there by some remote chance, it outputs "make: command not found". Thanks Dave P -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org