GNU bug report logs -
#54542
29.0.50; dired can't visit a local directory if another buffer visits an unreachable remote (TRAMP) directory
Previous Next
Reported by: Dima Kogan <dima <at> secretsauce.net>
Date: Thu, 24 Mar 2022 07:16:02 UTC
Severity: normal
Found in version 29.0.50
Fixed in version 29.1
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 54542 in the body.
You can then email your comments to 54542 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54542
; Package
emacs
.
(Thu, 24 Mar 2022 07:16:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Dima Kogan <dima <at> secretsauce.net>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 24 Mar 2022 07:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi. This sounds convoluted, but it's a real-life bug I hit repeatedly.
Recipe:
1. emacs -Q
2. C-x C-f /ssh:host:directory
Visit some remote directory via TRAMP. This opens a dired buffer
3. Unplug the network cable. Or walk away from wifi. Or turn off the
remote host. Optionally, do other stuff with emacs. The bug is hit if
the buffer in step 2 is open somewhere; doesn't have to be visible
4. C-x C-f /some/local/directory
One would expect step 4 to work just fine because it's a local
directory, so no TRAMP business should affect it, but it does. Step 4
will try to connect to the host in step 2. But that host is gone, so
it'll fail, and step 4 will fail too.
The problem is here:
(defun dired-find-buffer-nocreate (dirname &optional mode)
....
(let (found (blist dired-buffers))
...
(while blist
...
(with-current-buffer (cdr (car blist))
....
(expand-file-name
(if (consp dired-directory)
(car dired-directory)
dired-directory))))
Here dired is trying to figure out if we're already visiting the
requested directory. In doing so, it loops through all extant dired
buffers, and runs (expand-file-name) on each one. Running
(expand-file-name) on a remote directory will try to contact the host.
I'm not attaching a patch because I'm not 100% sure what's appropriate.
I guess we want to replace
(expand-file-name dired-directory)
with something like this pseudo-code
(concat (tramp-host dired-directory)
(expand-file-name (tramp-filename dired-directory)))
Except, thinking about edge cases: making sure this works with/without
TRAMP, making sure relative directories work right, etc, etc.
Do we already have a function that does this?
Thanks!
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54542
; Package
emacs
.
(Fri, 25 Mar 2022 16:24:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 54542 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Dima Kogan <dima <at> secretsauce.net> writes:
Hi Dima,
> 1. emacs -Q
>
> 2. C-x C-f /ssh:host:directory
>
> Visit some remote directory via TRAMP. This opens a dired buffer
>
> 3. Unplug the network cable. Or walk away from wifi. Or turn off the
> remote host. Optionally, do other stuff with emacs. The bug is hit if
> the buffer in step 2 is open somewhere; doesn't have to be visible
>
> 4. C-x C-f /some/local/directory
>
> One would expect step 4 to work just fine because it's a local
> directory, so no TRAMP business should affect it, but it does. Step 4
> will try to connect to the host in step 2. But that host is gone, so
> it'll fail, and step 4 will fail too.
>
> The problem is here:
>
> (defun dired-find-buffer-nocreate (dirname &optional mode)
> ....
> (let (found (blist dired-buffers))
> ...
> (while blist
> ...
> (with-current-buffer (cdr (car blist))
> ....
> (expand-file-name
> (if (consp dired-directory)
> (car dired-directory)
> dired-directory))))
>
> Here dired is trying to figure out if we're already visiting the
> requested directory. In doing so, it loops through all extant dired
> buffers, and runs (expand-file-name) on each one. Running
> (expand-file-name) on a remote directory will try to contact the host.
>
> I'm not attaching a patch because I'm not 100% sure what's appropriate.
> I guess we want to replace
>
> (expand-file-name dired-directory)
>
> with something like this pseudo-code
>
> (concat (tramp-host dired-directory)
> (expand-file-name (tramp-filename dired-directory)))
>
> Except, thinking about edge cases: making sure this works with/without
> TRAMP, making sure relative directories work right, etc, etc.
>
> Do we already have a function that does this?
We have already variable non-essential, which shall help for
non-existing / broken connections. While I could reproduce your initial
recipe locally, the attached patch cures it for me. Could you, please,
test?
> Thanks!
Best regards, Michael.
[Message part 2 (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#54542
; Package
emacs
.
(Fri, 25 Mar 2022 23:17:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 54542 <at> debbugs.gnu.org (full text, mbox):
Michael Albinus <michael.albinus <at> gmx.de> writes:
> We have already variable non-essential, which shall help for
> non-existing / broken connections. While I could reproduce your
> initial recipe locally, the attached patch cures it for me. Could you,
> please, test?
Hi Michael. Your patch fixes the issue. Thanks for looking into this!
Reply sent
to
Michael Albinus <michael.albinus <at> gmx.de>
:
You have taken responsibility.
(Sat, 26 Mar 2022 10:59:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dima Kogan <dima <at> secretsauce.net>
:
bug acknowledged by developer.
(Sat, 26 Mar 2022 10:59:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 54542-done <at> debbugs.gnu.org (full text, mbox):
Version: 29.1
Dima Kogan <dima <at> secretsauce.net> writes:
Hi Dima,
>> We have already variable non-essential, which shall help for
>> non-existing / broken connections. While I could reproduce your
>> initial recipe locally, the attached patch cures it for me. Could you,
>> please, test?
>
> Hi Michael. Your patch fixes the issue. Thanks for looking into this!
Thanks for the feedback. I've committed this to Emacs master, closing
the bug.
Best regards, Michael.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 23 Apr 2022 11:24:05 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.