GNU bug report logs - #32218
26.1; default-directory in TRAMP root has two slashes when using find-file-visit-truename

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32218 in the body.
You can then email your comments to 32218 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#32218; Package emacs. (Fri, 20 Jul 2018 01:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allen Li <darkfeline <at> felesatra.moe>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 20 Jul 2018 01:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <darkfeline <at> felesatra.moe>
To: bug-gnu-emacs <at> gnu.org
Subject: 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
[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)]

Added tag(s) fixed. Request was from Michael Albinus <michael.albinus <at> gmx.de> to control <at> debbugs.gnu.org. (Fri, 20 Jul 2018 09:08:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32218; Package emacs. (Fri, 20 Jul 2018 09:15:01 GMT) Full text and rfc822 format available.

Message #10 received at 32218 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Allen Li <darkfeline <at> felesatra.moe>
Cc: 32218 <at> debbugs.gnu.org
Subject: Re: bug#32218: 26.1;
 default-directory in TRAMP root has two slashes when using
 find-file-visit-truename
Date: Fri, 20 Jul 2018 11:14:15 +0200
Allen Li <darkfeline <at> felesatra.moe> writes:

Hi Allen,

> 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:://

Thanks for reporting this.

> I have attached a patch implementing this, made against emacs-26 since
> this is a straightforward bug fix.

Thanks for this. However, also `tramp-handle-file-truename' and
`tramp-adb-handle-file-truename' suffer from this bug. It was fixed
already in the master branch some months ago.

I have cherry-picked that fix back to the emacs-26 branch, could you pls
recheck that it works for you?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#32218; Package emacs. (Sat, 21 Jul 2018 02:43:01 GMT) Full text and rfc822 format available.

Message #13 received at 32218 <at> debbugs.gnu.org (full text, mbox):

From: Allen Li <darkfeline <at> felesatra.moe>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 32218 <at> debbugs.gnu.org
Subject: Re: bug#32218: 26.1; default-directory in TRAMP root has two slashes
 when using find-file-visit-truename
Date: Fri, 20 Jul 2018 19:42:20 -0700
Yes, it's fixed, thanks
On Fri, Jul 20, 2018 at 2:14 AM Michael Albinus <michael.albinus <at> gmx.de> wrote:
>
> Allen Li <darkfeline <at> felesatra.moe> writes:
>
> Hi Allen,
>
> > 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:://
>
> Thanks for reporting this.
>
> > I have attached a patch implementing this, made against emacs-26 since
> > this is a straightforward bug fix.
>
> Thanks for this. However, also `tramp-handle-file-truename' and
> `tramp-adb-handle-file-truename' suffer from this bug. It was fixed
> already in the master branch some months ago.
>
> I have cherry-picked that fix back to the emacs-26 branch, could you pls
> recheck that it works for you?
>
> Best regards, Michael.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Sat, 21 Jul 2018 06:58:01 GMT) Full text and rfc822 format available.

Notification sent to Allen Li <darkfeline <at> felesatra.moe>:
bug acknowledged by developer. (Sat, 21 Jul 2018 06:58:01 GMT) Full text and rfc822 format available.

Message #18 received at 32218-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Allen Li <darkfeline <at> felesatra.moe>
Cc: 32218-done <at> debbugs.gnu.org
Subject: Re: bug#32218: 26.1;
 default-directory in TRAMP root has two slashes when using
 find-file-visit-truename
Date: Sat, 21 Jul 2018 08:57:36 +0200
Version: 26.2

Allen Li <darkfeline <at> felesatra.moe> writes:

Hi Allen,

> Yes, it's fixed, thanks

Thanks for the feedback, I'm 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, 18 Aug 2018 11:24:05 GMT) Full text and rfc822 format available.

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.