Opening new tab in gnome-terminal launched from nautilus loses most environment variables
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNOME Terminal |
Fix Released
|
Unknown
|
|||
gnome-terminal (Ubuntu) |
Fix Released
|
Medium
|
Gunnar Hjalmarsson | ||
Hirsute |
Fix Released
|
Medium
|
Gunnar Hjalmarsson |
Bug Description
[Impact]
If you launch gnome-terminal by right clicking a directory in Nautilus, selecting "Open in Terminal", you get a fully functional terminal window.
If you then press the new tab button, or ctrl-shift-t to open a new terminal tab, you will find that most environment variables have become unset, and you see the text:
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Comparing printenv between:
Normal terminal: https:/
Broken new terminal tab: https:/
Most commands won't run in the new terminal tab, due to $HOME and $USER not being set.
Note, if you launch gnome-terminal from gnome-shell or the dock, and create a new tab, everything works perfectly. Is something wrong with the Nautilus option for "Open in Terminal"?
[Testcase]
1. Launch Nautilus to home directory
2. Right click > "Open in Terminal"
3. Run "printenv" to see full list of env variables
4. Click new tab button, or ctrl-shift-t
5. Run "printenv" see the lack of env variables
I have a test package available in the below ppa:
https:/
The build in the ppa has 16bd9f6a4181d37
If you install this package, environment variables will be set correctly.
[Where problems could occur]
I think there is some risk with re-instating a commit which has been reverted, and users could run into similar issues as found in the upstream bug.
We do have some supporting evidence that the commit isn't too harmful, since it is applied to Groovy currently, things work as intended there, and users haven't complained about the issues in the upstream bug applying to Groovy.
If a regression were to occur, then launching a new gnome-terminal or opening a new tab could land the user with a terminal with little to no environment variables set. A workaround will be to launch gnome-terminal from gnome-shell overview.
[Other info]
Focal and Groovy have the following commit applied:
commit fd5ac772154426e
Author: Christian Persch <email address hidden>
Date: Mon Mar 23 09:57:56 2020 +0100
Subject: screen: Use clean env when creating new tab
Link: https:/
This was then reverted in 3.38.1 due to the upstream bug:
https:/
The reverted commit is:
commit 16bd9f6a4181d37
Author: Christian Persch <email address hidden>
Date: Thu Sep 17 17:10:47 2020 +0200
Subject: Revert "screen: Use clean env when creating new tab"
Link: https:/
This revert seems to have broken Hirsute. If we revert the revert, that is, apply the commit again, things work as intended.
To fix this, we need to re-apply fd5ac772154426e
description: | updated |
tags: | added: rls-ff-incoming |
tags: |
added: rls-hh-incoming removed: rls-ff-incoming |
tags: | removed: rls-hh-incoming |
Changed in gnome-terminal (Ubuntu Hirsute): | |
importance: | Undecided → Medium |
Changed in gnome-terminal: | |
status: | Unknown → Fix Released |
Version tested in hirsute is 3.38.1-1ubuntu1.
I checked Groovy, with 3.38.0-1ubuntu1.1, and the problem does not happen.
Both systems using Wayland session.