unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71709: Fix recent change in tramp-sh-handle-make-process
@ 2024-06-21 18:12 Iurie Marian
  2024-06-21 19:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Iurie Marian @ 2024-06-21 18:12 UTC (permalink / raw)
  To: 71709


[-- Attachment #1.1: Type: text/plain, Size: 334 bytes --]

tramp-sh-handle-make-process is failing when `:stderr' argument is used.


In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.41, cairo version 1.18.0) of 2024-06-21 built on rrouwprlc0222
Repository revision: e7123edfe7f7abc9043429dfb3f84941f83d6565
Repository branch: master
System Description: Ubuntu 24.04 LTS

[-- Attachment #1.2: Type: text/html, Size: 416 bytes --]

[-- Attachment #2: tramp-sh-handle-make-process.patch --]
[-- Type: text/x-patch, Size: 431 bytes --]

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index bce7c323dad..68018298b68 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2969,6 +2969,7 @@ tramp-sh-handle-make-process
       (let* ((program (car command))
 	     (args (cdr command))
 	     ;; STDERR can also be a file name.
+             (stderr (plist-get args :stderr))
 	     (tmpstderr
 	      (and stderr
 		   (tramp-unquote-file-local-name

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-21 18:12 bug#71709: Fix recent change in tramp-sh-handle-make-process Iurie Marian
@ 2024-06-21 19:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-21 21:09   ` Iurie Marian
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-21 19:21 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709

Iurie Marian <marian.iurie@gmail.com> writes:

Hi,

> tramp-sh-handle-make-process is failing when `:stderr' argument is
> used.
>
> In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
>  3.24.41, cairo version 1.18.0) of 2024-06-21 built on rrouwprlc0222
> Repository revision: e7123edfe7f7abc9043429dfb3f84941f83d6565
> Repository branch: master
> System Description: Ubuntu 24.04 LTS
>
> diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
> index bce7c323dad..68018298b68 100644
> --- a/lisp/net/tramp-sh.el
> +++ b/lisp/net/tramp-sh.el
> @@ -2969,6 +2969,7 @@ tramp-sh-handle-make-process
>        (let* ((program (car command))
>  	     (args (cdr command))
>  	     ;; STDERR can also be a file name.
> +             (stderr (plist-get args :stderr))
>  	     (tmpstderr
>  	      (and stderr
>  		   (tramp-unquote-file-local-name

Why that? stderr is extracted from args in tramp-skeleton-make-process.

Do you get an error which shows the problem?

Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-21 19:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-21 21:09   ` Iurie Marian
  2024-06-22  7:31     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Iurie Marian @ 2024-06-21 21:09 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

Hello Michael,

Yes, you are right, of course :) Okay, I didn't notice that `stderr'
is extracted earlier.
-----
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

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).

Kind Regards,
Iurie


On Fri, 21 Jun 2024 at 21:21, Michael Albinus <michael.albinus@gmx.de> wrote:
>
> Iurie Marian <marian.iurie@gmail.com> writes:
>
> Hi,
>
> > tramp-sh-handle-make-process is failing when `:stderr' argument is
> > used.
> >
> > In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> >  3.24.41, cairo version 1.18.0) of 2024-06-21 built on rrouwprlc0222
> > Repository revision: e7123edfe7f7abc9043429dfb3f84941f83d6565
> > Repository branch: master
> > System Description: Ubuntu 24.04 LTS
> >
> > diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
> > index bce7c323dad..68018298b68 100644
> > --- a/lisp/net/tramp-sh.el
> > +++ b/lisp/net/tramp-sh.el
> > @@ -2969,6 +2969,7 @@ tramp-sh-handle-make-process
> >        (let* ((program (car command))
> >            (args (cdr command))
> >            ;; STDERR can also be a file name.
> > +             (stderr (plist-get args :stderr))
> >            (tmpstderr
> >             (and stderr
> >                  (tramp-unquote-file-local-name
>
> Why that? stderr is extracted from args in tramp-skeleton-make-process.
>
> Do you get an error which shows the problem?
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-21 21:09   ` Iurie Marian
@ 2024-06-22  7:31     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-22  9:10       ` Iurie Marian
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22  7:31 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709

Iurie Marian <marian.iurie@gmail.com> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22  7:31     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-22  9:10       ` Iurie Marian
  2024-06-22  9:18         ` Iurie Marian
  2024-06-22 11:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 13+ messages in thread
From: Iurie Marian @ 2024-06-22  9:10 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

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 <michael.albinus@gmx.de> wrote:
>
> Iurie Marian <marian.iurie@gmail.com> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22  9:10       ` Iurie Marian
@ 2024-06-22  9:18         ` Iurie Marian
  2024-06-22  9:23           ` Iurie Marian
  2024-06-22 11:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 13+ messages in thread
