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

Re: [PATCH] run-command.c: Accept EACCES as command not found

From
Frans Klaver <fransklaver@gmail.com>
Date
Nov 22, 2011, 09:31 UTC
Message-ID
<CAH6sp9MxbDhQ3RiA6jO1fswAZX3R6C2fv0gzJdpGp432ovWsjQ@mail.gmail.com>
In-Reply-To
<7v62idf2vy.fsf@alter.siamese.dyndns.org>
On Tue, Nov 22, 2011 at 12:54 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Imagine you did not have alias.aliasedinit in ~/.gitconfig but had a
> script called $(pwd)/searchpath/git-aliasedinit which we would fail to
> execute. What message would we get in that case? Currently I think we get
> permission denied.
Correct.
> Would we get the same with your patch, or something that does not hint
> at all that there is a permission problem?

Nope. That would be just as confusing and inarguably incorrect at that -- bash differentiates between commands that exist, but cannot be executed due to permissions (access denied) and paths that cannot be read (they are ignored in the search).

Show 6 quoted lines
> See also the "tangent" part of
>
>    http://thread.gmane.org/gmane.comp.version-control.git/171755
>
> and the discussion that follows it. I do not think we reached any
> conclusion nor a patch.

There's no black-on-white conclusion there. I get the impression that no one really has an idea of what they want when encountering EACCES. Git has to do what's reasonable to provide the user with information. Currently I think it does too little. Jonathan N. gave the option of optionally using libexplain[1]. It's pretty verbose and accurate:

fatal: cannot exec 'git-frotz': execvp(pathname = "git-frotz", argv = ["git-frotz"]) failed, Permission denied (13, EACCES) because the process does not have search permission to the pathname "/home/frans/devsw/searchpath" directory, the process effective UID 1000 "frans" matches the directory owner UID 1000 "frans" and the owner permission mode is "r--", and the process is not privileged (does not have the DAC_READ_SEARCH capability): Success

I wouldn't be in favor of adding the dependency just to enable users to track down PATH issues though. Also, I think "Cannot access /home/frans/devsw/searchpath" would just as well do the trick.

For Jonathan's example[2] libexplain doesn't have a clear answer either: fatal: cannot exec 'git-frotz': execvp(pathname = "git-frotz", argv = ["git-frotz"]) failed, Permission denied (13, EACCES): Permission denied

If git is going to do some diagnostics on why the execvp returned EACCES, it can still give a few hints. Most of the more likely options are then ruled out.

Frans

[1] http://article.gmane.org/gmane.comp.version-control.git/171860 [2] http://article.gmane.org/gmane.comp.version-control.git/171848

Previous: Junio C HamanoNext: Frans Klaver
Message 5 of 25 in “run-command.c: Accept EACCES as command not found”
  1. run-command.c: Accept EACCES as command not foundFrans Klaver, Nov 21, 2011
  2. Junio C HamanoNov 21, 2011
  3. Frans KlaverNov 21, 2011
  4. Junio C HamanoNov 21, 2011
  5. Frans KlaverNov 22, 2011
  6. Frans KlaverNov 23, 2011
  7. Nguyen Thai Ngoc DuyNov 23, 2011
  8. Frans KlaverNov 23, 2011
  9. Frans KlaverNov 23, 2011
  10. 0/2 run-command: Add EACCES diagnosticsFrans Klaver, Dec 6, 2011
  11. 1/2 run-command: Add checks after execvp fails with EACCESFrans Klaver, Dec 6, 2011
  12. Junio C HamanoDec 6, 2011
  13. Frans KlaverDec 7, 2011
  14. Frans KlaverDec 8, 2011
  15. Junio C HamanoDec 9, 2011
  16. Frans KlaverDec 9, 2011
  17. 2/2 run-command: Add interpreter permissions checkFrans Klaver, Dec 6, 2011
  18. Junio C HamanoDec 6, 2011
  19. Frans KlaverDec 7, 2011
  20. 0/2 run-command: Add eacces diagnosticsFrans Klaver, Dec 13, 2011
  21. 1/2 run-command: Add checks after execvp fails with EACCESFrans Klaver, Dec 13, 2011
  22. Junio C HamanoDec 13, 2011
  23. Frans KlaverDec 14, 2011
  24. Frans KlaverDec 14, 2011
  25. 2/2 run-command: Add interpreter permissions checkFrans Klaver, Dec 13, 2011

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.