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

Re: [PATCH 1/1] mingw: intercept isatty() to handle /dev/null as Git expects it

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 16, 2016, 18:08 UTC
Message-ID
<xmqqy3zfsq4q.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<129f000c-49c1-0e75-26b3-c96e9b442443@kdbg.org>
Johannes Sixt <j6t@kdbg.org> writes:
Show 9 quoted lines
> Am 11.12.2016 um 12:16 schrieb Johannes Schindelin:
>> When Git's source code calls isatty(), it really asks whether the
>> respective file descriptor is connected to an interactive terminal.
>> ...
>> +			if (!GetConsoleScreenBufferInfo(handle, &dummy))
>> +				res = 0;
>
> I am sorry to have to report that this check does not work as
> expected. I am operating Git from CMD, not mintty, BTW.
Ouch.

Sorry for not having waited for you to chime in before agreeing to fast-track this one, and now this is in 'master'.

I should have known better than that by now, after having seen you uncover bugs that did not trigger in Dscho's environment and vice versa to tell you that Windows specific things both of you deem good have a much higher chance of being correct than a change without an Ack by the other.

Show 22 quoted lines
> It fails with GetLastError() == 6 (invalid handle value). The reason
> for this is, I think, that in reality we are not writing to the
> console directly, but to a pipe, which is drained by console_thread(),
> which writes to the console.
>
> I have little clue what this winansi.c file is doing. Do you have any
> pointers where I should start digging?
>
> Wait...
>
> Should we not use winansi_get_osfhandle() instead of _get_osfhandle()?
>
>> +		}
>> +	}
>> +
>> +	return res;
>> +}
>> +
>>  void winansi_init(void)
>>  {
>>  	int con1, con2;
>>
Previous: Johannes SixtNext: Johannes Sixt
Message 4 of 21 in “Fix a long-standing isatty() problem on Windows”
  1. 0/1 Fix a long-standing isatty() problem on WindowsJohannes Schindelin, Dec 11, 2016
  2. 1/1 mingw: intercept isatty() to handle /dev/null as Git expects itJohannes Schindelin, Dec 11, 2016
  3. Johannes SixtDec 16, 2016
  4. Junio C HamanoDec 16, 2016
  5. Johannes SixtDec 16, 2016
  6. Junio C HamanoDec 16, 2016
  7. Johannes SchindelinDec 21, 2016
  8. winansi_isatty(): fix when Git is used from CMDJohannes Sixt, Dec 18, 2016
  9. Johannes SixtDec 18, 2016
  10. Johannes SixtDec 19, 2016
  11. Johannes SchindelinDec 21, 2016
  12. Johannes SchindelinDec 20, 2016
  13. Junio C HamanoDec 19, 2016
  14. Johannes SchindelinDec 20, 2016
  15. Junio C HamanoDec 20, 2016
  16. Johannes SchindelinDec 21, 2016
  17. Junio C HamanoDec 21, 2016
  18. Johannes SchindelinDec 22, 2016
  19. Junio C HamanoDec 11, 2016
  20. Johannes SchindelinDec 12, 2016
  21. Junio C HamanoDec 12, 2016

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.