All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frans Klaver" <fransklaver@gmail.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>
Subject: Re: [PATCH] run-command.c: Accept EACCES as command not found
Date: Wed, 23 Nov 2011 23:55:18 +0100	[thread overview]
Message-ID: <op.v5e8mgbc0aolir@keputer> (raw)
In-Reply-To: <CAH6sp9N2ycsoU=is3BVanH33CowD+sMNmWq=Z1MsPJX=HGYY+g@mail.gmail.com>

On Wed, 23 Nov 2011 09:17:43 +0100, Frans Klaver <fransklaver@gmail.com>  
wrote:

> On Tue, Nov 22, 2011 at 10:31 AM, Frans Klaver <fransklaver@gmail.com>  
> wrote:
>
>> 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.
>
> If there are no objections, I'm going to cook up a patch that
>
> - Keeps the current behavior (bail on EACCES)
> - Adds a more helpful diagnostic message somewhat like libexplain's,
> but more terse and if possible with slightly more domain knowledge
> - Takes into account the notes made following
> http://article.gmane.org/gmane.comp.version-control.git/171838

So here be some tests I intend to use (based on t0061.3):

run_command reports EACCES, file permissions:
         cat hello-script >hello.sh &&
         chmod -x hello.sh &&
         test_must_fail test-run-command run-command ./hello.sh 2>err &&

         grep "fatal: cannot exec.*hello.sh" err


run_command reports EACCES, search path permisions:
         mkdir -p inaccessible &&
         PATH=$(pwd)/inaccessible:$PATH &&
         export PATH &&

         cat hello-script >inaccessible/hello.sh &&
         chmod 400 inaccessible &&
         test_must_fail test-run-command run-command hello.sh 2>err &&

         grep "fatal: cannot exec.*hello.sh" err &&
         grep "incorrect PATH entry" err


run_command reports EACCES, interpreter fails:
         cat incorrect-interpreter-script >hello.sh &&
         chmod +x incorrect-interpreter-script &&
         chmod -x someinterpreter &&
         test_must_fail test-run-command run-command ./hello.sh 2>err &&

         grep "fatal: cannot exec.*hello.sh" err &&
         grep "cannot execute interpreter" err


Possibly getting (over)ambitious on the interpreter test, but hey, gotta  
aim high.

If anybody has a test case that isn't covered, I'd be much obliged.

Frans

  parent reply	other threads:[~2011-11-23 22:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 21:53 [PATCH] run-command.c: Accept EACCES as command not found Frans Klaver
2011-11-21 22:13 ` Junio C Hamano
2011-11-21 23:06   ` Frans Klaver
2011-11-21 23:54     ` Junio C Hamano
2011-11-22  9:31       ` Frans Klaver
2011-11-23  8:17         ` Frans Klaver
2011-11-23 12:04           ` Nguyen Thai Ngoc Duy
2011-11-23 13:25             ` Frans Klaver
2011-11-23 22:55           ` Frans Klaver [this message]
2011-12-06 21:38             ` [PATCH 0/2] run-command: Add EACCES diagnostics Frans Klaver
2011-12-06 21:38               ` [PATCH 1/2] run-command: Add checks after execvp fails with EACCES Frans Klaver
2011-12-06 22:35                 ` Junio C Hamano
2011-12-07  8:31                   ` Frans Klaver
2011-12-08 21:44                   ` Frans Klaver
2011-12-09 17:23                     ` Junio C Hamano
2011-12-09 21:35                       ` Frans Klaver
2011-12-06 21:38               ` [PATCH 2/2] run-command: Add interpreter permissions check Frans Klaver
2011-12-06 22:47                 ` Junio C Hamano
2011-12-07  8:37                   ` Frans Klaver
2011-12-13 15:08             ` [PATCH 0/2 v2] run-command: Add eacces diagnostics Frans Klaver
2011-12-13 15:08               ` [PATCH 1/2] run-command: Add checks after execvp fails with EACCES Frans Klaver
2011-12-13 19:01                 ` Junio C Hamano
2011-12-14 14:31                   ` Frans Klaver
2011-12-14 22:06                     ` Frans Klaver
2011-12-13 15:08               ` [PATCH 2/2] run-command: Add interpreter permissions check Frans Klaver

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=op.v5e8mgbc0aolir@keputer \
    --to=fransklaver@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.