[opensuse-packaging] What can cause this script to fail in Factory/Tumbleweed.
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 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
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 -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
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
On Donnerstag, 5. Januar 2017 14:17:09 CET 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 ;
(gmake -v | grep "GNU Make") > /dev/null ; echo $?
0
(gmake -v | grep "GNU Make") > /dev/null 2>&1 ; echo $?
2
The culprit seems to be a failing call to splice() in grep:
LANG=C strace -edup2,close,open,splice,read,write,execve,lseek -s 150 -f
bash -c '(/usr/bin/gmake -v | /usr/bin/grep "GNU Make") > /dev/null 2>&1'
[pid 3756] write(1, "GNU Make 4.2.1\n", 15) = 15
[pid 3757] <... read resumed> "GNU Make 4.2.1\n", 32768) = 15
[pid 3756] write(1, "Built for x86_64-suse-linux-gnu\n", 32
On 01/05/2017 04:16 PM, Brüns, Stefan wrote:
The culprit seems to be a failing call to splice() in grep:
LANG=C strace -edup2,close,open,splice,read,write,execve,lseek -s 150 -f bash -c '(/usr/bin/gmake -v | /usr/bin/grep "GNU Make") > /dev/null 2>&1'
Sounds like https://git.sv.gnu.org/cgit/grep.git/commit/?id=7ad47abbcb Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On Donnerstag, 5. Januar 2017 17:39:48 CET you wrote:
On 01/05/2017 04:16 PM, Brüns, Stefan wrote:
The culprit seems to be a failing call to splice() in grep:
LANG=C strace -edup2,close,open,splice,read,write,execve,lseek -s 150 -f bash -c '(/usr/bin/gmake -v | /usr/bin/grep "GNU Make") > /dev/null 2>&1'
Sounds like https://git.sv.gnu.org/cgit/grep.git/commit/?id=7ad47abbcb
Have a nice day, Berny
Executing the testcase added with that commit: strace -esplice -f bash -c ' echo abc | grep b >>/dev/null ' strace: Process 9494 attached strace: Process 9495 attached [pid 9494] +++ exited with 0 +++ [pid 9495] splice(0, NULL, 1, NULL, 32768, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument) grep: (Standardeingabe): Das Argument ist ungültig [pid 9495] +++ exited with 2 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9494, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 2 +++ So this seems to match ... Kind regards, Stefan-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 01/05/2017 05:57 PM, Brüns, Stefan wrote:
On Donnerstag, 5. Januar 2017 17:39:48 CET you wrote:
On 01/05/2017 04:16 PM, Brüns, Stefan wrote:
The culprit seems to be a failing call to splice() in grep:
LANG=C strace -edup2,close,open,splice,read,write,execve,lseek -s 150 -f bash -c '(/usr/bin/gmake -v | /usr/bin/grep "GNU Make") > /dev/null 2>&1'
Sounds like https://git.sv.gnu.org/cgit/grep.git/commit/?id=7ad47abbcb
Have a nice day, Berny
Executing the testcase added with that commit:
strace -esplice -f bash -c ' echo abc | grep b >>/dev/null ' strace: Process 9494 attached strace: Process 9495 attached [pid 9494] +++ exited with 0 +++ [pid 9495] splice(0, NULL, 1, NULL, 32768, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument) grep: (Standardeingabe): Das Argument ist ungültig [pid 9495] +++ exited with 2 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9494, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 2 +++
So this seems to match ...
Thanks for confirming. @Andreas: would you like to cherry-pick this for oS:F/grep? Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 01/05/2017 11:13 PM, Bernhard Voelker wrote:
On 01/05/2017 05:57 PM, Brüns, Stefan wrote:
On Donnerstag, 5. Januar 2017 17:39:48 CET you wrote:
On 01/05/2017 04:16 PM, Brüns, Stefan wrote:
The culprit seems to be a failing call to splice() in grep:
LANG=C strace -edup2,close,open,splice,read,write,execve,lseek -s 150 -f bash -c '(/usr/bin/gmake -v | /usr/bin/grep "GNU Make") > /dev/null 2>&1'
Sounds like https://git.sv.gnu.org/cgit/grep.git/commit/?id=7ad47abbcb
Have a nice day, Berny
Executing the testcase added with that commit:
strace -esplice -f bash -c ' echo abc | grep b >>/dev/null ' strace: Process 9494 attached strace: Process 9495 attached [pid 9494] +++ exited with 0 +++ [pid 9495] splice(0, NULL, 1, NULL, 32768, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument) grep: (Standardeingabe): Das Argument ist ungültig [pid 9495] +++ exited with 2 +++ --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=9494, si_uid=1000, si_status=0, si_utime=0, si_stime=0} --- +++ exited with 2 +++
So this seems to match ...
Thanks for confirming.
@Andreas: would you like to cherry-pick this for oS:F/grep?
@Stefan: as you already added the patch locally - would you mind to submit this to Base:System/grep? Have a nice day, Berny -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 05/01/2017 14:17, 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
The interesting part of all this is that the next bash function to find gcc doesn't fail although it uses the same syntax. See the file at http://pastebin.com/tRLyMCqh Dave P -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (3)
-
Bernhard Voelker
-
Brüns, Stefan
-
Dave Plater