GNU bug report logs - #43226
28.0.50; Running Tramp tests on MS-Windows leaves zombie processes on the remote

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Sat, 5 Sep 2020 16:39:02 UTC

Severity: normal

Found in version 28.0.50

Full log


Message #50 received at 43226 <at> debbugs.gnu.org (full text, mbox):

From: Henrik Ahlgren <pablo <at> seestieto.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 43226 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: Re: bug#43226: 28.0.50; Running Tramp tests on MS-Windows leaves
 zombie processes on the remote
Date: Wed, 26 Oct 2022 14:34:09 +0300
Eli Zaretskii <eliz <at> gnu.org> writes:

> Maybe Michael (CC'ed) can explain how this is supposed to work,
> because I don't think I understand.  The actual process run by Emacs
> is ssh, not cat, so how is EOF supposed to get to the remote "cat"?

Not exactly sure, but clearly there is some difference between POSIX
platforms and Windows on how process-send-eof works in certain
situations when dealing with Tramp remote connections, and this breaks
some functionality of Magit, not just Tramp's own tests. 

In my test I just used cat to emulate "git apply -" to trace what it
receives from the standard input.

This issue is documented on the FAQ section of the Magit manual:

  A.2.13 I am unable to stage when using Tramp from MS Windows
  ------------------------------------------------------------

  Magit may be unable to stage (or otherwise apply) individual hunks when
  you are connected to remote machine using Tramp and the local machine
  uses MS Windows.

     There appears to be a problem with ‘process-send-eof’ in this
  scenario, as mentioned at the end of ‘tramp-tests.el’.  I have contacted
  the Tramp maintainer about this.  For now this unfortunately means that
  it just doesn’t work and we cannot do anything about it.  If you have
  more information, then please comment on
  <https://github.com/magit/magit/issues/3624>.

After some debugging I figured out that by simply adding
(process-send-string process "\004") in magic-process.el before (maybe
even instead?) of process-send-eof, it works perfectly well. Maybe it's
a valid workaround, or even the proper fix, but clearly there is some
point of having a separate function for sending EOF.

In the C implementation of process-send-eof (Emacs 27.1), it seems to only
send EOF if the process has pty_flag set:

  if (XPROCESS (proc)->pty_flag)
    send_process (proc, "\004", 1, Qnil);

I think this could be the reason: after all I believe PTYs are a fairly
recent feature in Windows and Emacs does not support it yet? OTOH, this
function seems to work when running ssh directly from start-file-process
which apparently doesn't use cmdproxy.exe. Anyway, I have no means of
compiling Emacs on Windows to debug the C source to see if pty_flag is
set on the non-cmdproxy.exe case.






This bug report was last modified 2 years and 235 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.