From: Iurie Marian @ 2024-06-22  9:18 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

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 <marian.iurie@gmail.com> 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 <michael.albinus@gmx.de> wrote:
> >
> > Iurie Marian <marian.iurie@gmail.com> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22  9:18         ` Iurie Marian
@ 2024-06-22  9:23           ` Iurie Marian
  0 siblings, 0 replies; 13+ messages in thread
From: Iurie Marian @ 2024-06-22  9:23 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

Sorry, it's the ~:file-handler t~, not the connection-type.

Thanks
Iurie

On Sat, 22 Jun 2024 at 11:18, Iurie Marian <marian.iurie@gmail.com> wrote:
>
> 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 <marian.iurie@gmail.com> 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 <michael.albinus@gmx.de> wrote:
> > >
> > > Iurie Marian <marian.iurie@gmail.com> 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.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22  9:10       ` Iurie Marian
  2024-06-22  9:18         ` Iurie Marian
@ 2024-06-22 11:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-22 12:02           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22 11:18 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709

Iurie Marian <marian.iurie@gmail.com> writes:

> Hello Michael,

Hi Iurie,

> 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.

Thanks for the recipe. I've played with it. Most cases, it works as
expected, but sometimes I see a similar error. Looks like a race
condition. I'll debug further.

> Kind Regards,
> Iurie

Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22 11:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-22 12:02           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-22 16:52             ` Iurie Marian
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22 12:02 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709

[-- Attachment #1: Type: text/plain, Size: 509 bytes --]

Michael Albinus <michael.albinus@gmx.de> writes:

Hi Iurie,

> Thanks for the recipe. I've played with it. Most cases, it works as
> expected, but sometimes I see a similar error. Looks like a race
> condition. I'll debug further.

Well, I've found something suspicious in the code. Could you, pls, apply
the appended patch to tramp.el in your Emacs Lisp directory? Since it
changes a macro, you must remove all tramp*.elc files, and run 'make'
afzerwards.

>> Kind Regards,
>> Iurie

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1121 bytes --]

diff --git a/lisp/tramp.el b/lisp/tramp.el
index d9db17ea..f97ed66c 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -3594,8 +3594,7 @@ that a stederr file is supported.  BODY is the backend specific code."
 		    (not (tramp-equal-remote default-directory stderr)))
 	   (signal 'file-error (list "Wrong stderr" stderr)))

-	 (let ((default-directory tramp-compat-temporary-file-directory)
-	       (name (tramp-get-unique-process-name name))
+	 (let ((name (tramp-get-unique-process-name name))
 	       (buffer
 		(if buffer
 		    (get-buffer-create buffer)
@@ -5058,7 +5057,8 @@ should be set connection-local.")
     ;; Check for `tramp-sh-file-name-handler' and
     ;; `adb-file-name-handler-p', because something is different
     ;; between tramp-sh.el, and tramp-adb.el or tramp-sshfs.el.
-    (let* ((sh-file-name-handler-p (tramp-sh-file-name-handler-p v))
+    (let* ((default-directory tramp-compat-temporary-file-directory)
+	   (sh-file-name-handler-p (tramp-sh-file-name-handler-p v))
 	   (adb-file-name-handler-p (tramp-adb-file-name-p v))
 	   (env (mapcar
 		 (lambda (elt)

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22 12:02           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-22 16:52             ` Iurie Marian
  2024-06-22 17:05               ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Iurie Marian @ 2024-06-22 16:52 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

Unfortunately, the patch doesn't help.
By the way, this is what I noticed:
* the issue seems to occur more often in a docker container
* over /ssh it is working well, or at least it never occurred
* the temporary buffers like ~/tmp/tramp.J0RZDc~ are actually created on remote
* after repetitive tests I noticed that it doesn't reproduce anymore
and I added a line to print the default-directory right before
`make-process` for stderr: ~lisp/net/tramp-sh.el:3057~
  - when it fails, the default-directory is on local host
  - when it succeeds - it's on remote (where I guess it finds that
temporary file)
* on emacs restart it starts reproducing again
* once it starts working, it never reproduces again until emacs restart

It looks like it has something to do with `stderr` process execution
environment.

