DISPLAY is not exported, sometimes

David A. De Graaf dad at datix.us
Sat Jul 23 19:17:20 UTC 2011


Since doing fresh installs of Fedora 15 on two computers, I've found
that the DISPLAY environment variable is not exported in some cases,
despite being declared "exported".

This seems to be a clear violation of the EXPORT rules in /bin/bash.
It is a severe handicap in a root window, since most of the GUI
commands in the system-config-* group will not run.

The problem initially arose with the command
    /usr/bin/xterm -e /bin/su -
which opens a new root window, prompting for the passwd. 
I found that system-config-network failed to open the customary GUI panel,
but reverted to a semi-useless curses-based substitute.  This was quickly
traced to a missing DISPLAY definition in the root xterm.

However, this error occurs on only one of two laptops.  Although the
hardware is different - an IBM T30 vs an ASUS N10 - the packages
installed differ only in that nvidia drives are installed on the ASUS.
Both laptops usually run XFCE4;  the DISPLAY error occurs only on the
IBM T30.

To simplify the issue, and remove any potential security issues about
switching to root, I used su only to switch user, and only to myself,
ie:
   /bin/su - dad
   Passwd: 
No new xterm window was opened; I only changed user (to myself).

Before and after, I listed the exported variables:
   export -p > /tmp/exp.before
and compared the lists.

To my surprise, there is a great number of variables that should have
been exported, but were not.  Here's the list of variable names that
are NOT exported:

    IBM T30			ASUS N10

    DBUS_SESSION_BUS_ADDRESS=	DBUS_SESSION_BUS_ADDRESS=
    DESKTOP_SESSION=		DESKTOP_SESSION=
    DISPLAY=			
    GLADE_CATALOG_PATH=		GLADE_CATALOG_PATH=
    GLADE_MODULE_PATH=		GLADE_MODULE_PATH=
    GLADE_PIXMAP_PATH=		GLADE_PIXMAP_PATH=
    GNOME_KEYRING_CONTROL=
    GNOME_KEYRING_PID=
    GPG_AGENT_INFO=		GPG_AGENT_INFO=
    LIBGLADE_MODULE_PATH=	LIBGLADE_MODULE_PATH=
    				OLDPWD=
    ORBIT_SOCKETDIR=
    SESSION_MANAGER=		SESSION_MANAGER=
    SHLVL=			SHLVL=
    SSH_AGENT_PID=		SSH_AGENT_PID=
    SSH_AUTH_SOCK=		SSH_AUTH_SOCK=
    WINDOWID=			WINDOWID=
    WINDOWPATH=			WINDOWPATH=
    XDG_CONFIG_DIRS=		XDG_CONFIG_DIRS=
    XDG_DATA_DIRS=		XDG_DATA_DIRS=
    XDG_MENU_PREFIX=		XDG_MENU_PREFIX=
    XDG_SESSION_COOKIE=		XDG_SESSION_COOKIE=
    XTERM_LOCALE=		XTERM_LOCALE=
    XTERM_SHELL=		XTERM_SHELL=
    XTERM_VERSION=		XTERM_VERSION=

What's going on here?  I would expect the exported environment variables
to be identical in this experiment, but they are vastly different.
Is someone playing fast and loose with the rules?
In particular, why is DISPLAY not exported on the IBM T30, but is exported
on the ASUS N10?


As a further experiment, I fired up gnome 3 on each machine and reran
the comparison.  To be brief, DISPLAY is exported properly on BOTH
machines.  There are many different exported variables between xfce4
and gnome, which is not surprising, but why should DISPLAY be treated
differently?

I also tried different terminal emulators, Terminal, lxterminal,
xfterm4, etc.  I created a new user with a brand new $HOME.
None of these had any effect.

Who can duplicate this failure to export?
Why are variables, marked for export, not exported?
Who can explain it?
How can it be fixed?

I've filed BZ 722703 against xfce4, but
a)  I doubt that xfce4 is culpable, and
b)  The only responder seems to have run out of ideas.

Can anyone help?

-- 
        David A. De Graaf    DATIX, Inc.    Hendersonville, NC
        dad at datix.us         www.datix.us


Computers are like airconditioners: 
        They stop working properly if you open windows.


More information about the users mailing list