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

Re: RFC: error codes on exit

From
Jeff King <peff@peff.net>
Date
May 21, 2021, 09:43 UTC
Message-ID
<YKeAtj7wwW0Qskm+@coredump.intra.peff.net>
In-Reply-To
<YKaguiSjewjpvOj5@google.com>
On Thu, May 20, 2021 at 10:47:38AM -0700, Jonathan Nieder wrote:
Show 8 quoted lines
> >                 And that gets very daunting to think about annotating
> > and communicating about each such case (we don't even pass that level of
> > detailed information inside the program in a machine-readable way;
> > scraping stderr is the best way to figure this stuff out now).
> 
> This feels like good news to me: it sounds like if we add
> application-specific codes like MISSING_OBJECT to Git, then it would
> be useful to both of us.

Perhaps. I think the context matters between "missing an object from the command line" and "missing an object I expected to find while traversing". And I'm not sure all spots which look up an object will know that context.

In some sense that's "just" a programming problem; surfacing the errors to the right spot that can decide how to exit. But I worry a bit that it's fighting uphill against the current code structure. There's probably going to be a period where MISSING_OBJECT versus UNKNOWN is wildly inaccurate, and a long tail of cases to fix.

Erring to say "UNKNOWN" is probably OK for most callers (they are happy to learn of a specific error and act on it appropriately, but if Git can't tell it to them, they have a generic path). But erring in the other direction might be bad (you fail to realize a repo is corrupt, and instead attribute it to caller error).

So again, I return "I dunno". Something of this magnitude probably has to be done incrementally and over time. But I'd be loathe to trust it and convert existing callers use it for a while. And that creates a chicken-and-egg problem for finding the places which need improvement.

-Peff
Previous: Jonathan NiederNext: Jeff Hostetler
Message 22 of 26 in “RFC: error codes on exit”
  1. Jonathan NiederMay 19, 2021
  2. Felipe ContrerasMay 20, 2021
  3. Alex HenrieMay 21, 2021
  4. H. Peter AnvinMay 21, 2021
  5. Bagas SanjayaMay 22, 2021
  6. Junio C HamanoMay 22, 2021
  7. H. Peter AnvinMay 22, 2021
  8. Felipe ContrerasMay 22, 2021
  9. H. Peter AnvinMay 22, 2021
  10. Felipe ContrerasMay 22, 2021
  11. H. Peter AnvinMay 22, 2021
  12. Philip OakleyMay 22, 2021
  13. Felipe ContrerasMay 22, 2021
  14. Alex HenrieMay 25, 2021
  15. Felipe ContrerasMay 25, 2021
  16. Junio C HamanoMay 20, 2021
  17. Felipe ContrerasMay 20, 2021
  18. Jonathan NiederMay 20, 2021
  19. Junio C HamanoMay 20, 2021
  20. Jeff KingMay 20, 2021
  21. Jonathan NiederMay 20, 2021
  22. Jeff KingMay 21, 2021
  23. Jeff HostetlerMay 20, 2021
  24. brian m. carlsonMay 21, 2021
  25. brian m. carlsonMay 21, 2021
  26. Ævar Arnfjörð BjarmasonMay 26, 2021

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.