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

Re: [PATCH] compat/winansi: fix die_lasterr() argument formatting

From
Johannes Sixt <j6t@kdbg.org>
Date
Sep 21, 2026, 04:06 UTC
Message-ID
<9c1cde3d-92c4-4684-834e-bae97fd33f5f@kdbg.org>
In-Reply-To
<CAEs0Zp4LK1ZHkL0tdi_k_=-u86HVm07FzyOJdO-=+DY9c3ZrYA@mail.gmail.com>
Am 21.09.26 um 05:00 schrieb Yongqiang Tian:
Show 13 quoted lines
> 3. Remove die_lasterr() and report GetLastError() directly at those
>    call sites. This avoids the va_list forwarding, allocation, and
>    errno conversion altogether.
> 
> The third direction now seems the simplest to me. It also follows
> existing Windows-specific code in Git that reports GetLastError()
> directly, for example:
> 
> https://github.com/git/git/blob/9a0c4701dcd5725c4184599322b52933ff5005ca/compat/win32/syslog.c#L10-L13
> 
> and:
> 
> https://github.com/git/git/blob/9a0c4701dcd5725c4184599322b52933ff5005ca/compat/fsmonitor/fsm-listen-win32.c#L106-L109
Sounds reasonable to me.
> -               die_lasterr("DuplicateHandle(%li) failed",
> -                       (long) (intptr_t) hnd);
> +               die("DuplicateHandle(%p) failed: Windows error %lu",
> +                   (void *)hnd, GetLastError());
But please leave the conversion to %p for another time.
Concerning the text "Windows error", please follow existing practice.
-- Hannes
Previous: Yongqiang TianNext: Yongqiang Tian
Message 7 of 12 in “compat/winansi: fix die_lasterr() argument formatting”
  1. compat/winansi: fix die_lasterr() argument formattingYongqiang Tian, Sep 16, 2026
  2. Junio C HamanoSep 16, 2026
  3. Johannes SixtSep 16, 2026
  4. René ScharfeSep 16, 2026
  5. Johannes SixtSep 16, 2026
  6. Yongqiang TianSep 21, 2026
  7. Johannes SixtSep 21, 2026
  8. compat/winansi: fix die_lasterr() argument formattingYongqiang Tian, Sep 21, 2026
  9. Junio C HamanoSep 21, 2026
  10. Yongqiang TianSep 21, 2026
  11. compat/winansi: fix die_lasterr() argument formattingYongqiang Tian, Sep 21, 2026
  12. Johannes SixtSep 23, 2026

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.