unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Error with tramp-archive-autoload-file-name-handler
Date: Thu, 07 Apr 2022 19:54:17 +0200	[thread overview]
Message-ID: <87fsmog4om.fsf@sperrhaken.name> (raw)
In-Reply-To: <87o81d8akz.fsf@gmx.de> (Michael Albinus's message of "Thu, 07 Apr 2022 12:14:04 +0200")

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

Hi Michael,

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

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

>> I've shortly tested the recipe given in that bug, and everything seems
>> to be OK with your patch. I will apply your patch in your name to the
>> emacs-28 branch, after I have merged it with other pending Tramp
>> patches.
>
> Done.

>> Perhaps you could provide a ChangeLog-style commit message?

Thanks for taking care of fixing the style of my commit message. :)


Hm, I had wanted to add that now ‘tramp-autoload-file-name-handler’ and
‘tramp-archive-autoload-file-name-handler’ look nearly the same, and
that a nicer solution would be to revert the changes of 4db69b32b8 (“Fix
bug#48476”) to tramp-archive.el and make the archive autoload handler an
alias again to ‘tramp-autoload-file-name-handler’ as well as changing
the latter to use ‘tramp-archive-enabled’ directly instead of via
‘tramp-archive-autoload’.  Interestingly, this does not work (almost
sent it without testing): it causes a similar issue as bug #48476 with
an error message “Recursive load” (no hang due to an infinite loop
though).  Do you remember why using ‘defalias’ here causes an infinite
recursion?

The attached patch shows the erroneous changes described above.  Here
the steps from bug #48476 to reproduce the issue:

    mkdir foo.tar
    cd foo.tar
    emacs

I also forced ‘tramp-gvfs-enabled’ to t because its checks do not seem
to take the DBUS_SESSION_BUS_ADDRESS environment variable into account
(which was set by dbus-run-session).  Maybe this had a negative
influence.


[-- Attachment #2: Patch with changes that result in a recursive load --]
[-- Type: text/x-diff, Size: 2587 bytes --]

From d1182bca9737129c0b517b4370f0ddc52f11dcad Mon Sep 17 00:00:00 2001
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
Date: Thu, 7 Apr 2022 17:43:10 +0200
Subject: [PATCH] Make tramp-archive-autoload-file-name-handler an alias
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/net/tramp-archive.el (tramp-archive-autoload-file-name-handler):
Make ‘tramp-archive-autoload-file-name-handler’ an alias of
‘tramp-autoload-file-name-handler’.  This reverts the changes to this
file introduced by “Fix bug#48476” on 22. May 2021.
* lisp/net/tramp.el (tramp-autoload-file-name-handler):
Use ‘tramp-archive-enabled’ instead of ‘tramp-archive-autoload’.
---
 lisp/net/tramp-archive.el | 12 ++----------
 lisp/net/tramp.el         |  2 +-
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index 4b649edaab..cc7d6b3694 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -353,16 +353,8 @@ arguments to pass to the OPERATION."
 	      (tramp-archive-run-real-handler operation args)))))))
 
 ;;;###autoload
-(progn (defun tramp-archive-autoload-file-name-handler (operation &rest args)
-  "Load Tramp archive file name handler, and perform OPERATION."
-  (defvar tramp-archive-autoload)
-  (let (;; We cannot use `tramp-compat-temporary-file-directory' here
-	;; due to autoload.  When installing Tramp's GNU ELPA package,
-	;; there might be an older, incompatible version active.  We
-	;; try to overload this.
-        (default-directory temporary-file-directory)
-        (tramp-archive-autoload tramp-archive-enabled))
-    (apply #'tramp-autoload-file-name-handler operation args))))
+(defalias 'tramp-archive-autoload-file-name-handler
+  #'tramp-autoload-file-name-handler)
 
 (put #'tramp-archive-autoload-file-name-handler 'tramp-autoload t)
 
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a24d83f876..72ce862dc4 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -2678,7 +2678,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
     ;; might be an older, incompatible version active.  We try to
     ;; overload this.
     (let ((default-directory temporary-file-directory))
-      (when (bound-and-true-p tramp-archive-autoload)
+      (when (bound-and-true-p tramp-archive-enabled)
 	(load "tramp-archive" 'noerror 'nomessage))
       (load "tramp" 'noerror 'nomessage)))
   (apply operation args)))
-- 
2.35.1


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



> Felix Dietrich <felix.dietrich@sperrhaken.name> writes:

>> Now, why is it a problem to add
>> ‘tramp-archive-autoload-file-name-handler’ to ‘file-name-handler-alist’
>> if ‘tramp-archive-file-name-handler’ is already there?  Why does the
>> following snipped still fail even though
>> ‘tramp-archive-file-name-handler’ comes first in the handler alist?

> With my previous patch, this shouldn't happen
> anymore. Both tramp-archive-autoload-file-name-handler and
> tramp-archive-file-name-handler shouldn't coexist in
> file-name-handler-alist. Do you still see this after your patch has been
> applied?

I havenʼt looked particular hard, but no, I do not see both the autoload
and the normal handler in the ‘file-name-handler-alist’ at the same time
after a normal start and load of tramp – well, if I donʼt put them there
myself, that is.  My intention with this part was to show the issue I
described was connected to and indeed the cause for the problem Michael
Heerdegen had encountered, and also just to provide further details (I
was really confused about the example in that part for quite a while).

-- 
Felix Dietrich

  reply	other threads:[~2022-04-07 17:54 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
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 [this message]
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=87fsmog4om.fsf@sperrhaken.name \
    --to=felix.dietrich@sperrhaken.name \
    --cc=help-gnu-emacs@gnu.org \
    --cc=michael.albinus@gmx.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).