unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Thierry Volpiatto <thievol@posteo.net>,
	larsi@gnus.org, 55832@debbugs.gnu.org
Subject: bug#55832: 28.1; Emacs crashes when using tramp from helm in emacs-29
Date: Fri, 10 Jun 2022 09:53:44 +0200	[thread overview]
Message-ID: <87pmjhgdiv.fsf@gmx.de> (raw)
In-Reply-To: <83pmjh1xbg.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Jun 2022 21:55:15 +0300")

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

Eli Zaretskii <eliz@gnu.org> writes:

Hi,

>> > So tramp-file-name-for-operation errors out, and that somehow gets us
>> > in trouble.
>> >
>> > I see we call signal-hook-function -- what is its value in that
>> > session, please?
>>
>> Seems tramp let-bound it to tramp-signal-hook-function in
>> tramp-file-name-handler.
>
> Michael, can you help us out here?  Could the above somehow cause
> infinite recursion, whereby signaling an error triggers another,
> nested error?

First, I've tried to reproduce it from emacs -Q. I've upgraded all
installed ELPA packages, and then I have called

--8<---------------cut here---------------start------------->8---
emacs -Q \
  -l ~/.emacs.d/elpa/helm-core-20220503.622/helm-core-autoloads.el \
  -l ~/.emacs.d/elpa/helm-20220504.827/helm-autoloads.el \
  -l ~/.emacs.d/elpa/helm-tramp-20190616.125/helm-tramp-autoloads.el \
  -l ~/.emacs.d/elpa/async-20220318.1342/async-autoloads.el \
  -l seq -f helm-find-files
--8<---------------cut here---------------end--------------->8---

Using /sudo:: as file name doesn't raise any error. However, this is
from the master branch; Emacs 28 doesn't play fine with the compiled
Helm libraries because of an error in calling string-match (using the
new optional arg INHIBIT-MODIFY). And I don't want to recompile all my
installed packages with Emacs 28. Hmm.

Looking at the error, it comes indeed from
tramp-file-name-for-operation. In the backtrace shown by Thierry it
looks like this function is called for tramp-get-remote-uid:

--8<---------------cut here---------------start------------->8---
(gdb) xsymbol
$5 = (struct Lisp_Symbol *) 0x555558080030
"tramp-file-name-for-operation"
(gdb) p args[1]
$6 = XIL(0x22fdb90)
(gdb) xtype
Lisp_Symbol
(gdb) xsymbol
$7 = (struct Lisp_Symbol *) 0x555557fd47d0
"tramp-get-remote-uid"
--8<---------------cut here---------------end--------------->8---

tramp-get-remote-uid *is* a valid argument, and
tramp-file-name-for-operation shouldn't raise an error. Once we have
fixed the problem of Emacs crash, it shall be investigated wy this error
has been raised.

It is not clear to me why tramp-file-name-for-operation goes into
recursion with the error handling, invoking again and again
tramp-signal-hook-function (that is the function bound to
signal-hook-function). However, a simple protection against this should
be this patch:


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

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3ee1169139..3905aeba70 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2476,6 +2476,7 @@ tramp-file-name-for-operation
 It does not always return a Tramp file name, for example if the
 first argument of `expand-file-name' is absolute and not remote.
 Must be handled by the callers."
+  (let (signal-hook-function)
   (cond
    ;; FILE resp DIRECTORY.
    ((member operation
@@ -2558,7 +2559,7 @@ tramp-file-name-for-operation
    ((member operation '(tramp-get-remote-gid tramp-get-remote-uid))
     (tramp-make-tramp-file-name (nth 0 args)))
    ;; Unknown file primitive.
-   (t (error "Unknown file I/O primitive: %s" operation))))
+   (t (error "Unknown file I/O primitive: %s" operation)))))

 (defun tramp-find-foreign-file-name-handler (filename &optional _operation)
   "Return foreign file name handler if exists."

[-- Attachment #3: Type: text/plain, Size: 120 bytes --]


Similar protections have been applied already elsewhere in Tramp. Does
this solve the problem?

Best regards, Michael.

  reply	other threads:[~2022-06-10  7:53 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-07 15:16 bug#55832: 28.1; Emacs crashes when using tramp from helm in emacs-29 Thierry Volpiatto
2022-06-07 16:08 ` Eli Zaretskii
2022-06-07 17:02   ` Thierry Volpiatto
2022-06-07 17:18     ` Eli Zaretskii
2022-06-07 18:33       ` Thierry Volpiatto
2022-06-07 18:53         ` Eli Zaretskii
2022-06-07 19:20   ` Thierry Volpiatto
2022-06-08 13:01     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-08 16:30     ` Eli Zaretskii
2022-06-08 18:17       ` Lars Ingebrigtsen
2022-06-08 18:25         ` Eli Zaretskii
2022-06-09 10:34           ` Lars Ingebrigtsen
2022-06-09 10:42           ` Thierry Volpiatto
2022-06-09 13:05             ` Eli Zaretskii
2022-06-09 15:18               ` Thierry Volpiatto
2022-06-09 15:29                 ` Lars Ingebrigtsen
2022-06-09 16:36                 ` Eli Zaretskii
2022-06-09 16:51                   ` Thierry Volpiatto
2022-06-09 17:48                     ` Eli Zaretskii
2022-06-09 18:28                       ` Thierry Volpiatto
2022-06-09 18:55                         ` Eli Zaretskii
2022-06-10  7:53                           ` Michael Albinus [this message]
2022-06-10 10:00                             ` Thierry Volpiatto
2022-06-10 12:20                               ` Michael Albinus
2022-06-11  6:14                                 ` Thierry Volpiatto
2022-06-11 19:27                                   ` Michael Albinus
2022-06-11 19:46                                     ` Thierry Volpiatto
2022-06-11 20:07                                       ` Michael Albinus
2022-06-11 20:12                                         ` Thierry Volpiatto
2022-06-12 18:16                                         ` Thierry Volpiatto
2022-06-14 11:39                                           ` Michael Albinus
2022-06-14 11:49                                             ` Thierry Volpiatto
2022-06-09 15:37               ` Thierry Volpiatto
2022-06-14 11:05 ` Michael Albinus
2022-06-14 11:36   ` Thierry Volpiatto
2022-06-14 11:44     ` Michael Albinus
2022-06-14 17:42 ` Michael Albinus
2022-06-16 17:27 ` Michael Albinus
2022-06-16 18:11   ` Thierry Volpiatto
2022-06-17 16:54     ` Michael Albinus
2022-06-17 17:10       ` Thierry Volpiatto
2022-06-19 14:25         ` Michael Albinus
2022-06-19 16:21           ` Thierry Volpiatto
2022-06-19 17:51             ` Michael Albinus
2022-06-21  8:24             ` Michael Albinus
2022-06-21  9:35               ` Thierry Volpiatto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pmjhgdiv.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=55832@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=thievol@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).