On 4/13/21 5:16 AM, Harald van Dijk via austin-group-l at The Open Group wrote:
Please note again that POSIX's Command Search and Execution doesn't say "continue until execve() doesn't fail". It says "Otherwise, the command shall be searched for using the PATH environment variable as described in XBD Environment Variables", and then what happens to the result of that search. It very clearly separates the search from the attempt to execute.
The complicating factor is POSIX's definition of "executable file." You search "until an executable file with the specified name and appropriate execution permissions is found." An executable file is a "regular file acceptable as a new process image file by the equivalent of the exec family of functions." And the only way to determine that is by trying to execute it using one of "the exec family of functions." That said, this is the most marginal of corner cases, notwithstanding that bash has a distinct option to handle it (disabled by default). -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/