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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

On Tue, Nov 22, 2011 at 10:31 AM, Frans Klaver <fransklaver@xxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]