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

Re: [PATCH v2 0/2] Brown-bag fix on top of js/mingw-inherit-only-std-handles

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 2, 2019, 06:07 UTC
Message-ID
<xmqqk17fz2e7.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<nycvar.QRO.7.76.6.1912011042460.31080@tvgsbejvaqbjf.bet>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 5 quoted lines
> But the intention is not to help correct callers! The purpose of mapping
> `ERROR_SUCCESS` to 0 will help _only_ callers that try to report an error
> when none happened. On Windows, which is the only platform where the
> discussed function is compiled and used, `strerror(0)` has the
> well-established behavior of returning "No error".

But is the caller that ends up saying "No error" you mention below by calling strerror() exists *only* on Windows port somewhere in compat/ directory? If the call to strerror() is made from a codepath that is common to all platforms, then that caller *is* wrong to do so after seeing *no* errors.

So, no, sorry, but I do not understand the above line of reasoning.
Show 6 quoted lines
> Now imagine that a user encounters a bug where a code path does indeed
> incorrectly report an error where no error occurred (or where Git is
> looking for the error too late or something like that). You probably agree
> with me that we should really avoid reporting "Function not implemented"
> in such a case and rather say "No error", which will help figure out the
> bug much quicker.

Not really. A BUG() that catches a call to this function that should not be called when there is no error would help identify the problematic caller a lot faster by being louder---those users who get hit will raise their hands more readily than those who see "No error" and wonders "why does Git give that error message when there is no error?". IOW, "No error" sounds like sweeping the issue under the rug.

The argument could be "I do not want to be pressured to hunt for the problematic caller, and taking the approach to be less loud than the BUG() approach would allow the end users keep operating as if nothing bad happened, so that I can hunt for the caller iff/when I feel like it, and with no urgent need I can just ignore the hunt altogether. Not hitting with BUG() is a service to the end users who shouldn't be made a guinea pig---that is why we want to sweep the problematic caller under the rug. It may delay the discovery and fixing of problematic callers, which is a downside, though."

I would understand such an argument, even if I might not think that such an argument makes the right tradeoff between not hitting the users with BUG() and not being effective in finding the problematic caller.

Thanks.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 18 of 27 in “Brown-bag fix on top of js/mingw-inherit-only-std-handles”
  1. 0/1 Brown-bag fix on top of js/mingw-inherit-only-std-handlesJohannes Schindelin via GitGitGadget, Nov 29, 2019
  2. 1/1 mingw: do set `errno` correctly when trying to restrict handle inheritanceJohannes Schindelin via GitGitGadget, Nov 29, 2019
  3. Johannes SixtNov 29, 2019
  4. Johannes SchindelinNov 30, 2019
  5. Johannes SixtNov 30, 2019
  6. 0/2 Brown-bag fix on top of js/mingw-inherit-only-std-handlesJohannes Schindelin via GitGitGadget, Nov 30, 2019
  7. 1/2 mingw: do set `errno` correctly when trying to restrict handle inheritanceJohannes Schindelin via GitGitGadget, Nov 30, 2019
  8. 2/2 mingw: translate ERROR_SUCCESS to errno = 0Johannes Schindelin via GitGitGadget, Nov 30, 2019
  9. Junio C HamanoNov 30, 2019
  10. Johannes SixtNov 30, 2019
  11. Andreas SchwabNov 30, 2019
  12. Junio C HamanoNov 30, 2019
  13. Andreas SchwabNov 30, 2019
  14. Johannes SchindelinNov 30, 2019
  15. Junio C HamanoNov 30, 2019
  16. Junio C HamanoDec 1, 2019
  17. Johannes SchindelinDec 1, 2019
  18. Junio C HamanoDec 2, 2019
  19. Johannes SchindelinDec 2, 2019
  20. Johannes SixtNov 30, 2019
  21. Junio C HamanoNov 30, 2019
  22. 0/2 Brown-bag fix on top of js/mingw-inherit-only-std-handlesJohannes Schindelin via GitGitGadget, Dec 2, 2019
  23. 2/2 mingw: translate ERROR_SUCCESS to errno = 0Johannes Schindelin via GitGitGadget, Dec 2, 2019
  24. 1/2 mingw: do set `errno` correctly when trying to restrict handle inheritanceJohannes Schindelin via GitGitGadget, Dec 2, 2019
  25. Johannes SixtDec 2, 2019
  26. Junio C HamanoDec 2, 2019
  27. Johannes SchindelinDec 3, 2019

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.