Bug 229360

Summary: xterm unsets $TMPDIR before executing command/shell
Product: [Fedora] Fedora Reporter: James Ralston <ralston>
Component: xtermAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 8CC: martin.gutschelhofer, peter, sandmann
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 231-1.fc8 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-24 21:45:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 246063    
Bug Blocks:    

Description James Ralston 2007-02-20 16:35:39 UTC
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 16:38:03 UTC
Actually, it doesn't matter whether xterm 

Comment 2 Miroslav Lichvar 2007-02-21 14:39:01 UTC
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 14:51:11 UTC
*** Bug 243069 has been marked as a duplicate of this bug. ***

Comment 4 Peter TB Brett 2007-06-07 16:02:41 UTC
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 09:21:34 UTC
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 12:11:44 UTC
*** Bug 296131 has been marked as a duplicate of this bug. ***

Comment 7 Fedora Update System 2008-01-11 22:15:30 UTC
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 22:29:10 UTC
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 21:45:29 UTC
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 21:56:56 UTC
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.