[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue using "command" shell builtin in make rules.

From: Martin Dorey
Subject: Re: Issue using "command" shell builtin in make rules.
Date: Sat, 18 Nov 2017 16:45:10 +0000

> "command" is a standard utility defined in POSIX.

For anyone else whose reaction was "really?", the citation:


On Nov 18, 2017, at 08:41, Nick Bowler <address@hidden> wrote:

On 11/18/17, Paul Smith <address@hidden> wrote:
On Tue, 2017-11-07 at 13:43 -0500, Nick Bowler wrote:
Is this behaviour intended?  I noticed the manual says "make may take
shortcuts that do not affect the results" but in this instance a change
in results is definitely observed.

Well, technically "command" is not a valid POSIX shell built-in
command, so relying on it in your makefile scripts without changing the
SHELL variable to /bin/bash (or some other shell that supports
"command") is incorrect.

"command" is a standard utility defined in POSIX.  It is an ordinary
utility (under the "Utilities" heading), rather than a special built-in.

However "command" can only reasonably be implemented as a shell built-in
because (among other things) the -V option has to know about currently-
defined shell aliases.

However, even if you were to change SHELL to /bin/bash, it would still
not work properly :).

I updated the built-in command list to contain "command".  But what
should really happen is make should re-try the slow path if the fast
path fails with a "command not found" error... then we wouldn't have to
keep adding non-standard built-ins to these lists.

Sounds great.


Bug-make mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]