On Sat, 22 Jun 2024 at 14:02, Michael Albinus <michael.albinus@gmx.de> wrote:
>
> Michael Albinus <michael.albinus@gmx.de> writes:
>
> Hi Iurie,
>
> > Thanks for the recipe. I've played with it. Most cases, it works as
> > expected, but sometimes I see a similar error. Looks like a race
> > condition. I'll debug further.
>
> Well, I've found something suspicious in the code. Could you, pls, apply
> the appended patch to tramp.el in your Emacs Lisp directory? Since it
> changes a macro, you must remove all tramp*.elc files, and run 'make'
> afzerwards.
>
> >> Kind Regards,
> >> Iurie
>
> Best regards, Michael.
>





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22 16:52             ` Iurie Marian
@ 2024-06-22 17:05               ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-22 17:27                 ` Iurie Marian
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22 17:05 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709

Iurie Marian <marian.iurie@gmail.com> writes:

Hi Iurie,

> Unfortunately, the patch doesn't help.
> By the way, this is what I noticed:
> * the issue seems to occur more often in a docker container
> * over /ssh it is working well, or at least it never occurred
> * the temporary buffers like ~/tmp/tramp.J0RZDc~ are actually created on remote
> * after repetitive tests I noticed that it doesn't reproduce anymore
> and I added a line to print the default-directory right before
> `make-process` for stderr: ~lisp/net/tramp-sh.el:3057~
>   - when it fails, the default-directory is on local host
>   - when it succeeds - it's on remote (where I guess it finds that
> temporary file)

But this was exactly the change I have sent to you: preserve proper default-directory.

> * on emacs restart it starts reproducing again
> * once it starts working, it never reproduces again until emacs restart
>
> It looks like it has something to do with `stderr` process execution
> environment.

Yes. Did you apply the change as I have said? That means

- Patch tramp.el inside the emacs tree
- Remove all compiled Tramp files, like 'rm lisp/net/tramp*.elc'
- Recompile EWmacs by calling 'make'.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22 17:05               ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-22 17:27                 ` Iurie Marian
  2024-06-22 17:54                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 13+ messages in thread
From: Iurie Marian @ 2024-06-22 17:27 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 71709

Alright, yes last time I've only applied the patch in *.el file and
evaluated the buffer :D

I've recompiled from scratch and it works as expected! :)

Many thanks!
Iurie

On Sat, 22 Jun 2024 at 19:05, Michael Albinus <michael.albinus@gmx.de> wrote:
>
> Iurie Marian <marian.iurie@gmail.com> writes:
>
> Hi Iurie,
>
> > Unfortunately, the patch doesn't help.
> > By the way, this is what I noticed:
> > * the issue seems to occur more often in a docker container
> > * over /ssh it is working well, or at least it never occurred
> > * the temporary buffers like ~/tmp/tramp.J0RZDc~ are actually created on remote
> > * after repetitive tests I noticed that it doesn't reproduce anymore
> > and I added a line to print the default-directory right before
> > `make-process` for stderr: ~lisp/net/tramp-sh.el:3057~
> >   - when it fails, the default-directory is on local host
> >   - when it succeeds - it's on remote (where I guess it finds that
> > temporary file)
>
> But this was exactly the change I have sent to you: preserve proper default-directory.
>
> > * on emacs restart it starts reproducing again
> > * once it starts working, it never reproduces again until emacs restart
> >
> > It looks like it has something to do with `stderr` process execution
> > environment.
>
> Yes. Did you apply the change as I have said? That means
>
> - Patch tramp.el inside the emacs tree
> - Remove all compiled Tramp files, like 'rm lisp/net/tramp*.elc'
> - Recompile EWmacs by calling 'make'.
>
> Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#71709: Fix recent change in tramp-sh-handle-make-process
  2024-06-22 17:27                 ` Iurie Marian
@ 2024-06-22 17:54                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-22 17:54 UTC (permalink / raw)
  To: Iurie Marian; +Cc: 71709-done

Version: 30.1

Iurie Marian <marian.iurie@gmail.com> writes:

Hi Iurie,

> Alright, yes last time I've only applied the patch in *.el file and
> evaluated the buffer :D
>
> I've recompiled from scratch and it works as expected! :)

Thanks for the feedback, so we've got it. Thanks also for your
testing. I've pushed the patch to the repositories, closing the bug.

> Many thanks!
> Iurie

Best regards, Michael.





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-06-22 17:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21 18:12 bug#71709: Fix recent change in tramp-sh-handle-make-process Iurie Marian
2024-06-21 19:21 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-21 21:09   ` Iurie Marian
2024-06-22  7:31     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22  9:10       ` Iurie Marian
2024-06-22  9:18         ` Iurie Marian
2024-06-22  9:23           ` Iurie Marian
2024-06-22 11:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22 12:02           ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22 16:52             ` Iurie Marian
2024-06-22 17:05               ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-22 17:27                 ` Iurie Marian
2024-06-22 17:54                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).