On Tue, 2021-04-27 at 05:10 +0800, 積丹尼 Dan Jacobson wrote: > > > > > > "PS" == Paul Smith <psm...@gnu.org> writes: > PS> In the second example, the "Z" command is by itself so it's > "simple" so > PS> make uses its fast path solution, which is to fork and exec "Z" > PS> directly without a shell. Thus you get an error from make. > > OK, but please have the message distinguish like these do: > > $ cat /tmp/G > cat: /tmp/G: No such file or directory > $ /tmp/G > bash: /tmp/G: No such file or directory > $ touch /tmp/G > $ cat /tmp/G > $ /tmp/G > bash: /tmp/G: Permission denied
GNU make uses the gnulib library to search for executables on the PATH, it doesn't implement its own search. I think the behavior you're seeing is due to a bug in the older version of gnulib that was used to build your version of GNU make, which as since been fixed. When I run this using a version of GNU make built with the latest gnulib I get this: $ cat Makefile B: :; Z C: : Z $ rm -f Z $ PATH=.:$PATH make B :; Z /bin/sh: 1: Z: not found make: *** [Makefile:2: B] Error 127 $ PATH=.:$PATH make C : Z make: Z: No such file or directory make: *** [Makefile:5: C] Error 127 $ touch Z $ PATH=.:$PATH make B :; Z /bin/sh: 1: Z: Permission denied make: *** [Makefile:2: B] Error 126 $ PATH=.:$PATH make C : Z make: Z: Permission denied make: *** [Makefile:5: C] Error 127