# Why usage function exit with code 129?

5 messages from 2012-01-06 to 2012-01-06. Participants: 徐迪, Nguyen Thai Ngoc Duy.
Thread: https://gitlist.dev/t/29302

## 徐迪, 2012-01-06 07:15

Subject: Why usage function exit with code 129?
Message-ID: <CAMocUqSbiO2XC3PUEciyV3HxgqDPW_rTW-hYH4P=C=BFCSrQMQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMocUqSbiO2XC3PUEciyV3HxgqDPW_rTW-hYH4P%3DC%3DBFCSrQMQ%40mail.gmail.com

```
I did like this:
$ git add --foo
$ echo $?
what I got is 129, should this code being used as program terminated
due to a signal? Cause it's 128+1. According to this[1].

[1] http://tldp.org/LDP/abs/html/exitcodes.html

```

## Nguyen Thai Ngoc Duy, 2012-01-06 07:22

Subject: Re: Why usage function exit with code 129?
Message-ID: <CACsJy8Amo_9-9oCgHbwOZvTaNOV3Jj6wLCTU7nZT5LeA55=NEA@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8Amo_9-9oCgHbwOZvTaNOV3Jj6wLCTU7nZT5LeA55%3DNEA%40mail.gmail.com
In-Reply-To: <CAMocUqSbiO2XC3PUEciyV3HxgqDPW_rTW-hYH4P=C=BFCSrQMQ@mail.gmail.com>

```
2012/1/6 徐迪 <xudifsd@gmail.com>:
> I did like this:
> $ git add --foo
> $ echo $?
> what I got is 129, should this code being used as program terminated
> due to a signal? Cause it's 128+1. According to this[1].

usage() (in your case) always returns 129, die() 128. See 5d1a5c0
([PATCH] Better error reporting for "git status")

> [1] http://tldp.org/LDP/abs/html/exitcodes.html

No it does not mean terminated by signals.
-- 
Duy

```

## 徐迪, 2012-01-06 08:06

Subject: Re: Why usage function exit with code 129?
Message-ID: <CAMocUqSmes+x_tkP6V0OM5rQ5wDGmMm=Q2MFBPhz6Qvzz_SOTg@mail.gmail.com>
URL: https://gitlist.dev/e/CAMocUqSmes%2Bx_tkP6V0OM5rQ5wDGmMm%3DQ2MFBPhz6Qvzz_SOTg%40mail.gmail.com
In-Reply-To: <CACsJy8Amo_9-9oCgHbwOZvTaNOV3Jj6wLCTU7nZT5LeA55=NEA@mail.gmail.com>

```
>> [1] http://tldp.org/LDP/abs/html/exitcodes.html
>
> No it does not mean terminated by signals.
> --
In that case, why not just use another code instead of the code that
leads misunderstanding? I mean, as far as I know, exit code between
129 and 255 are used to indicate the program terminated by signal. So
that usage function can only exit with code between 1 and 127. Am I
wrong?

```

## Nguyen Thai Ngoc Duy, 2012-01-06 08:11

Subject: Re: Why usage function exit with code 129?
Message-ID: <CACsJy8D8uKGhtg4zjbHsJCGmqjTwodzFmAZ5w=aUx9CdadVAfw@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8D8uKGhtg4zjbHsJCGmqjTwodzFmAZ5w%3DaUx9CdadVAfw%40mail.gmail.com
In-Reply-To: <CAMocUqSmes+x_tkP6V0OM5rQ5wDGmMm=Q2MFBPhz6Qvzz_SOTg@mail.gmail.com>

```
2012/1/6 徐迪 <xudifsd@gmail.com>:
>>> [1] http://tldp.org/LDP/abs/html/exitcodes.html
>>
>> No it does not mean terminated by signals.
>> --
> In that case, why not just use another code instead of the code that
> leads misunderstanding? I mean, as far as I know, exit code between
> 129 and 255 are used to indicate the program terminated by signal. So
> that usage function can only exit with code between 1 and 127. Am I
> wrong?

Because that code has been there too long (since 2005) any probably
all git commands, including plumbing ones, rely on it. Changing it now
may break existing scripts.
-- 
Duy

```

## 徐迪, 2012-01-06 08:18

Subject: Re: Why usage function exit with code 129?
Message-ID: <CAMocUqR5NtLJTzEDXN6Os=b0w1aP6BMb6uphNJgZWKFT0dJy-Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAMocUqR5NtLJTzEDXN6Os%3Db0w1aP6BMb6uphNJgZWKFT0dJy-Q%40mail.gmail.com
In-Reply-To: <CACsJy8D8uKGhtg4zjbHsJCGmqjTwodzFmAZ5w=aUx9CdadVAfw@mail.gmail.com>

```
在 2012年1月6日 下午4:11，Nguyen Thai Ngoc Duy <pclouds@gmail.com> 写道：
> 2012/1/6 徐迪 <xudifsd@gmail.com>:
>>>> [1] http://tldp.org/LDP/abs/html/exitcodes.html
>>>
>>> No it does not mean terminated by signals.
>>> --
>> In that case, why not just use another code instead of the code that
>> leads misunderstanding? I mean, as far as I know, exit code between
>> 129 and 255 are used to indicate the program terminated by signal. So
>> that usage function can only exit with code between 1 and 127. Am I
>> wrong?
>
> Because that code has been there too long (since 2005) any probably
> all git commands, including plumbing ones, rely on it. Changing it now
> may break existing scripts.
> --
> Duy

Ok, that sounds logical.

```
