Package: make
Version: 3.82-1
Severity: normal
Justification: Open Group Issue 7: XCU 4.make
Tags: upstream
Hi,
Trying the following makefile:
test:
command -v ls
I get the following result:
$ make
command -v ls
make: command: Command not found
make: *** [test] Error 127
$ sh -c 'command -v ls'
/bin/ls
but POSIX sayeth
| An execution line is built from the command line by removing any
| prefix characters. Except as described under the at-sign prefix, the
| execution line shall be written to the standard output, optionally
| preceded by a <tab>. The execution line shall then be executed by a
| shell as if it were passed as the argument to the system( ) interface,
| except that the shell −e option shall also be in effect.
The cause is that "make" expects to be run on a POSIX system, where
non-special shell builtins like "command" would be available for use
by execvp (see sh_cmds[] in job.c). See the explanation by Jilles
Tjoelker at
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=43;bug=436466
for more details.
I can imagine two fixes, and both seem separately valuable:
a. one hand hand, introducing a new package to provide those
non-special builtins that are not provided by some pseudo-essential
package (using alternatives to deal with alternative
implementations where necessary):
#!/bin/sh
command -p ${0##*/} "$@"
b. on the other hand, teaching "make" to handle ENOENT from execvp by
falling back to the shell. (The shell can print a message about
it if that ENOENT was actually due to a missing shared library or
interpreter.) This way, "make" could even use shell builtins that
are not mandated by POSIX when the system shell happens to
implement them.
This report is about (b). Thoughts?
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]