From: Felix Dietrich <felix.dietrich@sperrhaken.name>
To: help-gnu-emacs@gnu.org
Subject: Re: Error with tramp-archive-autoload-file-name-handler
Date: Mon, 28 Mar 2022 08:08:13 +0200 [thread overview]
Message-ID: <87o81qwqwi.fsf@sperrhaken.name> (raw)
In-Reply-To: <87fsn2q0mk.fsf@web.de> (Michael Heerdegen's message of "Mon, 28 Mar 2022 04:20:03 +0200")
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
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.
[-- Attachment #2: Script to test the issue with tramp --]
[-- Type: text/x-sh, Size: 2600 bytes --]
#!/bin/sh
# Usage: testscript ARCHIVE_PATH [COUNT]
#
# Start Emacs and test ‘file-directory-p’ on ARCHIVE_PATH.
#
# Each time before using ‘file-directory-p’, add
#
# (cons (tramp-archive-autoload-file-name-handler)
# #'tramp-archive-autoload-file-name-handler)
#
# to ‘file-name-handler-alist’. ‘file-directory-p’ is called twice.
#
# Do this for COUNT times or just once if COUNT is not provided
#
# ARCHIVE_PATH defaults to
# ~/"src/emacs/test/lisp/net/tramp-archive-resources/foo.iso/".
# Emacs -nw switch: do not create a GUI frame.
nw=-nw
archive_path=${1:-~/"src/emacs/test/lisp/net/tramp-archive-resources/foo.iso/"}
if ! [ -e "$archive_path" ]
then
printf '"%s" does not exist' "$archive_path" >&2
exit 66 # EX_NOINPUT
fi
count=${2:-1}
run_emacs ()
{
emacs $nw -Q -l tramp \
--eval \
'(setq command-error-function
;; Catch an error in a process filter.
(lambda () (kill-emacs 1)))' \
--eval \
"(add-to-list 'file-name-handler-alist
(cons (tramp-archive-autoload-file-name-regexp)
#'tramp-archive-autoload-file-name-handler))" \
--eval \
'(let ((ret 2))
(unwind-protect
(setq ret (if (file-directory-p "'"$archive_path"'")
;; either result counts as success
0 0))
(kill-emacs ret)))' \
--eval \
"(add-to-list 'file-name-handler-alist
(cons (tramp-archive-autoload-file-name-regexp)
#'tramp-archive-autoload-file-name-handler))" \
--eval \
'(let ((ret 3))
(unwind-protect
(setq ret (if (file-directory-p "'"$archive_path"'")
;; either result counts as success
0 0))
(kill-emacs ret)))'
}
i=0
while [ "$i" -lt "$count" ]
do
i=$(( i + 1 ))
run_emacs
ret=$?
case $ret in
0) # All good, just
continue
;;
1) echo "‘command-error-function’ killed emacs" >&2
exit $ret
;;
2) echo "1. ‘unwind-protect’ killed emacs" >&2
exit $ret
;;
3) echo "2. ‘unwind-protect’ killed emacs" >&2
exit $ret
;;
*) echo "Unexpected return code: $ret" >&2
exit $ret
;;
esac
done
[-- Attachment #3: Type: text/plain, Size: 21 bytes --]
--
Felix Dietrich
next prev parent reply other threads:[~2022-03-28 6:08 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 [this message]
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
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=87o81qwqwi.fsf@sperrhaken.name \
--to=felix.dietrich@sperrhaken.name \
--cc=help-gnu-emacs@gnu.org \
/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).