! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Missing environment variables


Description Mr.Chuoi 2009-12-07 19:18:25 CET
xfrun-dialog spawns new application with environment set to NULL
Comment 1 Mr.Chuoi 2009-12-07 19:20:17 CET
Created attachment 2722 
Comment 2 Brian J. Tarricone (not reading bugmail) 2009-12-07 19:48:50 CET
No, passing NULL does not modify the environment.  Regardless, declaring environ like that is not portable.  Is there an actual problem you're trying to solve, or are you just inspecting code and making (incorrect) assumptions about what it does?
Comment 3 Mr.Chuoi 2009-12-08 05:28:51 CET
Actually, I've tried to run xterm from xfrun and it cannot get some ssh-agent's environment variables & others (it works well if I create a launcher on desktop/panel).  With the patch, it works for the first time.  But after respawning (?!) from dbus service, xfrun clear all environment variables again.  I'm still tracing this bug.
Comment 4 Brian J. Tarricone (not reading bugmail) 2009-12-08 08:25:39 CET
That's because the dbus session bus gets started before ssh-agent does.  Perhaps that should be changed.
Comment 5 Mr.Chuoi 2009-12-08 15:52:18 CET
Yes, dbus-daemon (messagebus) gets started from init as a service.  I think it must be this way because some other applications may require it before X/XFCE get start.

But these are from /etc/xdg/xfce4/xinitrc (Fedora 12)

  # Use ssh-agent if installed and not already running.  Run it separately
  # so it populates the environment here, so we can clean it up later.
  sshagent=`which ssh-agent`
  if test -z "$SSH_AGENT_PID" -a "$sshagent" -a "x$sshagent" != "xno"; then
      eval `$sshagent -s`

  # Use dbus-launch if installed.
  if test x"$DBUS_SESSION_BUS_ADDRESS" = x""; then
      dbuslaunch=`which dbus-launch`
      if test x"$dbuslaunch" != x"" -a x"$dbuslaunch" != x"no"; then
          eval `$dbuslaunch --sh-syntax --exit-with-session`

dbus-launch (session) gets started right after ssh-agent already.  But xfrun is respawned from dbus-daemon, it inherits environment of dbus-daemon.  So, all the settings in bash_profile & others (e.g. xinitrc/xinitrc.d) will be missing.
Comment 6 Brian J. Tarricone (not reading bugmail) 2009-12-08 17:26:27 CET
Ah, whoops, I'm running a newer version of xinitrc that launches ssh-agent first (which I suppose I should put back to the old way).

If your shell is doing the right thing, profile/bashrc should be sourced when running xinitrc itself.  Well, at least one of them should, whichever one gets sourced for non-interactive login shells (or maybe that's non-interactive non-login shells).  Up to you to figure out which and put your commands in the right file.

Regardless, there's no problem here with xfrun.

Bug #6056

Reported by:
Reported on: 2009-12-07
Last modified on: 2009-12-08


Brian J. Tarricone (not reading bugmail)
CC List:
0 users



Patch (877 bytes, patch)
2009-12-07 19:20 CET , Mr.Chuoi
no flags

Additional information