git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 2/2] git: continue alias lookup on EACCES errors

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 28, 2012, 17:42 UTC
Message-ID
<7vaa30wrjx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20120328043058.GD30251@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 17 quoted lines
> On Tue, Mar 27, 2012 at 12:16:36PM -0700, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>> 
>> > If git receives an EACCES error while trying to execute an
>> > external command, we currently give up and report the error.
>> > However, the EACCES may be caused by an inaccessible
>> > directory in the user's PATH.
>> 
>> Regardless of EACCES/ENOENT change we discussed, the observable behaviour
>> should be testable.  Something like this?
>
> Yes, though I held back on writing tests, because I don't think we've
> quite decided what the behavior _should_ be. Should we be
> differentiating "chmod -x /bin/ls" from "chmod -x /bin"? Should we be
> continuing alias lookup on EACCES? Should we print edit-distance
> suggestions on EACCES?

I am leaning to think that it would be the least surprising if we treat as if /bin/ls does not even exist if /bin is not searchable. If /bin/ls is unreadable or unexecutable but /bin is searchable, then we _know_ it exists, and we follow the usual exec*p() rule to ignore it so "git ls" would try to find an alias and when all else fails will give the edit distance suggestions but should exclude /bin/ls from candidates. If /bin itself is unsearchable, we do not even know what it contains, so it is needless to say that /bin/ls will not be part of suggestion candidates.

That way, the only thing people _could_ complain about is "I have a directory $HOME/sillybin in my $PATH but do not have an executable bit on it. When I try to run 'git stupid', 'git-stupid' in that diretory is not executed, and I do not even get an error message to point out that I am missing the executable bit on $HOME/sillybin directory". And you can say "Ah, just like the shell. So make sure you have necessary permission bits on things". Very easy and straightforward to explain and understand.

Previous: Jeff KingNext: Jeff King
Message 12 of 47 in “Bug? Bad permissions in $PATH breaks Git aliases”
  1. James PickensMar 26, 2012
  2. Jeff KingMar 27, 2012
  3. James PickensMar 27, 2012
  4. Junio C HamanoMar 27, 2012
  5. Jeff KingMar 27, 2012
  6. 1/2 run-command: propagate EACCES errors to parentJeff King, Mar 27, 2012
  7. Junio C HamanoMar 27, 2012
  8. Jeff KingMar 27, 2012
  9. 2/2 git: continue alias lookup on EACCES errorsJeff King, Mar 27, 2012
  10. Junio C HamanoMar 27, 2012
  11. Jeff KingMar 28, 2012
  12. Junio C HamanoMar 28, 2012
  13. Jeff KingMar 28, 2012
  14. Jonathan NiederMar 28, 2012
  15. Junio C HamanoMar 28, 2012
  16. Jonathan NiederMar 28, 2012
  17. Jeff KingMar 28, 2012
  18. Jonathan NiederMar 28, 2012
  19. Jeff KingMar 28, 2012
  20. Jeff KingMar 28, 2012
  21. Jonathan NiederMar 28, 2012
  22. Jeff KingMar 28, 2012
  23. Jonathan NiederMar 28, 2012
  24. Jeff KingMar 28, 2012
  25. Jonathan NiederMar 28, 2012
  26. Jeff KingMar 28, 2012
  27. Frans KlaverMar 28, 2012
  28. Junio C HamanoMar 28, 2012
  29. Jeff KingMar 28, 2012
  30. Junio C HamanoMar 28, 2012
  31. Jeff KingMar 28, 2012
  32. Jeff KingMar 28, 2012
  33. Junio C HamanoMar 28, 2012
  34. Frans KlaverMar 29, 2012
  35. Jeff KingMar 29, 2012
  36. Frans KlaverMar 29, 2012
  37. Jeff KingMar 28, 2012
  38. Junio C HamanoMar 28, 2012
  39. Jeff KingMar 28, 2012
  40. Frans KlaverMar 29, 2012
  41. Jeff KingMar 29, 2012
  42. Frans KlaverMar 29, 2012
  43. Johannes SixtMar 27, 2012
  44. James PickensMar 27, 2012
  45. Junio C HamanoMar 27, 2012
  46. James PickensMar 27, 2012
  47. Junio C HamanoMar 27, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.