From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: Error with tramp-archive-autoload-file-name-handler Date: Mon, 28 Mar 2022 12:25:11 +0200 Message-ID: <87h77ifk6w.fsf@gmx.de> References: <87bkxtzjf1.fsf@web.de> <871qyphzv1.fsf@gmx.de> <87r16o4jxo.fsf@web.de> <871qyouuls.fsf@web.de> <87y20vg5gu.fsf@gmx.de> <87fsn2q0mk.fsf@web.de> <87o81qwqwi.fsf@sperrhaken.name> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20460"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Michael Heerdegen , help-gnu-emacs@gnu.org To: Felix Dietrich Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 28 12:27:58 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nYmbO-00053r-0i for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Mar 2022 12:27:58 +0200 Original-Received: from localhost ([::1]:48736 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nYmbM-0003P6-6g for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 28 Mar 2022 06:27:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYmZ8-00030a-Dj for help-gnu-emacs@gnu.org; Mon, 28 Mar 2022 06:25:38 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:45611) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nYmYx-0001Q7-2S for help-gnu-emacs@gnu.org; Mon, 28 Mar 2022 06:25:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1648463112; bh=wowq4mVBUzY4pFbbMFuIAKKZY0sk/FNs0w7sh9z5rKA=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=HeRALTkbV4M0cMeTE+iDFSVNcgSKT393aYwg2kjSionlPTy9Mlg029VIVeYrhG0M3 Dgaqg2uy7hPaWq9LC6ewp/ta5i6JN02v1J7ZGVXcBGzCUkpkK9lG48cXg7nFJgqfnG ThBSP9sVyFJQN8ZzabKiyj3yG6GC0D9SGW+AFIYI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from gandalf.gmx.de ([213.220.156.255]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M6Udt-1nf79V1AfB-006sit; Mon, 28 Mar 2022 12:25:12 +0200 In-Reply-To: <87o81qwqwi.fsf@sperrhaken.name> (Felix Dietrich's message of "Mon, 28 Mar 2022 08:08:13 +0200") X-Provags-ID: V03:K1:ZRXeCFWuwDBXTGLnCFcK70dX9KGLFl4CDWVD2F7dxoQWcTKpxwG 2yadd9tbJcT3dsXh3/E+8P+z1zjt4+xDPFR3Vln3OnIUf07coyauuBbeOhcuigy6jmbdHhX p+vksOIripeBHcLXpg7n05cMo8trVpt/2zSQso2sInf+UdQ3sP9Rq0wFsckGsb03OrhA9Tr 9HJfuoO5XYPoa+2qUCxWg== X-UI-Out-Filterresults: notjunk:1;V03:K0:h8GklLX9MdY=:ISHvI+r4y/EhqRYKsWymIf N8s3Kyz8IkS8BSC8qUPylao5hwvAV1Ih84Y9aFPHPD1BpYJaasCu+0FH7gZ2W0ze3ej27HGXJ AU/TyK9FtB1RABI0VcDE66BpfflAt/oipjQ3kVYT7PzugvoCJ3khQoA2xKrGlMkv9JOtXXrS7 UU5WBE2bzSpaZt3Ie05wQuSqWAecI4ib/8UhxKazLrg2D0XRmCnVuN6tSZ3ZLNvw7g3RoSVLO zw+SIwEEbJ/03dj44EIU60fD5Bm3DSboHmFsTJWx27z5IjicULoy+juSs6e7kHkTA+HzhP1T4 svbS8hSSCSqUU8wGUqeuHViarlYHeR1m2IArMPSJlfOFKGo/ndg/mYKFQltLWyc3jJA9m4EmD HZn/PsTToWGbu5tRFKFujOsUsSDqo+/Wj8y3A7GKqA+ltU1lBsu+01PKXCx2jUkqZ5KKRFpdc LOXhE6jWHHQnORzHHRYb7mQvUJVKAI4HQy7f2SezCQx24Z1tocXC3xnYVEwJnqHXXE0d9tfn5 2fkAsSCbhsCiHFSVtFBdQuD8wiG6S4DTP5+7FApwlUu2DbV9o9yMX4wOBX2/HTnjXNyYWgV3J 7rBt4158Y9IgS6SVMWwtygFpfBSg7wUY2M+J1d/iGcERQnmh+9PdPp0b0V18x6T0x7VGlWSTH y+4053RCp4WWtnf5CT2ZlqqqEowVbsiMcEiErUsBhcnxOCCO2N5prxTtAWBYDtqPbtGoOR1z0 ssvfaHR609L36QWCUyFhsF5Sj79BNokcw2FihtCYiFs007xNwoi/VErpQciXkJBnwO0Trmjn Received-SPF: pass client-ip=212.227.17.21; envelope-from=michael.albinus@gmx.de; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136799 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Felix Dietrich writes: Hi, > Michael Heerdegen writes: > >> Michael Albinus writes: >> >>> I cannot reproduce. The following works fine: >>> >>> [=E2=80=A6] >> >> 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-direct= ory-p "/home/albinus/tmp/out.tar.xz/")'\ -f tramp-register-archive-file-name-handler --eval '(file-direct= ory-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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 788e457367..890c8dbb75 100644 =2D-- 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 =2D-- 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 autol= oad." - (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) --=-=-=--