1

After upgrading Ubuntu from 19.04 to 20.04.1, gnome-terminal always opens with / as working directory when lanched by name at a command prompt or in a desktop file, but NOT when launched from a button 'preferenced' to the dock or from the applications menu.

I had (and still have) a shortcut on my desktop that should open a terminal in a project directory, with this command in the .desktop file:

Exec=gnome-terminal --working-directory="~/git/ams-rpicm"

It still opens a terminal window like it used to, but with "/" as working directory.

Launching instances of gnome-terminal from another terminal window, I found that it's always the same, whether I include the --working-directory switch or not, and whatever path I specify in that switch: it always opens with "/" as working directory.

Does anyone have an idea what might cause this? It worked as expected in 19.04 just an hour ago.

The answer in open in terminal is not working after upgrading to 19.10 doesn't apply here, I already checked that.

Luc VdV
  • 163
  • Ubuntu 19.04 would release-upgrade to the next release, ie. 19.10 (not 20.04), and Ubuntu 20.04.1 is scheduled for release on 6-August-2020 (currently we're at 20.04) so I'd suggest checking some of your details. https://lists.ubuntu.com/archives/ubuntu-release/2020-June/004980.html – guiverc Jul 01 '20 at 11:53
  • 1
    I confirm this behaviour. Executing gnome-terminal --working-directory="~/Documents" launches a new window where pwd yields /. You may have discovered a bug. – vanadium Jul 01 '20 at 12:29
  • I'm surprised it ever worked - afaik ~ isn't expanded in this context. Did you try just --working-directory=git/ams-rpicm? Although dumping you into / may be a new behavior (on 3.28.2 it dumps me into my home dir) – steeldriver Jul 01 '20 at 12:29
  • Originally, I had --working-directory=git/ams-rpicm there. It is only because that started opening in /, that I added ~/ to try to fix it. Changed it back, and it still does it. – Luc VdV Jul 02 '20 at 12:17
  • guiverc is right - I must be getting blind, I could swear it said 20.04.1 when I got the upgrade, but /etc/issue says it's 20.04. I thought an automatic upgrade wouldn't even be offered until 20.04.1 is out, thought I read that somewhere. – Luc VdV Jul 02 '20 at 12:17

1 Answers1

0

It appears that things have changed. You cannot use the bash-tilde expandion. Moreover, you cannot use a relative path.

To workaround the issue, do not use bash tilde expansion. Instead use an absolute pathname or an environment variable, provided it is available.

Thus, expand the tilde by the full pathname, as

Exec=gnome-terminal --working-directory="/home/yourlogin/git/ams-rpicm"

where yourlogin is the name of your home folder, by default the same as your user name.

vanadium
  • 88,010