Code review comment for lp:~jamesodhunt/upstart/bugs-1235649+1203595

James Hunt (jamesodhunt) wrote :

This branch makes the Session Init attempt to connect to the D-Bus session bus on startup and retry when sent SIGUSR1. This behaviour is consistent with Upstart running as PID 1 and connecting to the D-Bus system bus.

The branch achieves the required behaviour by setting all global job environment variables in the Session Inits own environment too. This is specifically so that the Session Init will have knowledge of DBUS_SESSION_BUS_ADDRESS but avoids hard-coding a whitelist of variables to set. Note that since the Session Inits environment will change with each 'initctl (un)set-env -g ...', a subsequent call to 'initctl reset-env -g' will set the environment back to contain:

1) The default variables (PATH, TERM).
2) The Session Inits initial environment.
3) Any variables set via 'set-env -g'.

This is a subtle behavioural change which although not ideal can be rectified by manually running 'unsetenv $var' for all job global variables that should be removed from job environments.

Note that Upstart running as PID 1 will not have its environment modified.

Tested to ensure that bug 1235649 is resolved when a client connects to Upstart via the D-Bus session bus without a main loop and the spam.sh (attached to the bug) is run.

« Back to merge proposal