Thread (5 messages) flat view 5 messages, 4 authors, 2016-06-15

Re: [PATCH] Makefile: abort on shells that do not support ${parameter%word} expansion

From: Brandon Casey <hidden>
Date: 2016-06-15 22:51:59

Possibly related (same subject, not in this thread)

On 09/06/2011 02:32 PM, Brandon Casey wrote:
FYI:
It should be possible to test this patch on a modern system by doing
something like:

   make SHELL_PATH=/bin/false

and you should see something like this:

   make: *** [please_set_SHELL_PATH_to_a_more_modern_shell] Error 1

But beware, GNU make 3.81 seems to have a bug which sends it into an
infinite loop.
Just a clarification, I didn't mean you'd actually be able to test
the patch for correctness, but the above would at least allow you to
stress the code path.

But, with the Makefile in its current form (patch or no patch) the
above still works.  Setting SHELL_PATH=/bin/false produces the desired
error message.

There still appears to be a bug in make 3.81 which is triggered when
using an ancient shell, it just manifests itself in a different way
using our current Makefile.  Right now, make 3.81 will enter an
infinite loop when it tries to include the GIT-VERSION-FILE.  When
something like /bin/sh on Solaris processes the GIT-VERSION-GEN
script, it produces the following incorrect string in the
GIT-VERSION-FILE:

   GIT_VERSION = $(expr $(echo $(git describe --match v[0-9]* --abbrev=4 HEAD 2>/dev/null) | sed -e s/-/./g) : v*\(.*\))

which then becomes part of the Makefile when GIT-VERSION-FILE is
included on line 264.  GNU make then begins to print the following
to the terminal repeatedly:

   GIT_VERSION = $(expr $(echo $(git describe --match v[0-9]* --abbrev=4 HEAD 2>/dev/null) | sed -e s/-/./g) : v*\(.*\))

GIT-VERSION-FILE should really have a dependency on
shell_compatibility_test since it calls GIT-VERSION-GEN which may use
shell features that are not provided by the configured shell.  If that
dependency is added so that the GIT-VERSION-FILE rule looks like this:

   GIT-VERSION-FILE: shell_compatibility_test FORCE
   	@$(SHELL_PATH) ./GIT-VERSION-GEN
   -include GIT-VERSION-FILE

_then_, we get the behavior I described originally, where

   make SHELL_PATH=/bin/false

sends the make process into an infinite loop, with no output to the
terminal.

Either way, with GNU make 3.81, you get an infinite loop when you use
a shell that should trigger our error message.

-Brandon
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help