Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:48:51

Am 5/25/2010 7:34, schrieb Junio C Hamano:
Dale Rowley [off-list ref] writes:
quoted
All of my git aliases stopped working one day. For example, when I ran 'git ci'
(where 'ci' is an alias for 'commit') it printed out this error:

fatal: cannot exec 'git-ci': Permission denied

This error was confusing (I didn't have a 'git-ci' executable anywhere, so why
was it complaining about permissions?) and it took me a while to figure out that
this was happening because I happened to have a random directory in my PATH that
had permissions set incorrectly. Git should probably ignore this, and here is
one way to fix it, although I'm not sure if it's the best way.
As long as the issue is "a directory P on PATH is unreadable, and we tried
to see if P/git-ci is executable and reported failure by exiting", I think
your patch is a reasonable solution.
But it is not only about an unreadable directory. EACCES is also returned
when a "git command" is found that does not have execute permission:

$ touch ~/bin/git-frob	# ~/bin is in $PATH
$ git frob		# original git
fatal: cannot exec 'git-frob': Permission denied
$ ./git frob		# patched git
WARNING: You called a Git command named 'frob', which does not exist.
Continuing under the assumption that you meant 'ambox'
in 11.0 seconds automatically...

That is, when you write a new git command and forget to set execute
permission, you lose the "Permission denied" error. (Ditto if you
accidentally remove execute permission from an existing external git command.)

The question is which corner case is more important to cater for.

I don't have an idea how to solve both issues short of doing the PATH
lookup manually.

-- Hannes
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help