Subject: Re: bug#19868: #19868 25.0.50; Compilation eats buffers

From: Eli Zaretskii <[email-masked]>
Date: Sat, 13 Aug 2016 09:44:29 +0300

> From: Noam Postavsky <[email-masked]>
> Date: Fri, 12 Aug 2016 16:47:07 -0400
> Cc: Richard Copley <[email-masked]>
> 
> I reproduced this (the hanging, not the buffer eating) on Windows 10,
> Emacs 25.1, MinGW64.  Stepping with gdb I found the the hang occurs in
> sys_close where it calls _close (fd).  This is being called from
> deactivate_process:
> 
>   for (i = 0; i < PROCESS_OPEN_FDS; i++)
>     close_process_fd (&p->open_fd[i]); // <-- when i == 2

Does it hang in the _close call itself, or somewhere else?

And what is the value of fd?

Can you instrument the relevant code with printf's and see this
happening without stepping through the code with GDB?  Doing the
latter might change the timing of the calls, so we might be trying to
use file descriptors when the process (cmdproxy) is already dead, and
so the other end of the pipe no longer exists.

In any case, this is a tricky situation, because we kill the shell,
not the program it runs.  When the program run from the shell was
built with -mwindows, it is detached from the shell, and the various
Emacs facilities that try to kill subprocesses are likely to fail in
exciting ways.

IOW, running -mwindows programs from the likes of "M-x compile" is not
really supported on MS-Windows, I think.  Of course, if we can figure
out how to avoid the hang in this case, we should.