Merge lp:~jamesodhunt/upstart/bugs-1235649+1203595 into lp:upstart
Status: | Rejected | ||||||||
---|---|---|---|---|---|---|---|---|---|
Rejected by: | Steve Langasek | ||||||||
Proposed branch: | lp:~jamesodhunt/upstart/bugs-1235649+1203595 | ||||||||
Merge into: | lp:upstart | ||||||||
Diff against target: |
1044 lines (+730/-34) 13 files modified
ChangeLog (+48/-1) init/control.c (+45/-12) init/control.h (+5/-1) init/environ.c (+4/-0) init/job_class.c (+56/-6) init/job_process.c (+1/-1) init/main.c (+12/-5) init/tests/test_control.c (+2/-2) init/tests/test_environ.c (+457/-0) test/test_util_common.c (+11/-1) util/initctl.c (+2/-3) util/man/initctl.8 (+2/-2) util/tests/test_initctl.c (+85/-0) |
||||||||
To merge this branch: | bzr merge lp:~jamesodhunt/upstart/bugs-1235649+1203595 | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Steve Langasek | Disapprove | ||
Review via email: mp+191852@code.launchpad.net |
Description of the change
Make a Session Init connect to the D-Bus session bus as well as the private socket.
Unmerged revisions
- 1545. By James Hunt
-
* init/control.c: control_bus_open(): Don't call nih_dbus_bus() if
DBUS_SESSION_ BUS_ADDRESS is not set to avoid D-bus auto-launching a
dbus-daemon.
* init/environ.c: Comments.
* init/job_class.c:
- job_class_environment_ init(): Superior check on whether job_environ
is not empty.
- job_class_environment_ reset() : Only reset job_environ if not NULL
already.
- job_class_environment_ set(): Set variable in Upstarts environment
too (required to allow Upstart to be aware of the D-Bus session bus
address when the dbus-daemon is available).
- job_class_environment_ unset() : Unset variable from Upstarts
environment, but only if it is not a default variable.
* init/job_process.c: Formatting.
* init/test_control. c: Updated strings used by tests which check error
messages to include 'D-Bus'.
* init/test_environ. c:
- test_add(): New test:
- "using bare word with no corresponding variable set in environment"
- test_remove(): New function ("the missing test") containing 8 new tests:
- "remove name=value pair with empty table"
- "remove bare name with empty table"
- "remove name=value from table of size 1"
- "remove bare name from table of size 1"
- "remove first name=value entry from table of size 2"
- "remove first bare name entry from table of size 2"
- "remove last name=value entry from table of size 2"
- "remove last bare name entry from table of size 2"
* test/test_util_common. c:
- Formatting.
- get_initctl(): Added environment checks.
* util/initctl.c:
- Formatting.
- Removed testing comment from option text for '--session'.
* util/man/initctl.8: Removed testing comment for '--session'.
* util/tests/test_initctl. c:
- test_session_init(): New test that checks the Session Init now
connects to the D-Bus session bus. - 1544. By James Hunt
-
* Connect to the D-Bus session bus as well as using a private socket
when running as a Session Init (LP: #1203595, #1235649).
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.