# Git thinks a failing command doesn't exist

5 messages from 2010-08-11 to 2010-08-11. Participants: Ævar Arnfjörð Bjarmason, Jeff King.
Thread: https://gitlist.dev/t/24708

## Ævar Arnfjörð Bjarmason, 2010-08-11 19:12

Subject: Git thinks a failing command doesn't exist
Message-ID: <AANLkTin7E-v9TYd1KoD73knnSwSMy-V-pvS0TmpQd72M@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTin7E-v9TYd1KoD73knnSwSMy-V-pvS0TmpQd72M%40mail.gmail.com

```
Has this been noted before:

    $ git rebase --continue
    .: 986: Can't open /home/avar/g/git/.git/rebase-merge/author-script
    git: 'rebase' is not a git command. See 'git --help'.
    Did you mean this?
            rebase

Rebase failed, but the help mechanism seems to just test the exit
code, or something similar.

Perhaps help_unknown_cmd could just check if the command it's
suggesting == what it says doesn't exist, if so the command probably
failed, but maybe there's a better solution.

```

## Jeff King, 2010-08-11 19:25

Subject: Re: Git thinks a failing command doesn't exist
Message-ID: <20100811192554.GA8106@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100811192554.GA8106%40coredump.intra.peff.net
In-Reply-To: <AANLkTin7E-v9TYd1KoD73knnSwSMy-V-pvS0TmpQd72M@mail.gmail.com>

```
On Wed, Aug 11, 2010 at 07:12:38PM +0000, Ævar Arnfjörð Bjarmason wrote:

> Has this been noted before:
> 
>     $ git rebase --continue
>     .: 986: Can't open /home/avar/g/git/.git/rebase-merge/author-script
>     git: 'rebase' is not a git command. See 'git --help'.
>     Did you mean this?
>             rebase
> 
> Rebase failed, but the help mechanism seems to just test the exit
> code, or something similar.

Which git version and which platform? There is code in run-command to
check for an exit code of 127 (which is what posix shells should produce
for a missing command), and to set ENOENT in that case, which is what
execv_dashed_external notices for a missing command.

So either your shell is producing that exit code for a different case,
or git is broken.

-Peff

```

## Ævar Arnfjörð Bjarmason, 2010-08-11 19:45

Subject: Re: Git thinks a failing command doesn't exist
Message-ID: <AANLkTik3QmyP3sygbd36VhUQtdK-z81vqVAoAcPofFO+@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTik3QmyP3sygbd36VhUQtdK-z81vqVAoAcPofFO%2B%40mail.gmail.com
In-Reply-To: <20100811192554.GA8106@coredump.intra.peff.net>

```
On Wed, Aug 11, 2010 at 19:25, Jeff King <peff@peff.net> wrote:
> On Wed, Aug 11, 2010 at 07:12:38PM +0000, Ævar Arnfjörð Bjarmason wrote:
>
>> Has this been noted before:
>>
>>     $ git rebase --continue
>>     .: 986: Can't open /home/avar/g/git/.git/rebase-merge/author-script
>>     git: 'rebase' is not a git command. See 'git --help'.
>>     Did you mean this?
>>             rebase
>>
>> Rebase failed, but the help mechanism seems to just test the exit
>> code, or something similar.
>
> Which git version and which platform? There is code in run-command to
> check for an exit code of 127 (which is what posix shells should produce
> for a missing command), and to set ENOENT in that case, which is what
> execv_dashed_external notices for a missing command.

It's 1.7.2.1.295.gdf931 on Debian testing. Which is pu as it was on
midnight UTC (I build it from cron) + these patches (which shouldn't
matter):

    # Monkeypatches

                  git cherry-pick 041bc904d2 # t/lib-git-svn.sh: use
$PERL_PATH for perl, not perl from $PATH
    git cherry-pick 855a1f8836 # commit: fix test broken by
jn/commit-no-change-wo-status
    git revert --no-edit 48e46574e6 # rebase -i: add exec command to
launch a shell command

> So either your shell is producing that exit code for a different case,
> or git is broken.

My shell is Debian /bin/dash 0.5.5.1-6.

Unfortunately the error with rebase was some one-off thing that I
couldn't reproduce. I'm not even sure /what/ I did to make it happen.

```

## Jeff King, 2010-08-11 19:48

Subject: Re: Git thinks a failing command doesn't exist
Message-ID: <20100811194841.GA8689@coredump.intra.peff.net>
URL: https://gitlist.dev/e/20100811194841.GA8689%40coredump.intra.peff.net
In-Reply-To: <AANLkTik3QmyP3sygbd36VhUQtdK-z81vqVAoAcPofFO+@mail.gmail.com>

```
On Wed, Aug 11, 2010 at 07:45:14PM +0000, Ævar Arnfjörð Bjarmason wrote:

> > So either your shell is producing that exit code for a different case,
> > or git is broken.
> 
> My shell is Debian /bin/dash 0.5.5.1-6.

Hmm, I can't reproduce here, and I am also using dash as my shell.

> Unfortunately the error with rebase was some one-off thing that I
> couldn't reproduce. I'm not even sure /what/ I did to make it happen.

OK. The code is _supposed_ to work as you expected, so if it happens
again, I guess try to reproduce and we'll go from there.

-Peff

```

## Ævar Arnfjörð Bjarmason, 2010-08-11 20:10

Subject: Re: Git thinks a failing command doesn't exist
Message-ID: <AANLkTi=78rrF5aK0ku27haLhDp6a=W86EGc_RihdaHVW@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3D78rrF5aK0ku27haLhDp6a%3DW86EGc_RihdaHVW%40mail.gmail.com
In-Reply-To: <20100811194841.GA8689@coredump.intra.peff.net>

```
On Wed, Aug 11, 2010 at 19:48, Jeff King <peff@peff.net> wrote:
> On Wed, Aug 11, 2010 at 07:45:14PM +0000, Ævar Arnfjörð Bjarmason wrote:
>
>> > So either your shell is producing that exit code for a different case,
>> > or git is broken.
>>
>> My shell is Debian /bin/dash 0.5.5.1-6.
>
> Hmm, I can't reproduce here, and I am also using dash as my shell.
>
>> Unfortunately the error with rebase was some one-off thing that I
>> couldn't reproduce. I'm not even sure /what/ I did to make it happen.
>
> OK. The code is _supposed_ to work as you expected, so if it happens
> again, I guess try to reproduce and we'll go from there.

git-rebase must have exited with a code of 127. I tried every exit
code from 1 to 255, and 127 is the only one that does this:

$ head -n2 git-rebase
#!/bin/sh
exit 127

$ ./git rebase --continue
git: 'rebase' is not a git command. See 'git --help'.

Did you mean this?
        rebase

```
