{"thread":{"id":"23893","subject":"[PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH","startedAt":"2010-05-25T02:55:06Z","lastAt":"2010-05-26T02:36:51Z","messageCount":4,"participants":["Dale Rowley","Junio C Hamano","Johannes Sixt"],"isPatch":true,"patchVersion":1,"patchTotal":1},"messages":[{"id":"142227","messageId":"4BFB3C0A.2030505@gmail.com","threadId":"23893","inReplyTo":null,"subject":"[PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH","fromName":"Dale Rowley","fromEmail":"ddrowley@gmail.com","sentAt":"2010-05-25T02:55:06Z","receivedAt":"2010-05-25T02:55:06Z","isPatch":true,"sender":{"key":"ddrowley@gmail.com","avatar":null},"body":"All of my git aliases stopped working one day. For example, when I ran 'git ci'\n(where 'ci' is an alias for 'commit') it printed out this error:\n\nfatal: cannot exec 'git-ci': Permission denied\n\nThis error was confusing (I didn't have a 'git-ci' executable anywhere, so why\nwas it complaining about permissions?) and it took me a while to figure out that\nthis was happening because I happened to have a random directory in my PATH that\nhad permissions set incorrectly. Git should probably ignore this, and here is\none way to fix it, although I'm not sure if it's the best way.\n\n\n\nSigned-off-by: Dale Rowley <ddrowley@gmail.com>\n---\n run-command.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/run-command.c b/run-command.c\nindex c7793f5..a98282b 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -284,7 +284,7 @@ fail_pipe:\n \t\t * Do not check for cmd->silent_exec_failure; the parent\n \t\t * process will check it when it sees this exit code.\n \t\t */\n-\t\tif (errno == ENOENT)\n+\t\tif (errno == ENOENT || errno == EACCES)\n \t\t\texit(127);\n \t\telse\n \t\t\tdie_errno(\"cannot exec '%s'\", cmd->argv[0]);\n-- \n1.7.1.226.g770c5.dirty\n"},{"id":"142233","messageId":"7vaarownmv.fsf@alter.siamese.dyndns.org","threadId":"23893","inReplyTo":"4BFB3C0A.2030505@gmail.com","subject":"Re: [PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-05-25T05:34:16Z","receivedAt":"2010-05-25T05:34:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dale Rowley <ddrowley@gmail.com> writes:\n\n> All of my git aliases stopped working one day. For example, when I ran 'git ci'\n> (where 'ci' is an alias for 'commit') it printed out this error:\n>\n> fatal: cannot exec 'git-ci': Permission denied\n>\n> This error was confusing (I didn't have a 'git-ci' executable anywhere, so why\n> was it complaining about permissions?) and it took me a while to figure out that\n> this was happening because I happened to have a random directory in my PATH that\n> had permissions set incorrectly. Git should probably ignore this, and here is\n> one way to fix it, although I'm not sure if it's the best way.\n\nAs long as the issue is \"a directory P on PATH is unreadable, and we tried\nto see if P/git-ci is executable and reported failure by exiting\", I think\nyour patch is a reasonable solution.\n\nThanks\n"},{"id":"142242","messageId":"4BFB75DD.7030201@viscovery.net","threadId":"23893","inReplyTo":"7vaarownmv.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-05-25T07:01:49Z","receivedAt":"2010-05-25T07:01:49Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 5/25/2010 7:34, schrieb Junio C Hamano:\n> Dale Rowley <ddrowley@gmail.com> writes:\n> \n>> All of my git aliases stopped working one day. For example, when I ran 'git ci'\n>> (where 'ci' is an alias for 'commit') it printed out this error:\n>>\n>> fatal: cannot exec 'git-ci': Permission denied\n>>\n>> This error was confusing (I didn't have a 'git-ci' executable anywhere, so why\n>> was it complaining about permissions?) and it took me a while to figure out that\n>> this was happening because I happened to have a random directory in my PATH that\n>> had permissions set incorrectly. Git should probably ignore this, and here is\n>> one way to fix it, although I'm not sure if it's the best way.\n> \n> As long as the issue is \"a directory P on PATH is unreadable, and we tried\n> to see if P/git-ci is executable and reported failure by exiting\", I think\n> your patch is a reasonable solution.\n\nBut it is not only about an unreadable directory. EACCES is also returned\nwhen a \"git command\" is found that does not have execute permission:\n\n$ touch ~/bin/git-frob\t# ~/bin is in $PATH\n$ git frob\t\t# original git\nfatal: cannot exec 'git-frob': Permission denied\n$ ./git frob\t\t# patched git\nWARNING: You called a Git command named 'frob', which does not exist.\nContinuing under the assumption that you meant 'ambox'\nin 11.0 seconds automatically...\n\nThat is, when you write a new git command and forget to set execute\npermission, you lose the \"Permission denied\" error. (Ditto if you\naccidentally remove execute permission from an existing external git command.)\n\nThe question is which corner case is more important to cater for.\n\nI don't have an idea how to solve both issues short of doing the PATH\nlookup manually.\n\n-- Hannes\n"},{"id":"142299","messageId":"4BFC8943.6090504@gmail.com","threadId":"23893","inReplyTo":"4BFB75DD.7030201@viscovery.net","subject":"Re: [PATCH 1/1] run-command.c: ignore bad permissions on dirs in PATH","fromName":"Dale Rowley","fromEmail":"ddrowley@gmail.com","sentAt":"2010-05-26T02:36:51Z","receivedAt":"2010-05-26T02:36:51Z","isPatch":true,"sender":{"key":"ddrowley@gmail.com","avatar":null},"body":"> That is, when you write a new git command and forget to set execute\n> permission, you lose the \"Permission denied\" error. (Ditto if you\n> accidentally remove execute permission from an existing external git command.)\n\nTrue, but after getting the warning that 'git-frob' doesn't exist, it\nwould probably only take a minute to figure out that 'git-frob'\npermissions need to be fixed, and then it's understandable why git\nchoked on it. In contrast, it took me a while to discover my PATH\npermissions problem, and even then it wasn't clear why git should die\nbecause of a permissions problem on a directory that had little to do\nwith git.\n\nDale\n"}]}