[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sshx protocol from MS Windows occasionally cuts off results in M-x r

From: Jim Porter
Subject: Re: sshx protocol from MS Windows occasionally cuts off results in M-x rgrep
Date: Tue, 4 May 2021 10:40:41 -0700

On Tue, May 4, 2021 at 7:19 AM Michael Albinus <> wrote:
> I've played with this for some hours. The missing grep hits are always
> the hits from the end, meaning that the output of the remote process
> does not arrive completely.

That's what I see as well. Interestingly, this also occurs using
ag.el[1], so it's not strictly a problem with find/grep.

> When this happens, Tramp is already out of the game. It has prepared the
> *grep* buffer, and it has started the remote grep process. Arrival of new
> output of the remote process is out of Tramp control.
> Like you, I could reproduce it only with Tramp's sshx on Windows 10, not
> with plinkx. So I guess it is a problem of the Windows ssh client, that
> it doesn't show all output if a remote process has exited. Some
> buffering problems?

Is it possible that there's an issue with how Tramp runs the process?
In the debug log for Tramp, I see the following commands (shortened
for readability):

  ssh    -e none -t -t server /bin/sh  && exit || exit

  cd /home/jim/src/tramp/info/ &&  exec <<'[heredoc]'  env [...] /bin/sh
  find . [...] -exec grep --color=always \
  -i -nH --null -e info \{\} +
  ) </dev/tty

If I run these manually in cmd.exe, the command prompt closes
immediately. If I'm understanding things correctly, I think that's
because of the `exit' in the first command and the `exec' in the
second. If I open a subshell (by running cmd.exe in an existing
command prompt), the window stays open and I can see the output. I've
tried a bunch of times, but I'm completely unable to reproduce the
issue when running in cmd.exe. That suggests to me that the MS Windows
ssh client is working ok, or at least that any bugs here can be
avoided if we're careful.

I also tried using v8.1 of Win32 ssh, and the same problem happens.

However, I seem to have fixed it locally by enabling
`direct-async-process'. With that set to t, I always see the correct
number of results from rgrep. This works well enough that this bug
won't bother me anymore, but it would be nice to know what's going on.
Perhaps the differences between direct and indirect async processes
will help to isolate the bug?

- Jim


reply via email to

[Prev in Thread] Current Thread [Next in Thread]