[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32218: 26.1; default-directory in TRAMP root has two slashes when us
From: |
Allen Li |
Subject: |
bug#32218: 26.1; default-directory in TRAMP root has two slashes when using find-file-visit-truename |
Date: |
Thu, 19 Jul 2018 18:44:28 -0700 |
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
Description: Text Data
- bug#32218: 26.1; default-directory in TRAMP root has two slashes when using find-file-visit-truename,
Allen Li <=