Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Jonathan Nieder
(cc-ing the reporter) Brandon Williams wrote: > In some situations run-command will incorrectly try (and fail) to > execute a directory instead of an executable. For example: > > Lets suppose a user has PATH=~/bin (where 'bin' is a directory) and they > happen to have another directory inside 'bi

Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Jeff King
On Mon, Apr 24, 2017 at 05:17:24PM -0700, Jonathan Nieder wrote: > > This is due to only checking 'access()' when locating an executable in > > PATH, which doesn't distinguish between files and directories. Instead > > use 'stat()' and check that the path is to a regular file. Now > > run-comman

Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Jonathan Nieder
Junio C Hamano wrote: > Jonathan Nieder writes: >> Until we switched from using execvp to execve, the symptom was very >> subtle: it only affected the error message when a program could not be >> found, instead of affecting functionality more substantially. > > Hmph, what if you had bin/ssh/ dire

Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Junio C Hamano
Jonathan Nieder writes: > Until we switched from using execvp to execve, the symptom was very > subtle: it only affected the error message when a program could not be > found, instead of affecting functionality more substantially. Hmph, what if you had bin/ssh/ directory and bin2/ssh executable

Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Junio C Hamano
Brandon Williams writes: > This is due to only checking 'access()' when locating an executable in > PATH, which doesn't distinguish between files and directories. Instead > use 'stat()' and check that the path is to a regular file. Now > run-command won't try to execute the directory 'git-remot

Re: [PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Jonathan Nieder
Brandon Williams wrote: > In some situations run-command will incorrectly try (and fail) to > execute a directory instead of an executable. For example: > > Lets suppose a user has PATH=~/bin (where 'bin' is a directory) and they > happen to have another directory inside 'bin' named 'git-remote-b

[PATCH v6 12/11] run-command: don't try to execute directories

2017-04-24 Thread Brandon Williams
In some situations run-command will incorrectly try (and fail) to execute a directory instead of an executable. For example: Lets suppose a user has PATH=~/bin (where 'bin' is a directory) and they happen to have another directory inside 'bin' named 'git-remote-blah'. Then git tries to execute th