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

Re: [PATCH v2 5/6] Win32: Thread-safe windows console output

From
Johannes Sixt <j6t@kdbg.org>
Date
Jun 13, 2014, 06:10 UTC
Message-ID
<539A95F1.9030900@kdbg.org>
In-Reply-To
<1402127845-4862-6-git-send-email-kasal@ucw.cz>
Am 07.06.2014 09:57, schrieb Stepan Kasal:
Show 19 quoted lines
> From: Karsten Blees <blees@dcon.de>
> Date: Sat, 14 Jan 2012 22:24:19 +0100
>
> Winansi.c has many static variables that are accessed and modified from
> the [v][f]printf / fputs functions overridden in the file. This may cause
> multi threaded git commands that print to the console to produce corrupted
> output or even crash.
>
> Additionally, winansi.c doesn't override all functions that can be used to
> print to the console (e.g. fwrite, write, fputc are missing), so that ANSI
> escapes don't work properly for some git commands (e.g. git-grep).
>
> Instead of doing ANSI emulation in just a few wrapped functions on top of
> the IO API, let's plug into the IO system and take advantage of the thread
> safety inherent to the IO system.
>
> Redirect stdout and stderr to a pipe if they point to the console. A
> background thread reads from the pipe, handles ANSI escape sequences and
> UTF-8 to UTF-16 conversion, then writes to the console.

There's something fishy with this patch. Please checkout and build eac14f8909d9. Then run t5000-tar-tree.sh like so from a CMD prompt:

   sh t5000-tar-tree.sh -v -i

Notice that in test 36 (invoke tar filter by extension) the tar file is written to the console instead of the file. Hit Ctrl-C to interrupt the test; do not remove the trash directory. You can verify the incorrect behavior like this:

   cd "t\trash directory.t5000-tar-tree"
   ..\..\git archive -o config-implicit.tar.foo HEAD

It writes the tar file to the console. When you build the parent commit, and repeat these two commands, there is no unexpected console output.

The patch fcd428f4a952 (Win32: fix broken pipe detection) does not fix the incorrect behavior.

I haven't dug (and won't dig) deeper than that.
-- Hannes
-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Stepan KasalNext: Karsten Blees
Message 19 of 22 in “First part of Unicode console support for msysgit”
  1. 0/5 First part of Unicode console support for msysgitStepan Kasal, Jun 6, 2014
  2. 1/5 Support Unicode console output on WindowsStepan Kasal, Jun 6, 2014
  3. 2/5 Detect console streams more reliably on WindowsStepan Kasal, Jun 6, 2014
  4. 3/5 Warn if the Windows console font doesn't support UnicodeStepan Kasal, Jun 6, 2014
  5. Peter KreftingJun 6, 2014
  6. Stepan KasalJun 7, 2014
  7. 4/5 Win32: move main macro to a functionStepan Kasal, Jun 6, 2014
  8. 5/5 Win32: Thread-safe windows console outputStepan Kasal, Jun 6, 2014
  9. Peter KreftingJun 6, 2014
  10. Karsten BleesJun 6, 2014
  11. Karsten BleesJun 6, 2014
  12. Stepan KasalJun 6, 2014
  13. 0/6 First part of Unicode console support for msysgitStepan Kasal, Jun 7, 2014
  14. 1/6 Support Unicode console output on WindowsStepan Kasal, Jun 7, 2014
  15. 2/6 Detect console streams more reliably on WindowsStepan Kasal, Jun 7, 2014
  16. 3/6 Warn if the Windows console font doesn't support UnicodeStepan Kasal, Jun 7, 2014
  17. 4/6 Win32: add Unicode conversion functionsStepan Kasal, Jun 7, 2014
  18. 5/6 Win32: Thread-safe windows console outputStepan Kasal, Jun 7, 2014
  19. Johannes SixtJun 13, 2014
  20. 7/6 Win32: reliably detect console pipe handlesKarsten Blees, Jun 13, 2014
  21. 6/6 Win32: fix broken pipe detectionStepan Kasal, Jun 7, 2014
  22. Stepan KasalJun 6, 2014

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.