GNU bug report logs - #76165
[PATCH] ansi-osc-directory-tracker respects Tramp remote files

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Sun, 9 Feb 2025 19:06:01 UTC

Severity: normal

Tags: patch

Fixed in version 31.1

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

From: Ship Mints <shipmints <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 76165 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: bug#76165: [PATCH] ansi-osc-directory-tracker respects Tramp remote files
Date: Mon, 10 Feb 2025 10:29:32 -0500
[Message part 1 (text/plain, inline)]
I also alias host names in ssh config, yep. It's very common for the ssh
"spec" and the reported host name to be different. The ansi sequences must
be respected in these cases.

On Mon, Feb 10, 2025 at 10:19 AM Visuwesh <visuweshm <at> gmail.com> wrote:

> [திங்கள் பிப்ரவரி 10, 2025] Michael Albinus wrote:
>
> > Visuwesh <visuweshm <at> gmail.com> writes:
> >
> > Hi,
> >
> >> That reminds me why my :override advice was simpler.  Indeed, I had to
> >> get rid of that test to ensure that the function would work as intended
> >> for remote shell buffers.  It never made much sense IMO and I got the
> >> impression that it is in place as a "let's be absolutely sure" measure.
> >> I can say that I face no issues with the test omitted thus far. It could
> >> be a product of me being in control of $PS1 for local and remote shells
> >> though.
> >
> > Well. The host part of the URL could be anything, and must not be the
> > same like the current host name. So perhaps the check could be like
> > this, "to be absolutely sure":
> >
> >   (when-let* ((url (url-generic-parse-url text))
> >               ((string= (url-type url) "file"))
> >               ((or (null (url-host url))
> >                    ;; Use `downcase' to match `url-generic-parse-url'
> behavior
> >                    (string= (url-host url)
> >                             (downcase
> >                              (or (file-remote-p default-directory 'host)
> >                                  (system-name)))))))
> >     (ignore-errors
> >       (cd-absolute
> >        (concat (file-remote-p default-directory)
> >                (url-unhex-string (url-filename url)))))))
> >
> > WDYT?
>
> This unfortunately breaks down in my use case.  In my .ssh/config I have
> for a host:
>
>     Host remote-n2
>         User user
>         Hostname node2
>         ProxyJump remote
>
> and when I create a remote shell buffer with
>
>     (shell "*remote*" "/ssh:user <at> remote-n2:~")
>
> and say
>
>     remote-n2% cd ~/.ssh
>     remote-n2% pwd
>     /home/user/.ssh
>
> evaluating
>
>     default-directory ;; => "/ssh:user <at> remote-n2:/home/user/"
>
> shows instead.  This is all because $HOSTNAME is not actually remote-n2
> but "node2":
>
>     remote-n2% echo $HOSTNAME
>     node2
>     remote-n2% echo $PS1
>     \[\e]7;file://\H$PWD\e\\\]remote-n2%
>
> Although I am not sure how common this type of scenario is where the
> hostname as Tramp knows it and $HOSTNAME is mismatched.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 102 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.