bugmake - Bugs: bug #47171, please fall back to system() when...

 
 

bug #47171: please fall back to system() when command is not found on $PATH

Submitted by:  Manoj Srivastava <srivasta>
Submitted on:  Tue Feb 16 20:34:37 2016  
 
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: NoneOperating System: None
Fixed Release: NoneTriage Status: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue Feb 16 20:34:37 2016, original submission:

Hi,

This was reported by a debian user. Please retain a CC to
-unavailable-
so that the Debian BTS has a copy of your input.

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?

Manoj

Manoj Srivastava <srivasta>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by srivasta (Submitted the item)
  • -unavailable- added by srivasta (Debian BTS)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Feb 16 20:34:37 2016srivastaCarbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup1