should assigning to .SHELLFLAGS suppress fast path?

2015-02-11 Thread David Boyce
I just noticed that while assigning to SHELL suppresses the fast-path
algorithm, assigning to .SHELLFLAGS does not. Feature or bug?

David
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: should assigning to .SHELLFLAGS suppress fast path?

2015-02-11 Thread Paul Smith
On Wed, 2015-02-11 at 10:44 -0800, David Boyce wrote:
 I just noticed that while assigning to SHELL suppresses the fast-path
 algorithm, assigning to .SHELLFLAGS does not. Feature or bug?

That's a good question.  I'm sort of agnostic on it.  On one hand, it's
hard to think of a flag added to SHELLFLAGS (given the default value of
SHELL) that would matter for the fast path: we only choose the fast path
if the command is so simple we don't need a shell anyway so flags like
-e, etc. have no relevance.

Of course, there's -x which is perhaps what you were thinking of.
Probably it does make sense to skip the fast path if SHELLFLAGS is not
the default value.



___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make


Re: should assigning to .SHELLFLAGS suppress fast path?

2015-02-11 Thread David Boyce
On Wed, Feb 11, 2015 at 12:22 PM, Paul Smith psm...@gnu.org wrote:

 On Wed, 2015-02-11 at 10:44 -0800, David Boyce wrote:
  I just noticed that while assigning to SHELL suppresses the fast-path
  algorithm, assigning to .SHELLFLAGS does not. Feature or bug?

 That's a good question.  I'm sort of agnostic on it.  On one hand, it's
 hard to think of a flag added to SHELLFLAGS (given the default value of
 SHELL) that would matter for the fast path


Actually it gets weirder. Some values of .SHELLFLAGS suppress fast path,
others do not:

% cat makefile
foo:; @echo making $@
% strace -e process -q -f -- make-4.1 .SHELLFLAGS=-ec 21 | grep 'execve.*
= 0'
[pid 23605] execve(/bin/echo, [echo, making, foo], [/* 46 vars */])
= 0
% strace -e process -q -f -- make-4.1 .SHELLFLAGS=-xc 21 | grep 'execve.*
= 0'
[pid 23745] execve(/bin/sh, [/bin/sh, -xc, echo making foo], [/* 46
vars */]) = 0

The two straced invocations differ only in that one adds -e to .SHELLFLAGS
and the other adds -x.

Wait … ChangeLog.3 says:

(construct_command_argv_internal): If .SHELLFLAGS is non-standard
use the slow path.  Use that value instead of hard-coded -c”.

But apparently -c and -ec are both considered standard so I guess it works
as designed.

David
___
Bug-make mailing list
Bug-make@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-make