GNU bug report logs -
#32218
26.1; default-directory in TRAMP root has two slashes when using find-file-visit-truename
Previous Next
Reported by: Allen Li <darkfeline <at> felesatra.moe>
Date: Fri, 20 Jul 2018 01:45:02 UTC
Severity: normal
Tags: fixed
Found in version 26.1
Fixed in version 26.2
Done: Michael Albinus <michael.albinus <at> gmx.de>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
1. emacs -q
2. M-: (setq find-file-visit-truename t) RET
3. C-x C-f /sudo::/ RET
4. M-: default-directory RET
Expected value: /sudo::/
Actual: /sudo:://
The actual usability problem that this causes is that running find-file
again in the Dired buffer starts with a bad default:
Typing C-x C-f tmp RET results in finding /sudo:://tmp which is /tmp
rather than /sudo::/tmp
The immediate offending code is these lines in find-file-noselect
(if find-file-visit-truename
(abbreviate-file-name (file-truename filename))
filename)))
Tracing the bug:
(file-truename "/sudo::/")
(tramp-file-name-handler 'file-truename "/sudo::/")
(tramp-sh-file-name-handler 'file-truename "/sudo::/")
(tramp-sh-handle-file-truename "/sudo::/")
tramp-sh-handle-file-truename is (format "%s%s" A B), where A does most
of the work and B just adds an extra final slash conditionally:
(if (string-equal (file-name-nondirectory filename) "") "/" "")))
I think this could be fixed by making it:
(let ((result A))
(format "%s%s" result
(if (and (string-equal (file-name-nondirectory filename) "")
(not (string-equal (file-name-nondirectory
result) ""))) "/" "")))
I have attached a patch implementing this, made against emacs-26 since
this is a straightforward bug fix.
In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.24), modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux rodete (upgraded from: Ubuntu 14.04 LTS)
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS JSON LCMS2
Important settings:
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
Major mode: Dired by name
[0001-Avoid-extra-slash-on-TRAMP-root-path-truenames.patch (text/x-patch, attachment)]
This bug report was last modified 6 years and 305 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.