Bug 229360 - xterm unsets $TMPDIR before executing command/shell
xterm unsets $TMPDIR before executing command/shell
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: xterm (Show other bugs)
8
All Linux
medium Severity medium
: ---
: ---
Assigned To: Miroslav Lichvar
: Reopened
: 243069 296131 (view as bug list)
Depends On: 246063
Blocks:
  Show dependency treegraph
 
Reported: 2007-02-20 11:35 EST by James Ralston
Modified: 2008-01-24 16:56 EST (History)
3 users (show)

See Also:
Fixed In Version: 231-1.fc8
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-24 16:45:31 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description James Ralston 2007-02-20 11:35:39 EST
Starting with xterm-223-2.fc6.src.rpm, xterm unsets TMPDIR before invoking the
shell:

$ echo $TMPDIR
/tmp/username-j22290

$ export TMPDIR

$ echo $TMPDIR
/tmp/username-j22290

$ xterm -e 'echo TMPDIR=$TMPDIR; sleep 5'

The output that appears in the resulting xterm is:

TMPDIR=

If I compare the behavior of xterm to gnome-terminal, the only real difference
in the environment of the shell is TMPDIR.  (The environment variables
COLORTERM, PPID, and WINDOWID differ, but that's to be expected.)

I don't see any [un]setenv calls in xterm's code, so I suspect some other
library call that xterm is using is having a side-effect of unsetting TMPDIR.
Comment 1 James Ralston 2007-02-20 11:38:03 EST
Actually, it doesn't matter whether xterm 
Comment 2 Miroslav Lichvar 2007-02-21 09:39:01 EST
Dynamic linker is unsetting the variable since the xterm binary has setgid
utempter. Without the setgid xterm won't have a record in utmp.

But you can put the setting to .bashrc.
Comment 3 Miroslav Lichvar 2007-06-07 10:51:11 EDT
*** Bug 243069 has been marked as a duplicate of this bug. ***
Comment 4 Peter TB Brett 2007-06-07 12:02:41 EDT
This *is* a bug, and should be re-opened as such.

"Putting the setting to .bashrc" is a kludgy workaround, not a fix, especially 
for variables like LD_LIBRARY_PATH which a user might want set for the entire 
session.  In fact, all the documentation recommends *against* setting 
variables in .bashrc & /etc/bashrc.  

One better solution would be to use a wrapper script which restores the 
environment.  Is there any way to get records in utmp using e.g. SELinux 
context rather than group?

(Another workaround is to use module-init-tools and add "module update" 
to /etc/bashrc).
Comment 5 Miroslav Lichvar 2007-06-28 05:21:34 EDT
The problem was recently discussed at fedora-devel list. A request against
libutempter to drop the setgid requirement is filed at bug #246063.
Comment 6 Miroslav Lichvar 2007-09-19 08:11:44 EDT
*** Bug 296131 has been marked as a duplicate of this bug. ***
Comment 7 Fedora Update System 2008-01-11 17:15:30 EST
xterm-231-1.fc8 has been pushed to the Fedora 8 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update xterm'
Comment 8 Fedora Update System 2008-01-11 17:29:10 EST
xterm-231-1.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update xterm'
Comment 9 Fedora Update System 2008-01-24 16:45:29 EST
xterm-231-1.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 10 Fedora Update System 2008-01-24 16:56:56 EST
xterm-231-1.fc7 has been pushed to the Fedora 7 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.