From: Michael Albinus <michael.albinus@gmx.de>
To: Felix Dietrich <felix.dietrich@sperrhaken.name>
Cc: Michael Heerdegen <michael_heerdegen@web.de>, help-gnu-emacs@gnu.org
Subject: Re: Error with tramp-archive-autoload-file-name-handler
Date: Mon, 28 Mar 2022 12:25:11 +0200 [thread overview]
Message-ID: <87h77ifk6w.fsf@gmx.de> (raw)
In-Reply-To: <87o81qwqwi.fsf@sperrhaken.name> (Felix Dietrich's message of "Mon, 28 Mar 2022 08:08:13 +0200")
[-- Attachment #1: Type: text/plain, Size: 1969 bytes --]
Felix Dietrich <felix.dietrich@sperrhaken.name> writes:
Hi,
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> Michael Albinus <michael.albinus@gmx.de> writes:
>>
>>> I cannot reproduce. The following works fine:
>>>
>>> […]
>>
>> You missed the TWICE part in my last message. Just eval the above
>> twice:
>>
>> $ emacs -Q -l tramp --eval "(add-to-list 'file-name-handler-alist
>> (cons (tramp-archive-autoload-file-name-regexp)
>> #'tramp-archive-autoload-file-name-handler))" --eval
>> '(file-directory-p "/home/albinus/tmp/out.tar.xz/")'\
>> --eval "(add-to-list 'file-name-handler-alist
>> (cons (tramp-archive-autoload-file-name-regexp)
>> #'tramp-archive-autoload-file-name-handler))" --eval
>> '(file-directory-p "/home/albinus/tmp/out.tar.xz/")'
>>
>> Sorry, but that's the best recipe I can offer. And I guess something
>> like this is actually happening. AFAIU, Tramp can call
>> `tramp-register-archive-file-name-handler' several times - see
>> tramp-archive.el line 394:
>
> With Emacs 27.1, I ran the test in the attached script a couple of times
> and could *not* reproduce your error.
Same here, I cannot reproduce it with Emacs 27, Emacs 28, Emacs 29. Btw,
I believe a more realistic check would be
--8<---------------cut here---------------start------------->8---
$ emacs -Q -f tramp-register-archive-file-name-handler --eval '(file-directory-p "/home/albinus/tmp/out.tar.xz/")'\
-f tramp-register-archive-file-name-handler --eval '(file-directory-p "/home/albinus/tmp/out.tar.xz/")'
--8<---------------cut here---------------end--------------->8---
It is tramp-register-archive-file-name-handler which might be invoked
several times, and which causes the problem. Could *you* (Michael)
reproduce the problem with this recipe?
Anyway, I've pushed the appended patch to the repositories. It should fix
this problem, hopefully.
Best regards, Michael.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1724 bytes --]
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 788e457367..890c8dbb75 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -374,7 +374,9 @@ tramp-archive-file-name-handler
;;;###autoload
(progn (defun tramp-register-archive-file-name-handler ()
"Add archive file name handler to `file-name-handler-alist'."
- (when tramp-archive-enabled
+ (when (and tramp-archive-enabled
+ (not
+ (rassq #'tramp-archive-file-name-handler file-name-handler-alist)))
(add-to-list 'file-name-handler-alist
(cons (tramp-archive-autoload-file-name-regexp)
#'tramp-archive-autoload-file-name-handler))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 0192a63a10..580cfea1f8 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2756,10 +2756,11 @@ tramp-completion-file-name-handler
;;;###autoload
(progn (defun tramp-register-autoload-file-name-handlers ()
"Add Tramp file name handlers to `file-name-handler-alist' during autoload."
- (add-to-list 'file-name-handler-alist
- (cons tramp-autoload-file-name-regexp
- #'tramp-autoload-file-name-handler))
- (put #'tramp-autoload-file-name-handler 'safe-magic t)))
+ (unless (rassq #'tramp-file-name-handler file-name-handler-alist)
+ (add-to-list 'file-name-handler-alist
+ (cons tramp-autoload-file-name-regexp
+ #'tramp-autoload-file-name-handler))
+ (put #'tramp-autoload-file-name-handler 'safe-magic t))))
(put #'tramp-register-autoload-file-name-handlers 'tramp-autoload t)
;;;###autoload (tramp-register-autoload-file-name-handlers)
next prev parent reply other threads:[~2022-03-28 10:25 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-25 23:44 Error with tramp-archive-autoload-file-name-handler Michael Heerdegen
2022-03-26 8:39 ` Michael Albinus
2022-03-26 19:01 ` Michael Heerdegen
2022-03-27 0:06 ` Michael Heerdegen
2022-03-27 8:33 ` Michael Albinus
2022-03-28 2:20 ` Michael Heerdegen
2022-03-28 6:08 ` Felix Dietrich
2022-03-28 10:25 ` Michael Albinus [this message]
2022-03-29 0:17 ` Michael Heerdegen
2022-03-29 7:30 ` Michael Albinus
2022-04-01 1:53 ` Michael Heerdegen
2022-04-02 12:00 ` Felix Dietrich
2022-04-02 17:00 ` Michael Albinus
2022-04-06 8:49 ` Felix Dietrich
2022-04-06 18:13 ` Michael Albinus
2022-04-07 10:14 ` Michael Albinus
2022-04-07 17:54 ` Felix Dietrich
2022-04-08 9:41 ` Michael Albinus
2022-04-13 2:03 ` Michael Heerdegen
2022-04-03 1:26 ` Michael Heerdegen
2022-04-03 15:57 ` Michael Albinus
2022-04-04 0:58 ` Michael Heerdegen
2022-04-04 7:40 ` Michael Albinus
2022-03-29 0:09 ` Michael Heerdegen
2022-03-27 8:16 ` Michael Albinus
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=87h77ifk6w.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=felix.dietrich@sperrhaken.name \
--cc=help-gnu-emacs@gnu.org \
--cc=michael_heerdegen@web.de \
/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.
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).