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

Re: [PATCH] run-command: simplify wait_or_whine

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Jun 1, 2013, 21:35 UTC
Message-ID
<CAMP44s078Vn6CMRyqAkgE6rFBgUyJV9wJaYqkQgz-w3WnEi-vQ@mail.gmail.com>
In-Reply-To
<20130601170147.GA19234@sigill.intra.peff.net>
On Sat, Jun 1, 2013 at 12:01 PM, Jeff King <peff@peff.net> wrote:
> On Sat, Jun 01, 2013 at 09:30:50AM -0500, Felipe Contreras wrote:
Show 29 quoted lines
>> commit 709ca730f8e093005cc882bfb86c0ca9c83d345b
>> Author: Jeff King <peff@peff.net>
>> Date:   Sat Jan 5 09:49:49 2013 -0500
>>
>>     run-command: encode signal death as a positive integer
>>
>>     When a sub-command dies due to a signal, we encode the
>>     signal number into the numeric exit status as "signal -
>>     128". This is easy to identify (versus a regular positive
>>     error code), and when cast to an unsigned integer (e.g., by
>>     feeding it to exit), matches what a POSIX shell would return
>>     when reporting a signal death in $? or through its own exit
>>     code.
>>
>>     So we have a negative value inside the code, but once it
>>     passes across an exit() barrier, it looks positive (and any
>>     code we receive from a sub-shell will have the positive
>>     form). E.g., death by SIGPIPE (signal 13) will look like
>>     -115 to us in inside git, but will end up as 141 when we
>>     call exit() with it. And a program killed by SIGPIPE but run
>>     via the shell will come to us with an exit code of 141.
>
> Your patch changes the error code that is propagated via exit() in this
> case. We cannot know "nobody is checking for the specific code", because
> the list of callers is every shell script or program which execs git.
> Some of them do care about the exit code. I can give an example of a
> case I have that cares, but I do not think it is even important. The
> point is that we would be regressing an existing interface, and cannot
> know who is broken by it.

Of course we can know, by going forward with the change, and quite often that's the only way to know for sure.

But if it's true what you said that we haven't changed what the process returns, then it doesn't make sense to attempt going forward, because we have no reference point about the likelihood of scripts relying on specific exit codes.

-- 
Felipe Contreras
Previous: Jeff King
Message 15 of 15 in “run-command: simplify wait_or_whine”
  1. run-command: simplify wait_or_whineFelipe Contreras, Jun 1, 2013
  2. Duy NguyenJun 1, 2013
  3. Felipe ContrerasJun 1, 2013
  4. Duy NguyenJun 1, 2013
  5. Felipe ContrerasJun 1, 2013
  6. Thomas RastJun 1, 2013
  7. Felipe ContrerasJun 1, 2013
  8. Duy NguyenJun 1, 2013
  9. Felipe ContrerasJun 1, 2013
  10. Duy NguyenJun 1, 2013
  11. Felipe ContrerasJun 1, 2013
  12. t0005: test git exit code from signal deathJeff King, Jun 1, 2013
  13. Felipe ContrerasJun 1, 2013
  14. Jeff KingJun 1, 2013
  15. Felipe ContrerasJun 1, 2013

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.