Subject: Re: bug#71709: Fix recent change in tramp-sh-handle-make-process

From: Iurie Marian <[email-masked]>
Date: Sat, 22 Jun 2024 11:18:16 +0200

Might it be related to the ~:connection-type 'pipe~?
If I remove it I get the expected results.

Many thanks
Iurie

On Sat, 22 Jun 2024 at 11:10, Iurie Marian <[email-masked]> wrote:
>
> Hello Michael,
>
> Could you please try the below snippet?
> Evaluate it in a local and _remote_ buffer.
> ```
> ;; -*- lexical-binding: t; -*-
>
> (let ((.test-buffer (get-buffer-create "*test buffer*"))
>       (.remote? (file-remote-p default-directory)))
>   (with-current-buffer .test-buffer
>     (goto-char (max-char))
>     (insert "====================\n")
>     (insert (if .remote? "Remote:\n" "Local :\n")))
>
>   (make-process :file-handler t
>                 :connection-type 'pipe
>                 :name "test proc"
>                 :stderr .test-buffer
>                 :noquery t
>                 :command (list "echo" "Hello!")
>                 :filter (lambda (proc str)
>                           (with-current-buffer .test-buffer
>                             (goto-char (max-char))
>                             (insert "test proc output: " str)))))
> ```
>
> I get the below output:
> ```
> ====================
> Local :
>
> Process test proc stderr finished
> test proc output: Hello!
> ====================
> Remote:
> /usr/bin/cat: /tmp/tramp.J0RZDc: No such file or directory
> ```
>
> I would expect "Hello!" output from _remote_ as well. Isn't it?
> It seems that the process is not executed and the output
> "/usr/bin/cat: /tmp/tramp.J0RZDc: No such file or directory" is from
> stderr.
>
> Kind Regards,
> Iurie
>
>
> On Sat, 22 Jun 2024 at 09:31, Michael Albinus <[email-masked]> wrote:
> >
> > Iurie Marian <[email-masked]> writes:
> >
> > > Hello Michael,
> >
> > Hi Iurie,
> >
> > > After updating emacs today I got strange errors while running
> > > consult-find in a remote container, for example:
> > > ```
> > > /usr/bin/cat: /tmp/tramp.gBbQP1: No such file or directory
> > > /usr/bin/cat: /tmp/tramp.SWKx2Y: No such file or directory
> > > ```
> > >
> > > I checked the consult-find (which also points out to a "tramp bug"),
> > > then I checked the tramp's latest changes and applied that one-line
> > > from the patch, which fixed my issue.
> > > (In fact that line `(stderr (plist-get args :stderr))' actually
> > > nullifies the `stderr', so probably that's why it worked and I had a
> > > feeling that it is a solution)
> > >
> > > Please see below:
> > > * consult-find: https://github.com/minad/consult/blob/main/consult.el#L4965
> > > * consult--async-process:
> > > https://github.com/minad/consult/blob/main/consult.el#L2287C1-L2296C69
> >
> > Sorry, I don't use consult, and I don't know its code. If we want to
> > hunt a Tramp bug, we should run a use case with vanilla Emacs, invoking
> > Tramp's remote make-process.
> >
> > > I guess, to reproduce the issue, it's enough to invoke `make-process'
> > > on a remote location and with a non-nil `:stderr' argument (a buffer
> > > in `consult-find''s case).
> >
> > Tramp has a very comprehensive test library, see .../test/lisp/net/tramp-tests.el
> > The test case tramp-test30-make-process runs extensive tests over
> > make-process, including a non-empty stderr. And of course, I always run
> > the whole testsuite before I commit serious Tramp changes.
> >
> > So pls show a recipe how to reproduce the problem, starting with 'emacs
> > -Q'. And pls contact the consult author(s); they might report a Tramp
> > problem when they detect such.
> >
> > > Kind Regards,
> > > Iurie
> >
> > Best regards, Michael.