After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 709055 - Hostname part of cwd (OSC 7) is ignored
Hostname part of cwd (OSC 7) is ignored
Status: RESOLVED OBSOLETE
Product: gnome-terminal
Classification: Core
Component: general
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: GNOME Terminal Maintainers
GNOME Terminal Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-29 22:35 UTC by Egmont Koblinger
Modified: 2021-06-10 20:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Egmont Koblinger 2013-09-29 22:35:32 UTC
As per bug 675987 comment 9 (following the link there):
"You should also include the hostname so Terminal can determine whether it's a local directory; Terminal will avoid using it as the current working directory if it's from a different host."

vte.sh puts the hostname in the URI but g-t doesn't check it against the actual hostname. This means that you ssh to a remote host, change to /etc there and open a new tab, you'll find yourself in localhost's /etc. I think that in accordance with the quoted text above (I can't check Mac Terminal's actual behavior) it shouldn't be like this.
Comment 1 Egmont Koblinger 2013-09-29 22:50:06 UTC
You may say that vte.sh tests for VTE_VERSION which is not forwarded by ssh. The problem with this is that as far as I understand, the goal is to make this a standard feature across varios terminals and applications, rather than a hack for bash/zsh and vte only.

Mac Terminal allegedly supports this feature, and hopefully some others (e.g. konsole) will follow too.

It's reasonable for file managers and file viewers to set the directory or filename. It's not reasonable to duplicate checking for VTE_VERSION in all of them, especially since this feature shouldn't be VTE-specific.

(E.g. I've filed a ticket to midnight commander: https://www.midnight-commander.org/ticket/3088)

The proper solution I think is to check for the hostname (and be a little bit relaxed: accept either the short hostname or the fqdn or the empty string) and ignore the cwd if it doesn't match.

Anything that goes to vte.sh is a partial hack that only considers vte but no other terminal emulators, and only considers bash/zsh but no other applications. Hence it's a good start to make it work for the typical use case, but not the right place for such workarounds.
Comment 2 Egmont Koblinger 2013-10-01 18:00:41 UTC
If the check is done by g-t when opening a new tab, it has the drawback that sshing to a remote host (if that host also sets the working directory) overwrites the current directory with an "invalid" one, and hence opening the new tab would occur in your home dir.

Probably it's a better approach if vte refuses to set the working directory to anything that doesn't belong to the local host. This way when you ssh, your local directory is remembered and the new tab is opened there. I'd probably prefer this behavior. In this case the bugreport belongs to vte rather than g-t.

Since the feature is a copy of Mac Terminal's, I think the best bet is to follow their exact behavior. Unfortunately I don't have access to Mac so I cannot test it.
Comment 3 Egmont Koblinger 2016-06-07 06:00:36 UTC
See also bug 767313.
Comment 4 Egmont Koblinger 2019-11-22 09:14:45 UTC
See also https://github.com/jwilm/alacritty/pull/2937#issuecomment-557334660 (first screenshot).
Comment 5 GNOME Infrastructure Team 2021-06-10 20:34:54 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/7368.