--- upstart-1.10.orig/configure +++ upstart-1.10/configure @@ -639,6 +639,8 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS +SELINUX_LIBS +SELINUX_CFLAGS HAVE_ABI_CHECKER_FALSE HAVE_ABI_CHECKER_TRUE ABI_COMPLIANCE_CHECKER @@ -818,6 +820,7 @@ enable_udev_bridge enable_dconf_bridge enable_abi_check +enable_selinux enable_threading enable_compiler_warnings enable_compiler_optimisations @@ -849,7 +852,9 @@ DCONF_CFLAGS DCONF_LIBS JSON_CFLAGS -JSON_LIBS' +JSON_LIBS +SELINUX_CFLAGS +SELINUX_LIBS' # Initialize some variables set by options. @@ -1490,6 +1495,7 @@ required dependencies available --disable-abi-check Disable libupstart ABI check performed if abi-compliance-checker available + --enable-selinux enable SELinux support --enable-threading Enable support for multi-threading --enable-compiler-warnings Enable additional compiler warnings @@ -1547,6 +1553,10 @@ DCONF_LIBS linker flags for DCONF, overriding pkg-config JSON_CFLAGS C compiler flags for JSON, overriding pkg-config JSON_LIBS linker flags for JSON, overriding pkg-config + SELINUX_CFLAGS + C compiler flags for SELINUX, overriding pkg-config + SELINUX_LIBS + linker flags for SELINUX, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -15282,6 +15292,111 @@ fi +# Check whether --enable-selinux was given. +if test "${enable_selinux+set}" = set; then : + enableval=$enable_selinux; +else + enable_selinux=no +fi + + +if test "x$enable_selinux" = "xyes" ; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SELINUX" >&5 +$as_echo_n "checking for SELINUX... " >&6; } + +if test -n "$SELINUX_CFLAGS"; then + pkg_cv_SELINUX_CFLAGS="$SELINUX_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libselinux\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libselinux") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SELINUX_CFLAGS=`$PKG_CONFIG --cflags "libselinux" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$SELINUX_LIBS"; then + pkg_cv_SELINUX_LIBS="$SELINUX_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libselinux\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libselinux") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_SELINUX_LIBS=`$PKG_CONFIG --libs "libselinux" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SELINUX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libselinux" 2>&1` + else + SELINUX_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libselinux" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$SELINUX_PKG_ERRORS" >&5 + + as_fn_error $? "Package requirements (libselinux) were not met: + +$SELINUX_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables SELINUX_CFLAGS +and SELINUX_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables SELINUX_CFLAGS +and SELINUX_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + SELINUX_CFLAGS=$pkg_cv_SELINUX_CFLAGS + SELINUX_LIBS=$pkg_cv_SELINUX_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +fi + +$as_echo "#define HAVE_SELINUX 1" >>confdefs.h + +fi + # Checks for header files. for ac_header in valgrind/valgrind.h, sys/prctl.h do : --- upstart-1.10.orig/ChangeLog +++ upstart-1.10/ChangeLog @@ -1,3 +1,76 @@ +2013-10-03 James Hunt + + * util/tests/test_utmp.c: Update remaining tests to pause + between writing utmp(x) records and reading them back to allow + tests to detect whether the expected new records have replaced + the artificially created original ones (LP: #1089159). + +2013-09-26 James Hunt + + * init/event.c: event_pending_handle_jobs(): Don't re-iterate job classes + unless quiescing. + +2013-09-26 James Hunt + + * init/event.c: event_pending_handle_jobs(): Force quiesce when all job + instances have finished to speed session shutdown. + * init/job_process.c: job_process_jobs_running(): Only consider job + instances with associated pids to avoid abstract jobs confusing the + shutdown. + * init/quiesce.c: + - quiesce(): Optimise session shutdown + - Skip wait phase if no jobs care about the 'session-end' event + (LP: #1227212). + - Stop already running instances if other jobs care about + 'session-end' to allow the already-running jobs to shut down in + parallel with the newly-started session-end jobs. + - quiesce_wait_callback(): + - Simplify logic. + - Improve wait phase checks to detect earliest time to finalise. + - quiesce_finalise(): Display time to shutdown. + - quiesce_complete(): New function to force final shutdown phase. + - quiesce_event_match(): New function to determine if any jobs + 'start on' contains a particular event. + - quiesce_in_progress(): Determine if shutdown is being handled. + * test/test_util_common.c: + - _start_upstart(): Call get_upstart_binary() rather than relying on + UPSTART_BINARY define. + - start_upstart_common(): Remove '--no-startup-event' as this is now + needed by a test. + - get_upstart_binary(): Assert that file exists. + - file_exists(): New helper function. + * test/test_util_common.h: Typo and prototype. + * util/tests/test_initctl.c: test_quiesce(): + - New test "session shutdown: one long-running job which starts on + startup". + - Adjusted expected shutdown times. + +2013-09-12 Steve Langasek + + * configure.ac: + - correct the copyright notice. + * extra/Makefile.am: + - don't pass cflags from unrelated libraries when building, only + pass them to those bridges which use the relevant libraries. + * init/tests/test_job_process.c: adjust test case to not key on the + text of error messages which will vary depending on whether + /bin/sh is dash or bash; and use TEST_STR_MATCH so that in the + event of future failures, we know why it's failing. + +2013-09-05 James Hunt + + * util/tests/test_initctl.c: test_quiesce(): + - Improve kill checks on job processes. + - Assert precisely which job processes are expected to be running + after the Session Init has exited (particularly important for jobs + that 'start on session-end' since they may be running in a System + Shutdown scenario). + +2013-08-28 James Hunt + + * util/tests/test_initctl.c: test_quiesce(): Clean up any + processes that the Session Init couldn't before it shut down. + 2013-08-23 James Hunt * NEWS: Release 1.10 --- upstart-1.10.orig/Makefile.in +++ upstart-1.10/Makefile.in @@ -291,6 +291,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/config.h.in +++ upstart-1.10/config.h.in @@ -34,6 +34,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H +/* Define if we have SELinux */ +#undef HAVE_SELINUX + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H --- upstart-1.10.orig/configure.ac +++ upstart-1.10/configure.ac @@ -8,7 +8,7 @@ AC_GNU_SOURCE -AM_INIT_AUTOMAKE([1.10 gnu nostdinc check-news color-tests silent-rules]) +AM_INIT_AUTOMAKE([1.10 gnu nostdinc check-news color-tests silent-rules serial-tests]) AM_SILENT_RULES([yes]) AM_MAINTAINER_MODE([enable]) @@ -81,6 +81,15 @@ AM_CONDITIONAL([HAVE_ABI_CHECKER], [test ! -z "$ABI_COMPLIANCE_CHECKER"]) +AC_ARG_ENABLE(selinux, + AS_HELP_STRING([--enable-selinux], [enable SELinux support]), + [], [enable_selinux=no]) + +if test "x$enable_selinux" = "xyes" ; then + PKG_CHECK_MODULES(SELINUX, [libselinux]) + AC_DEFINE(HAVE_SELINUX, 1, [Define if we have SELinux]) +fi + # Checks for header files. AC_CHECK_HEADERS([valgrind/valgrind.h, sys/prctl.h]) --- upstart-1.10.orig/conf/rc.conf +++ upstart-1.10/conf/rc.conf @@ -6,13 +6,18 @@ description "System V runlevel compatibility" author "Scott James Remnant " +emits deconfiguring-networking +emits unmounted-remote-filesystems + start on runlevel [0123456] stop on runlevel [!$RUNLEVEL] export RUNLEVEL export PREVLEVEL +console output +env INIT_VERBOSE + task -console output exec /etc/init.d/rc $RUNLEVEL --- upstart-1.10.orig/conf/Makefile.in +++ upstart-1.10/conf/Makefile.in @@ -237,6 +237,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/conf/rc-sysinit.conf +++ upstart-1.10/conf/rc-sysinit.conf @@ -6,7 +6,7 @@ description "System V initialisation compatibility" author "Scott James Remnant " -start on startup +start on (filesystem and static-network-up) or failsafe-boot stop on runlevel # Default runlevel, this may be overriden on the kernel command-line @@ -23,9 +23,11 @@ env RUNLEVEL= env PREVLEVEL= +console output +env INIT_VERBOSE + task -console owner script # Check for default runlevel in /etc/inittab if [ -r /etc/inittab ] --- upstart-1.10.orig/debian/running-in-container +++ upstart-1.10/debian/running-in-container @@ -0,0 +1,10 @@ +#!/bin/sh +# Return 0 if in a container, 1 if not +# if in a container, also print the container type +status container-detect 2>/dev/null | grep -q start + +if [ $? -eq 0 ]; then + [ -f /run/container_type ] && cat /run/container_type + exit 0 +fi +exit 1 --- upstart-1.10.orig/debian/upstart.logrotate +++ upstart-1.10/debian/upstart.logrotate @@ -0,0 +1,8 @@ +/var/log/upstart/*.log { + daily + missingok + rotate 7 + compress + notifempty + nocreate +} --- upstart-1.10.orig/debian/upstart.install +++ upstart-1.10/debian/upstart.install @@ -0,0 +1,17 @@ +debian/conf/*.conf etc/init/ +etc/init/*.conf etc/init/ +etc/dbus-1/system.d/Upstart.conf +bin/init-checkconf usr/bin/ +bin/initctl2dot usr/bin/ +sbin/* +debian/upstart-job lib/init/ +debian/apparmor-profile-load lib/init/ +debian/migrate-inittab.pl usr/lib/upstart/ +debian/running-in-container bin/ +usr/share/upstart/sessions/* +debian/user-conf/*.conf usr/share/upstart/sessions/ +debian/xsession.d/* etc/X11/Xsession.d/ +debian/upstart-xsessions etc/ +usr/share/man/man5/* +usr/share/man/man7/* +usr/share/man/man8/* --- upstart-1.10.orig/debian/control +++ upstart-1.10/debian/control @@ -0,0 +1,72 @@ +Source: upstart +Section: admin +Priority: required +Maintainer: James Hunt +Uploaders: Scott James Remnant +Standards-Version: 3.8.4 +Build-Depends: debhelper (>= 9), pkg-config (>= 0.22), libnih-dev (>= 1.0.3), libnih-dbus-dev (>= 1.0.3), nih-dbus-tool (>= 1.0.3), libdbus-1-dev (>= 1.2.16), libexpat1-dev (>= 2.0.0), libudev-dev (>= 151-5), libjson0-dev (>= 0.10), dbus, bash-completion, dh-autoreconf, autopoint, python3, automake (>= 1.12), libdconf-dev +X-Python3-Version: 3.3 +XS-Debian-Vcs-Bzr: nosmart+http://bzr.debian.org/bzr/collab-maint/upstart/trunk/ +XS-Debian-Vcs-Browser: http://anonscm.debian.org/loggerhead/collab-maint/upstart/trunk/ +Homepage: http://upstart.ubuntu.com/ +XS-Testsuite: autopkgtest + +Package: upstart +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, sysvinit-utils, sysv-rc, initscripts, mountall, ifupdown (>= 0.6.10ubuntu5), libjson0 (>= 0.10-1.1ubuntu1), debianutils (>= 4) +Suggests: python3, graphviz, bash-completion, upstart-monitor +Replaces: upstart-job, sysvinit, upstart-compat-sysv, startup-tasks, system-services +Conflicts: upstart-job, sysvinit, upstart-compat-sysv, startup-tasks, system-services, lxcguest +Provides: upstart-job, upstart-compat-sysv, startup-tasks, system-services +Breaks: libc6 (<< 2.12.1-0ubuntu12), friendly-recovery (<< 0.2.13) +Multi-Arch: foreign +Description: event-based init daemon + upstart is a replacement for the /sbin/init daemon which handles + starting of tasks and services during boot, stopping them during + shutdown and supervising them while the system is running. + +Package: upstart-monitor +Architecture: all +Section: utils +Priority: optional +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, upstart (>= 1.7), python3-dbus +Recommends: python3-gi +Description: event monitor for upstart + This package contains a utility that may be run both as a + command-line tool or as a graphical one that displays upstart + events as they are emitted. It is useful for observing system + changes and for determining appropriate events for new jobs. + +Package: upstart-dconf-bridge +Architecture: any +Section: utils +Priority: optional +Depends: ${shlibs:Depends}, ${misc:Depends}, ${python3:Depends}, upstart (>= 1.10) +Description: DConf bridge for upstart + This package contains a bridge that allows upstart jobs to react when + DConf/gsettings keys are changed. + +Package: libupstart1 +Priority: optional +Architecture: any +Pre-Depends: ${misc:Pre-Depends} +Depends: ${misc:Depends}, ${shlibs:Depends} +Multi-Arch: same +Description: Upstart Client Library + The libupstart library allows access to services provided by the Upstart init + daemon without having to use low-level D-Bus calls. + . + This package contains the shared library. + +Package: libupstart-dev +Priority: optional +Section: libdevel +Architecture: any +Multi-Arch: same +Depends: libupstart1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} +Description: Upstart Client Library (development files) + The libupstart library allows access to services provided by the Upstart init + daemon without having to use low-level D-Bus calls. + . + This package contains the static library and C header files which are + needed for developing software using libupstart. --- upstart-1.10.orig/debian/README.Debian +++ upstart-1.10/debian/README.Debian @@ -0,0 +1,200 @@ +upstart +======= + +Upstart is a replacement for the traditional sysvinit package, and +runs as process #1. Through upstart, we are able to have an +event-driven process, whilst at the same time retaining compatibility +for the original sysvinit behaviour. + +This file documents how to do a few common operations with the new +system. + + +Where are initscripts installed? +-------------------------------- + +This has not changed, they are installed in /etc/init.d. See +/etc/init.d/README. + +Important system jobs are no longer shipped as initscripts, but as +upstart jobs. These are installed in /etc/init + + +How are initscripts started and stopped? +---------------------------------------- + +This has not changed, symlinks are made from the initscript in the +/etc/init.d directory to the /etc/rc?.d directories. See +/etc/init.d/README and /etc/rc?.d/README. + + +What order are initscripts started and stopped in? +-------------------------------------------------- + +This has not changed, the symlinks are named SNNname or KNNname, where +NN is a number from 00 to 99. The K scripts are run first in +numerical order, followed by the S scripts in numerical order. + + +How do I find the current/previous runlevel? +-------------------------------------------- + +This has not changed, use the "runlevel" command. See runlevel(8). + + +How do I change the runlevel? +----------------------------- + +This has not changed, use the "telinit" command or just invoke "init" +directly. See telinit(8). + + +How do I change the default runlevel? +------------------------------------- + +If you have an /etc/inittab file, edit it. Locate the following line: + + id:N:initdefault: + +Where N is the default runlevel, change this to match. + +Most people won't have that file, you can edit /etc/init/rc-sysinit.conf +and change the following line: + + env DEFAULT_RUNLEVEL=2 + + +How do I shutdown the machine? +------------------------------ + +This has not changed, use the "shutdown" command provided by the +upstart package; you may also use the "reboot"/"halt"/"poweroff" +commands as a short-cut. See shutdown(8) and reboot(8). + +You can also press Control-Alt-Delete on a console to reboot the +machine. + + +How do I change the behaviour of Control-Alt-Delete? +---------------------------------------------------- + +Edit the /etc/init/control-alt-delete.conf file, the line beginning +"exec" is what upstart will run when this key combination is pressed. + +To not do anything, you can simply delete this file. + + +How do I enter single-user mode? +-------------------------------- + +This hasn't changed, choose the "(recovery mode)" option from GRUB; +add "-s", "S" or "single" to the kernel command-line; or from a +running machine, run "telinit 1" or "shutdown now". + + +How do I reduce the number of gettys? +------------------------------------- + +Also see "How do I change which runlevels gettys are run in?" + +In /etc/init there is a file named ttyN.conf for each getty that will be +started, where N is numbered 1 to 6. Remove any that you do not +want. + +This will not take immediate effect, however you can run "stop ttyN" +to stop one that is running. + + +How do I change getty parameters? +--------------------------------- + +In /etc/init there is a file named ttyN.conf for each getty that will be +started, where N is numbered 1 to 6. Edit these files, the line +beginning "respawn" is what upstart will run. + +This will not take immediate effect, run "stop ttyN" followed by +"start ttyN" or just kill the running getty to respawn with the new +parameters. + + +How do I change which runlevels gettys are run in? +-------------------------------------------------- + +In /etc/init there is a file named ttyN.conf for each getty that will be +started, where N is numbered 1 to 6. Edit these files, there are two +lines: + + start on runlevel [2345] + stop on runlevel [!2345] + +Change the set of runlevels to match your taste. + +This will not take immediate effect, however you can run "stop ttyN" +to stop one that is running or "start ttyN" to start one that isn't. + + +How do I increase the number of gettys? +--------------------------------------- + +In /etc/init there is a file named ttyN.conf for each getty that will be +started, where N is numbered 1 to 6. + +Copy one of these files to a new name, we suggest you simply name it +after the tty, e.g. "ttyS0". + +Edit that file, change the "respawn" line to match your requirements; +in particular you'll need to change the tty the getty should be run +on. + +This will not take immediate effect, however you can run "start ttyN" +to start the getty. + + +How do I add a serial console? +------------------------------ + +See "How do I increase the number of gettys?" + + +How can I see boot messages on the console? +------------------------------------------- + +This is nothing to do with upstart, but I'll answer this anyway. +Remove "quiet" from the kernel command-line. + +To make this permanent, edit /boot/grub/menu.lst and edit the line +that begins "# defoptions=" (yes, it looks like a comment). + +This will change both usplash and the LSB init logging. + + +Upstart isn't working, how do I debug it? +----------------------------------------- + +Add "--debug" to the kernel command-line, and be sure to remove "quiet" +and "splash". You'll now see debugging messages as upstart works. + + +Can I query upstart for a list of jobs? +--------------------------------------- + +Yes, "initctl list" will list the known jobs and their status. + + +How do I manually start or stop a job? +-------------------------------------- + +Use "start JOB" or "stop JOB". + + +How do I find the status of a job? +---------------------------------- + +Use "status JOB". + + +Can I emit an event by hand? +---------------------------- + +Yes, "initctl emit EVENT" will emit the named event and cause any +jobs waiting for it to be started or stopped as appropriate. --- upstart-1.10.orig/debian/libupstart-dev.install +++ upstart-1.10/debian/libupstart-dev.install @@ -0,0 +1,5 @@ +usr/lib/*/libupstart.a +usr/lib/*/libupstart.so +usr/include/upstart.h +usr/include/upstart +usr/lib/*/pkgconfig/libupstart.pc --- upstart-1.10.orig/debian/upstart.maintscript +++ upstart-1.10/debian/upstart.maintscript @@ -0,0 +1,2 @@ +rm_conffile /etc/init/dbus-reconnect.conf 0.6.3-7 +rm_conffile /etc/init/upstart-dbus-bridge.conf 1.9.1-0ubuntu4 --- upstart-1.10.orig/debian/upstart-monitor.manpages +++ upstart-1.10/debian/upstart-monitor.manpages @@ -0,0 +1 @@ +debian/tmp/usr/share/man/man8/upstart-monitor.8 --- upstart-1.10.orig/debian/migrate-inittab.pl +++ upstart-1.10/debian/migrate-inittab.pl @@ -0,0 +1,143 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my %gettys; +my $have_cad = 0; + + +#-----------------------------------------------------------------------------# +# Parse /etc/inittab +#-----------------------------------------------------------------------------# + +open INITTAB, "/etc/inittab" + or die "Unable to open /etc/inittab: $!"; + +while () { + chomp; + s/^\s*//; + + next if /^\#/; + next unless length; + + my ($id, $rlevel, $action, $process) = split /:/, $_, 4; + + warn "missing id field" and next + unless defined $id and length $id; + warn "missing runlevel field" and next + unless defined $rlevel; + warn "missing action field" and next + unless defined $action and length $action; + warn "missing process field" and next + unless defined $process; + + + $have_cad = 1 if $action eq "ctrlaltdel"; + $gettys{$1} = [ $rlevel, $process ] if $process =~ /getty.*\b(tty\w+)/; +} + +close INITTAB + or warn "Error while closing /etc/inittab: $!"; + + +#-----------------------------------------------------------------------------# +# Alter /etc/event.d +#-----------------------------------------------------------------------------# + +unlink "/etc/init/control-alt-delete.conf" + unless $have_cad; + +foreach (qw/tty1 tty2 tty3 tty4 tty5 tty6/) { + unlink "/etc/init/$_.conf" + unless exists $gettys{$_}; +} + +foreach (sort keys %gettys) { + my ($rlevel, $process) = @{$gettys{$_}}; + + my @job; + if (-f "/etc/event.d/$_") { + open JOB, "/etc/event.d/$_" + or warn "Unable to open /etc/event.d/$_: $!" and next; + @job = ; + chomp @job; + close JOB + or warn "Error while closing /etc/event,d/$_: $!" and next; + + foreach my $rl (qw/2 3 4 5/) { + my $idx; + for ($idx = 0; $idx < @job; $idx++) { + last if $job[$idx] =~ /^\s*(start|stop)\s+on\s+runlevel\s+$rl\b/; + } + + if ($idx < @job) { + if ($rlevel =~ /$rl/) { + $job[$idx] =~ s/^(\s*)stop(\s+)/$1start$2/; + } else { + $job[$idx] =~ s/^(\s*)start(\s+)/$1stop$2/; + } + } else { + if ($rlevel =~ /$rl/) { + push @job, "start on runlevel $rl"; + } else { + push @job, "stop on runlevel $rl"; + } + } + } + + my $idx; + for ($idx = 0; $idx < @job; $idx++) { + last if $job[$idx] =~ /^\s*respawn\s*/; # match bare 'respawn' too + } + + if ($idx < @job) { + # only match old-style 'respawn process', not bare 'respawn' + $job[$idx] =~ s/^(\s*respawn\s+).*/$1$process/; + } else { + push @job, "respawn"; + push @job, "exec $process"; + } + + # Try to fix up effects of previous broken migrations + if (@job and $job[$#job] =~ /.*(.+?)exec (\1)$/) { + $job[$#job] = "exec $1"; + } + + } else { + push @job, "# $_ - getty"; + push @job, "#"; + push @job, "# Converted from /etc/inittab entry"; + push @job, ""; + + foreach my $rl (qw/2 3 4 5/) { + if ($rlevel =~ /$rl/) { + push @job, "start on runlevel $rl"; + } else { + push @job, "stop on runlevel $rl"; + } + } + push @job, ""; + + push @job, "stop on shutdown"; + push @job, ""; + + push @job, "respawn"; + push @job, "exec $process"; + } + + open JOB, ">/etc/event.d/.$_" + or warn "Unable to write to /etc/event.d/.$_: $!" and next; + print JOB map { "$_\n" } @job; + unless (close JOB) { + warn "Error while closing /etc/event.d/.$_: $!"; + unlink "/etc/event.d/.$_"; + next; + } + + unless (rename "/etc/event.d/.$_", "/etc/event.d/$_") { + warn "Unable to replace /etc/event.d/$_: $!"; + unlink "/etc/event.d/.$_"; + next; + } +} --- upstart-1.10.orig/debian/upstart-monitor.install +++ upstart-1.10/debian/upstart-monitor.install @@ -0,0 +1,3 @@ +bin/upstart-monitor usr/bin/ +usr/share/icons/hicolor/scalable/apps/upstart-monitor.svg +usr/share/applications/upstart-monitor.desktop --- upstart-1.10.orig/debian/upstart-dconf-bridge.install +++ upstart-1.10/debian/upstart-dconf-bridge.install @@ -0,0 +1,2 @@ +sbin/upstart-dconf-bridge +usr/share/upstart/sessions/upstart-dconf-bridge.conf --- upstart-1.10.orig/debian/upstart.apport +++ upstart-1.10/debian/upstart.apport @@ -0,0 +1,194 @@ +#!/usr/bin/python +''' +Upstart apport hook. + +Handles both Upstart running as PID 1 and as a Session Init +(non-privileged user). + +Limitations: + +- does not handle non-default --logdir or --confdir. + +''' +import os +import re +import glob +from apport.hookutils import * +import apport.packaging + +msg = \ +""" +The contents of your Upstart job configuration files (*.conf and +*.override) files may help developers diagnose your bug more quickly. +However, if you have modified them, they may contain sensitive +information. + +Do you want to include any modified job configuration files +in your bug report? +""" + +def add_root_file(map, file): + """ + Add @file to @map such that @map can be passed to + attach_root_command_outputs() to have @file attached to the report + event if it is unreadable by the current user. + """ + if not os.path.exists(file): + return + + key = path_to_key(file) + + map[key] = 'cat %s' % file + + +def add_info(report, ui): + system_state_file = '/var/log/upstart/upstart.state' + system_conf_dir = '/etc/init' + session_state_file = None + attach_jobs = False + package = None + + # files that are not readable by current user + unreadable_files = {} + + # Used to determine which details to record. If we are unable to + # determine an accurate category of problem, attach all possible + # information for a crash or, for other categories of problem + # when the user has explicitly agreed. + category = 'Unknown' + + if 'Package' in report: + package = report['Package'].split()[0] + + # Determine whether this report relates to a System Init issue, + # or a Session Init one. + if report.get('ProblemType', '') == 'Crash': + if 'ProcStatus' in report: + pid_line = re.search('Pid:\t(.*)\n', report['ProcStatus']) + if pid_line: + upstart_pid = pid_line.groups()[0] + if upstart_pid: + if int(upstart_pid) == 1: + category = 'System' + else: + category = 'Session' + elif ui: + response = ui.choice( + "Upstart is used to supervise both the System and users Desktop\n" + "sessions. Please choose the option that is most appropriate\n" + "for the problem you wish to report\n", + ['System', 'Desktop Session']) + if response == None: + pass + if 0 in response: + category = 'System' + elif 1 in response: + category = 'Session' + + report['UpstartBugCategory'] = category + + if report.get('ProblemType', '') == 'Crash': + # crash bugs are private by default + attach_jobs = True + elif ui and ui.yesno(msg) == True: + attach_jobs = True + + if category == 'System' or category == 'Unknown': + attach_file(report, '/proc/cmdline', 'ProcKernelCmdline') + + # console output + attach_file_if_exists(report, '/var/log/boot.log', 'BootLog') + + if attach_jobs == True: + + # Map of files => package names where each file is an Upstart + # job configuration file. + file_map = {} + + for file in \ + glob.glob("%s/*.conf" % system_conf_dir) + \ + glob.glob("%s/*.override" % system_conf_dir): + + # try and determine which package owns the file + owner = apport.packaging.get_file_package(file) + + if owner == None: + # If no package owns it, it's either an admin-created + # job, or from a manually installed package, so attach. + # XXX: We don't use attach_file() since, although it + # handles unreadable files in a sense (by returning + # an error string), it does not allow us to grab the + # file contents. + add_root_file(unreadable_files, file) + elif owner != package and owner not in set(file_map.values()): + # If the file is owned by another package, + # record the package name. + # + # XXX: note that we exclude the file if it is owned by + # the Upstart package itself since the general hooks + # already look for modified conffiles. + file_map[file] = owner + + # Attach all modified conffiles for all packages which + # provide Upstart jobs. + # + # XXX: requires bug 1154536 to be fixed to avoid IOError + # attempting to read unreadable conffiles. + for pkg in set(file_map.values()): + try: + attach_conffiles(report, pkg) + except IOError: + # package contains conffiles that are unreadable by + # the current user. So, attach all the Upstart + # conffiles for that package for completeness until + # apport allows this sort of query as root by + # default. + for key, value in file_map.items(): + if value == pkg: + add_root_file(unreadable_files, key) + + if category == 'Session' or category == 'Unknown': + log_dir = os.getenv('XDG_CACHE_HOME', os.path.expanduser('~/.cache/upstart/')) + conf_dir = os.getenv('XDG_CONFIG_HOME', os.path.expanduser('~/.config/upstart/')) + old_conf_dir = os.path.expanduser('~/.init/') + session_state_file = os.path.join(log_dir, 'upstart.state') + + if attach_jobs == True: + for file in \ + glob.glob("%s/*.conf" % conf_dir) + \ + glob.glob("%s/*.override" % conf_dir) + \ + glob.glob("%s/*.conf" % old_conf_dir) + \ + glob.glob("%s/*.override" % old_conf_dir): + attach_file(report, file) + + add_root_file(unreadable_files, system_state_file) + + attach_root_command_outputs(report, unreadable_files) + + if session_state_file: + attach_file_if_exists(report, session_state_file) + + if os.path.exists(system_state_file) or (session_state_file and os.path.exists(session_state_file)): + report['Tags'] += ' ' + 'upstart-stateful-reexec-failed' + + report['UpstartRunningSystemVersion'] = command_output(['initctl', '--system', 'version']) + + if category == 'System' or category == 'Unknown': + report['UpstartRunningSystemJobs'] = command_output(['initctl', '--system', 'list']) + + session_count = 0 + if category == 'Session' or category == 'Unknown': + sessions = command_output(['initctl', 'list-sessions']).split('\n') + if sessions and sessions[0]: + session_count = len(sessions) + report['UpstartRunningSessionCount'] = str(session_count) + + # join the running session if possible + if not os.environ.get('UPSTART_SESSION', None) and session_count == 1: + session = sessions[0].strip().split()[1] + if session: + os.environ['UPSTART_SESSION'] = session + + if os.environ.get('UPSTART_SESSION', None): + report['UpstartRunningSessionVersion'] = command_output(['initctl', 'version']) + report['UpstartRunningSessionJobs'] = command_output(['initctl', 'list']) --- upstart-1.10.orig/debian/apparmor-profile-load +++ upstart-1.10/debian/apparmor-profile-load @@ -0,0 +1,30 @@ +#!/bin/sh +# apparmor-profile-load +# +# Helper for loading an AppArmor profile in pre-start scripts. + +[ -z "$1" ] && exit 1 # require a profile name + +# do not load in a container +[ -x /bin/running-in-container ] && /bin/running-in-container >/dev/null 2>&1 && exit 0 + +[ -d /rofs/etc/apparmor.d ] && exit 0 # do not load if running liveCD + +profile=/etc/apparmor.d/"$1" +[ -e "$profile" ] || exit 0 # skip when missing profile + +module=/sys/module/apparmor +[ -d $module ] || exit 0 # do not load without AppArmor in kernel + +[ -x /sbin/apparmor_parser ] || exit 0 # do not load without parser + +aafs=/sys/kernel/security/apparmor +[ -d $aafs ] || exit 0 # do not load if unmounted +[ -w $aafs/.load ] || exit 1 # fail if cannot load profiles + +params=$module/parameters +[ -r $params/enabled ] || exit 0 # do not load if missing +read enabled < $params/enabled || exit 1 # if this fails, something went wrong +[ "$enabled" = "Y" ] || exit 0 # do not load if disabled + +/sbin/apparmor_parser -r -W "$profile" || exit 0 # LP: #1058356 --- upstart-1.10.orig/debian/upstart-xsessions +++ upstart-1.10/debian/upstart-xsessions @@ -0,0 +1,15 @@ +# xsessions listed below are run inside an Upstart user session. +gnome +gnome-classic +gnome-fallback +gnome-fallback-compiz +kde-plasma +Lubuntu +Lubuntu-Netbook +lubuntu-nexus7 +lxgames +qlubuntu +ubuntu +ubuntustudio +xfce +xubuntu --- upstart-1.10.orig/debian/watch +++ upstart-1.10/debian/watch @@ -0,0 +1,2 @@ +version=3 +http://upstart.ubuntu.com/download/([\d\.]+)/upstart-(.*)\.tar\.gz --- upstart-1.10.orig/debian/rules +++ upstart-1.10/debian/rules @@ -0,0 +1,66 @@ +#!/usr/bin/make -f + +DEB_BUILD_MAINT_OPTIONS := hardening=+pie,+bindnow +DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed +DEB_CFLAGS_MAINT_APPEND := -Wall + +# Disable optimisations if noopt found in $DEB_BUILD_OPTIONS +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + DEB_LDFLAGS_MAINT_APPEND += -Wl,-O0 +else + DEB_CFLAGS_MAINT_APPEND += -Os + DEB_LDFLAGS_MAINT_APPEND += -Wl,-O1 +endif + +export DEB_BUILD_MAINT_OPTIONS DEB_LDFLAGS_MAINT_APPEND DEB_CFLAGS_MAINT_APPEND + +%: + dh $@ --with bash-completion,autoreconf,python3 + +override_dh_auto_configure: + dh_auto_configure -- --exec-prefix= --disable-silent-rules --disable-abi-check + +override_dh_auto_build: + dh_auto_build --parallel + +override_dh_auto_test: +ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) +ifeq (0,$(shell id -u)) + # WARNING: RUNNING TESTS AS ROOT IS KNOWN TO FAIL + # WARNING: WILL RUN TESTS, BUT WILL IGNORE FAILURE + -dh_auto_build -- check +else + dh_auto_build -- check +endif +endif + +override_dh_fixperms: + dh_fixperms + chmod 755 debian/upstart/lib/init/upstart-job + chmod 755 debian/upstart/lib/init/apparmor-profile-load + chmod 755 debian/upstart/usr/lib/upstart/migrate-inittab.pl + +override_dh_auto_install: + dh_auto_install -- pkgconfigdir=\$${libdir}/pkgconfig + +# Remove the appropriate dconf files from the upstart package - they +# will be added used by the upstart-dconf-bridge.install file. +override_dh_install: + dh_install + install -m 644 debian/upstart.apport \ + debian/upstart/usr/share/apport/package-hooks/upstart.py + rm debian/upstart/sbin/upstart-dconf-bridge + rm debian/upstart/usr/share/upstart/sessions/upstart-dconf-bridge.conf + rm debian/upstart/etc/init/upstart-event-bridge.conf + rm debian/upstart/etc/init/upstart-dbus-bridge.conf + +# Remove the following man pages from the upstart package; they will be +# added to the upstart-monitor and upstart-dconf-bridge packages via +# their .manpages files, but removing the files here is simpler than +# specifying every other section 8 manpage in the upstart packages +# .manpages file. +override_dh_installman: + dh_installman + rm debian/upstart/usr/share/man/man8/upstart-monitor.8* + rm debian/upstart/usr/share/man/man8/upstart-dconf-bridge.8* + rm debian/upstart/usr/share/man/man7/dconf-event.7* --- upstart-1.10.orig/debian/upstart.dirs +++ upstart-1.10/debian/upstart.dirs @@ -0,0 +1,2 @@ +var/log/upstart +usr/share/apport/package-hooks --- upstart-1.10.orig/debian/compat +++ upstart-1.10/debian/compat @@ -0,0 +1 @@ +9 --- upstart-1.10.orig/debian/upstart-job +++ upstart-1.10/debian/upstart-job @@ -0,0 +1,119 @@ +#!/bin/sh -e +# upstart-job +# +# Symlink target for initscripts that have been converted to Upstart. + +set -e + +UPSTART_JOB_CONF="/etc/default/upstart-job" +INITSCRIPT="$(basename "$0")" +JOB="${INITSCRIPT%.sh}" + +if [ "$JOB" = "upstart-job" ]; then + if [ -z "$1" ]; then + echo "Usage: upstart-job JOB COMMAND" 1>&2 + exit 1 + fi + + JOB="$1" + INITSCRIPT="$1" + shift +else + if [ -z "$1" ]; then + echo "Usage: $0 COMMAND" 1>&2 + exit 1 + fi +fi + +COMMAND="$1" +shift + +ECHO=echo +ECHO_ERROR=echo +if [ -e "$UPSTART_JOB_CONF" ]; then + . "$UPSTART_JOB_CONF" +fi +if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then + ECHO=: + ECHO_ERROR=: +fi + +$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)" +$ECHO "utility, e.g. service $INITSCRIPT $COMMAND" + +# Only check if jobs are disabled if the currently _running_ version of +# Upstart (which may be older than the latest _installed_ version) +# supports such a query. +# +# This check is necessary to handle the scenario when upgrading from a +# release without the 'show-config' command (introduced in +# Upstart for Ubuntu version 0.9.7) since without this check, all +# installed packages with associated Upstart jobs would be considered +# disabled. +# +# Once Upstart can maintain state on re-exec, this change can be +# dropped (since the currently running version of Upstart will always +# match the latest installed version). + +UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')') + +if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7 +then + initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1 +fi + +case $COMMAND in +status) + $ECHO + $ECHO "Since the script you are attempting to invoke has been converted to an" + $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" + $COMMAND "$JOB" + ;; +start|stop) + $ECHO + $ECHO "Since the script you are attempting to invoke has been converted to an" + $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" + if status "$JOB" 2>/dev/null | grep -q ' start/'; then + RUNNING=1 + fi + if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then + exit 0 + elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then + exit 0 + elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then + exit 0 + fi + $COMMAND "$JOB" + ;; +restart) + $ECHO + $ECHO "Since the script you are attempting to invoke has been converted to an" + $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities," + $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available." + if status "$JOB" 2>/dev/null | grep -q ' start/'; then + RUNNING=1 + fi + if [ -n "$RUNNING" ] ; then + stop "$JOB" + fi + # If the job is disabled and is not currently running, the job is + # not restarted. However, if the job is disabled but has been forced into the + # running state, we *do* stop and restart it since this is expected behaviour + # for the admin who forced the start. + if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then + exit 0 + fi + start "$JOB" + ;; +reload|force-reload) + $ECHO + $ECHO "Since the script you are attempting to invoke has been converted to an" + $ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB" + reload "$JOB" + ;; +*) + $ECHO_ERROR + $ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2 + $ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2 + exit 1 +esac --- upstart-1.10.orig/debian/upstart.postinst +++ upstart-1.10/debian/upstart.postinst @@ -0,0 +1,83 @@ +#!/bin/sh -e + +case "$1" in + configure) + if dpkg --compare-versions "$2" lt-nl 0.6.0; then + # We're upgrading from a version of Upstart that doesn't use + # D-Bus for its IPC. We have to tell it to re-exec into one + # that does. It'll lose all state, but we didn't keep much + # in those days. + telinit u + else + # Query running version of Upstart, but only when we know + # that initctl will work. + # + # The calculated version string may be the null string if + # Upstart is not running (where for example an alternative + # init is running outside a chroot environment) or if the + # query failed for some reason. However, the version check + # below handles a null version string correctly. + UPSTART_VERSION_RUNNING=$(initctl version 2>/dev/null |\ + awk '{print $3}'|tr -d ')' || :) + + if ischroot; then + # Do not honour re-exec when requested from within a + # chroot since: + # + # (a) The version of Upstart outside might not support it. + # (b) An isolated environment such as a chroot should + # not be able to modify its containing environment. + # + # A sufficiently new Upstart will actually handle a re-exec + # request coming from telinit within a chroot correctly, + # but it's simple enough to perform the check here and save + # Upstart the effort. + : + elif dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 1.9 || [ "$UPSTART_VERSION_RUNNING" = 1.8-ubuntu-full-serialization ]; then + # We are not running inside a chroot and the running version + # of Upstart supports lossless stateful re-exec, so we can + # restart immediately. + # + # XXX: Note that the check on the running version must + # remain *indefinitely* since it's the only safe way to + # know if stateful re-exec is supported: simply checking + # packaged version numbers is not sufficient since + # the package could be upgraded multiple times without a + # reboot. + telinit u || : + elif [ "$UPSTART_JOB" = "cloud-config" ]; then + # If upgraded by cloud-init, do not perform partial + # stateful re-exec, as cloud-init instance will fail + # to initialise. + touch /var/run/init.upgraded || : + [ -x /usr/share/update-notifier/notify-reboot-required ] && \ + /usr/share/update-notifier/notify-reboot-required || true + + elif dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 1.6.1; then + # Otherwise, perform partial stateful re-exec and + # request a reboot. + telinit u || : + [ -x /usr/share/update-notifier/notify-reboot-required ] && \ + /usr/share/update-notifier/notify-reboot-required || true + else + # Before we shutdown or reboot, we need to re-exec so that we + # can safely remount the root filesystem; we can't just do that + # here because we lose state. + touch /var/run/init.upgraded || : + fi + fi + + # Bridge is not used at the system level + ;; + + abort-upgrade|abort-deconfigure|abort-remove) + ;; + + *) + echo "$0 called with unknown argument \`$1'" 1>&2 + exit 1 + ;; +esac + +#DEBHELPER# +exit 0 --- upstart-1.10.orig/debian/copyright +++ upstart-1.10/debian/copyright @@ -0,0 +1,19 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: upstart +Upstream-Contact: upstart-devel@lists.ubuntu.com +Source: http://http://launchpad.net/upstart + +Files: * +Copyright: 2009-2013 Canonical Ltd. +License: GPL-2 + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2, as + published by the Free Software Foundation. + . + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + . + On Debian and Ubuntu systems, the complete text of the GNU General Public + License can be found in `/usr/share/common-licenses/GPL-2'. --- upstart-1.10.orig/debian/libupstart1.install +++ upstart-1.10/debian/libupstart1.install @@ -0,0 +1 @@ +usr/lib/*/libupstart.so.* --- upstart-1.10.orig/debian/libupstart1.symbols +++ upstart-1.10/debian/libupstart1.symbols @@ -0,0 +1,2 @@ +libupstart.so.1 libupstart1 #MINVER# + *@LIBUPSTART_1.0.0 1.9.1 --- upstart-1.10.orig/debian/upstart.docs +++ upstart-1.10/debian/upstart.docs @@ -0,0 +1,4 @@ +NEWS +AUTHORS +TODO +HACKING --- upstart-1.10.orig/debian/upstart.bash-completion +++ upstart-1.10/debian/upstart.bash-completion @@ -0,0 +1 @@ +contrib/bash_completion/upstart --- upstart-1.10.orig/debian/upstart-dconf-bridge.manpages +++ upstart-1.10/debian/upstart-dconf-bridge.manpages @@ -0,0 +1,2 @@ +debian/tmp/usr/share/man/man8/upstart-dconf-bridge.8 +debian/tmp/usr/share/man/man7/dconf-event.7 --- upstart-1.10.orig/debian/upstart.manpages +++ upstart-1.10/debian/upstart.manpages @@ -0,0 +1 @@ +debian/manpages/* --- upstart-1.10.orig/debian/changelog +++ upstart-1.10/debian/changelog @@ -0,0 +1,1658 @@ +upstart (1.10-0ubuntu3) saucy; urgency=low + + * Cherry-pick upstream fix for test failure (LP: #1089159). + + -- James Hunt Thu, 03 Oct 2013 13:25:23 +0100 + +upstart (1.10-0ubuntu2) saucy; urgency=low + + [ James Hunt ] + * debian/upstart.apport: Check session state file set before attempting + to add an apport tag. + * debian/user-conf/logrotate.conf: Move sleep from pre-start to main stanza + to ensure session shutdown is fast even in the case where it is triggered + soon after login. + * Optimise and speed-up session logout (LP: #1227212) + + [ Steve Langasek ] + * Use ${libdir} instead of including /usr/share/dpkg/architecture.mk. + * Drop manual symlinking of manpages, the upstream rules do this fine + for us already. + + -- James Hunt Tue, 01 Oct 2013 14:10:25 +0100 + +upstart (1.10-0ubuntu1) saucy; urgency=low + + * New upstream release (LP: #1199778, #1200264, #1201865). + * debian/user-conf/{re-exec,upstart-file-bridge}.conf: Removed as now + supplied by upstream. + * debian/upstart.install: Use all upstream-provided session config files. + * debian/control: Add upstart-dconf-bridge package. + * debian/rules: Remove files from upstart package that now live in the + upstart-dconf-bridge package. + * debian/upstart-dconf-bridge.install: New. + * debian/upstart-dconf-bridge.manpages: New. + + -- James Hunt Mon, 09 Sep 2013 10:22:18 +0100 + +upstart (1.9.1-0ubuntu5) saucy; urgency=low + + * Turn on Upstart user sessions for all the Ubuntu flavours. + + -- Stéphane Graber Tue, 27 Aug 2013 10:25:22 -0400 + +upstart (1.9.1-0ubuntu4) saucy; urgency=low + + [ Dmitrijs Ledkovs ] + * Bump upstart-dbus-bridge conf file removal to 1.9.1-0ubuntu4. (LP: #1203323) + + [ James Hunt ] + * debian/upstart.apport: Check to ensure that the sessions array contains + atleast one element. + + -- Dmitrijs Ledkovs Fri, 23 Aug 2013 11:43:40 +0100 + +upstart (1.9.1-0ubuntu3) saucy; urgency=low + + * Fix stateful re-exec with multiple stale chroot sessions (LP: #1199778) + + -- Dmitrijs Ledkovs Sat, 20 Jul 2013 00:17:07 +0100 + +upstart (1.9.1-0ubuntu2) saucy; urgency=low + + [ Dmitrijs Ledkovs ] + * Upload to saucy. + + [ James Hunt ] + * Fix stateful re-exec with active chroot sessions (LP: #1199778) + + [ Colin Watson ] + * Alternatively try new and old pkg-config names for json-c library. + + -- Dmitrijs Ledkovs Thu, 18 Jul 2013 10:56:31 +0100 + +upstart (1.9.1-0ubuntu1) saucy; urgency=low + + [ James Hunt ] + * debian/upstart.apport: + - Added session count to report ('UpstartRunningSessionCount'). + - Join Upstart session to ensure 'UpstartRunningSessionJobs' shows + session jobs and doesn't default to showing system ones. + * debian/copyright: Update year. + * New upstream release. + * debian/{control,libupstart*}: Add libupstart packaging. + * debian/rules: + - Delete upstart-dbus-bridge.conf to avoid running it at the system level. + - Install libupstart.pc to correct multi-arch location. + * debian/upstart.postinst: Handle safe removal of + upstart-dbus-bridge.conf (which is not used at the system level). + * debian/control: Add build-depends on automake >= 1.12 for serial-tests + in configure.ac (LP: #1197529). + * debian/libupstart-dev.install: Specify wildcarded path (for multi-arch). + + [ Dmitrijs Ledkovs ] + * Correct libupstart1.symbols, whilst soname is at 1.0.0, all of them + first appeared in 1.9.1 upstream version. + * Use dpkg-maintscript-helper to remove obsolete conffiles. + + -- James Hunt Mon, 08 Jul 2013 14:04:28 +0100 + +upstart (1.9-0ubuntu2) saucy; urgency=low + + * Cherry-pick upstream fix for crashing bridges (LP: #1197225) + + -- Dmitrijs Ledkovs Wed, 03 Jul 2013 09:37:35 +0100 + +upstart (1.9-0ubuntu1) saucy; urgency=low + + [ Dmitrijs Ledkovs ] + * Use dh_auto_build to run the testsuite, as dh_auto_test stopped + finding autotools test suite. + * Correct typo in upstart postinst (LP: #1195955) + + [ James Hunt ] + * New upstream release. + * init/tests/test_conf.c: Remove duplicate define. + + [ Stéphane Graber ] + * Cherry-pick r1498 from upstream upstart to fix incorrect respawn handling + for jobs that have shell characters in their expanded command line. + (LP: 1181789) + + [ Marc Deslauriers ] + * Added some distro-specific changes: + - init/apparmor.c: do not load apparmor if running in a container or a + live cd. + - init/job_process.c: don't fail if the security profile failed to load + to emulate current behaviour on Ubuntu. + + -- Dmitrijs Ledkovs Tue, 02 Jul 2013 20:14:51 +0100 + +upstart (1.8-0ubuntu7) saucy; urgency=low + + * Simplify postinst re-exec logic by removing runlevel checks. Now the + logic is: + - re-exec if lossless stateful re-exec is available + - perform partial stateful re-exec, unless running under upstart + - re-exec if upgrading from pre dbus capable upstart + - do nothing if running from chroot + - otherwise hint that init is upgraded + + -- Dmitrijs Ledkovs Mon, 17 Jun 2013 14:17:58 +0100 + +upstart (1.8-0ubuntu6) saucy; urgency=low + + * debian/upstart.postinst: + - When only partial stateful re-exec is available, and upgrade is run by + cloud-config simply leave init upgraded. + - When partial stateful re-exec is not performed also leave reboot required marker. + + -- Dmitrijs Ledkovs Thu, 13 Jun 2013 14:36:17 +0100 + +upstart (1.8-0ubuntu5) saucy; urgency=low + + * Change upstart's version string, such that postinst can detect whether + the running upstart instance has full serialization fixes. + * In postinst, check running upstart for the above version number or 1.9 + or better and then perform lossless stateful re-execution. Other wise + check for runlevels 2-5 and perform partial stateful re-execution. + + -- Dmitrijs Ledkovs Tue, 11 Jun 2013 10:51:53 +0100 + +upstart (1.8-0ubuntu4) saucy; urgency=low + + [ James Hunt ] + * Cherry pick lp:~jamesodhunt/upstart/serialise-remaining-objects (LP:#1124384): + - Preserve event blockers during configuration reload. + - Serialise & deserialise blocking events during stateful + re-execution. + * debian/manpages/upstart-events.7: Added ':sys:restarted'. + * debian/upstart.postinst: Don't re-exec if runlevel is not 2 + yet (to allow cloud-init to dist-upgrade upstart safeily in early boot). + + [ Dmitrijs Ledkovs ] + * Upload to saucy. + * Use "serial-tests" harness during build, instead of the automake's + 1.13 default "parallel-tests" harness. + * Enable parallel build by default. + + -- Dmitrijs Ledkovs Thu, 06 Jun 2013 16:15:09 +0100 + +upstart (1.8-0ubuntu3) saucy; urgency=low + + * Update the Xsession.d scripts to be a bit more generic and work with + lxsession as well as gnome-session. + + -- Stéphane Graber Fri, 31 May 2013 17:13:15 -0400 + +upstart (1.8-0ubuntu2) saucy; urgency=low + + [ James Hunt ] + * debian/manpages/upstart-events.7: Added ':sys:restarted'. + + [ Stéphane Graber ] + * Turn on user sessions by default for the 'ubuntu' xsession. + * Manually add scripts/man/upstart-monitor.8 as it was missing from the + upstream 1.8 tarball. + + -- Stéphane Graber Fri, 03 May 2013 09:55:36 -0700 + +upstart (1.8-0ubuntu1) raring; urgency=low + + [ James Hunt ] + * debian/manpages/upstart-events.7: Update for Session Init events + and file bridge. + * debian/rules: Install apport hook. + * debian/upstart.apport: Addition of apport hook to handle PID 1 and + Session Init bugs. + * debian/upstart.dirs: Remove invalid leading slash and add apport + directory. + * Cherry-pick man page related fixes from upstream. + * debian/control: Create a separate upstart-monitor package and make + upstart suggest it. + * debian/rules: + - Add python3 and associated graphical packages. + - Handle man pages. + * debian/upstart.install: Add in files not now copied by default + now we have a separate upstart-monitor package. Note that initctl2dot + and init-checkconf are now correctly installed to /usr/bin rather + than /bin. + * debian/upstart-monitor.install: New file. + * debian/upstart-monitor.manpages: New file. + * debian/upstart.links: New file. + * debian/user-conf/upstart-file-bridge.conf: Required as start condition + different to system job of same name. + + [ Iain Lane ] + * Set $SESSIONTYPE when emitting the xsession event that specifies the type + of session being launched. Currently only gnome-session is supported. + + -- James Hunt Tue, 26 Mar 2013 17:13:12 +0000 + +upstart (1.7-0ubuntu1b1) raring; urgency=low + + * No-change rebuild against libudev1 + + -- Martin Pitt Wed, 13 Mar 2013 07:02:18 +0000 + +upstart (1.7-0ubuntu1) raring; urgency=low + + [ Stéphane Graber ] + * New upstream release + * Install Xsession hooks and initial set of user jobs. Those will only be + used if the user explicitly whitelist the session in /etc/upstart-xsessions + + [ James Hunt ] + * Remove user_sessions DEP-8 test since User Jobs are no longer + supported and replace with a dummy test that just forces the + tests to run. + + -- Stéphane Graber Thu, 07 Mar 2013 16:16:13 -0500 + +upstart (1.6.1-1ubuntu3) raring; urgency=low + + * Use verbose build (disable silent rules) by default. + * Cherry-pick r1436 to support passing reboot command. + + -- Dmitrijs Ledkovs Mon, 25 Feb 2013 15:42:00 +0000 + +upstart (1.6.1-1ubuntu2) raring; urgency=low + + [ Stéphane Graber ] + * Call autoreconf so we can use the same packaging for snapshots as for + release tarballs. Add depends on dh-autoreconf and autopoint. + + [ James Hunt ] + * init/log.c: Cherry-pick of upstream fix for jobs which end before + the log disk becomes writeable and which spawn off additional + processes which persist after the main job process has ended + (LP: #1096531). + + -- James Hunt Tue, 22 Jan 2013 15:18:30 +0000 + +upstart (1.6.1-1ubuntu1) raring; urgency=low + + [ Steve Langasek ] + * New upstream release. + * Merge with Debian. + - drop debian/conf/dbus-reconnect.conf again, only needed in Debian. + - don't build against libselinux; this is probably fine to have in + Ubuntu, but this isn't the time to add it. + - back down the Debian-specific versioned depends on sysvinit, ifupdown, + udev + * Export $TERM in init/Makefile.am; the Debian buildds don't set this, + which results in test failures because of assumptions that it will be + available. + * Hard-code a dependency on libjson0 (>= 0.10-1.1ubuntu1), the first + version of the package that installs to /lib instead of /usr/lib. + + [ James Hunt ] + * debian/upstart-job: Allow script to operate quietly by reading optional + /etc/default/upstart-job configuration. Thanks to Jouko Orava + (LP: #613231) + * debian/control: Added debianutils for ischroot(1). + * debian/upstart.postinst: Enabled stateful re-exec handling in selected + upgrade scenarios. Details: + - Only query running version if initctl is known to work. + - Discard initctl stderr just in case. + - Do not re-exec if running in a chroot (uses ischroot(1)). + - Removed redundent check on previously installed version. + - Updated lengthy commentary. + + [ Stéphane Graber ] + * debian/apparmor-profile-load: Ignore output from running-in-container. + This prevents the output of running-in-container from being appended to + rsyslog's upstart log (and any other job calling apparmor-profile-load). + + [ Dmitrijs Ledkovs, James Hunt ] + * Add DEP-8 autopkgtests. + + -- Steve Langasek Thu, 15 Nov 2012 09:26:10 -0800 + +upstart (1.6.1-1) unstable; urgency=low + + * New upstream release. + * Declare a Breaks: against old versions of cryptsetup which have upstart + jobs named in a way that will deadlock the boot. (Ref: bug #694499) + * Make versioned build-dep on json-c (>= 0.10) explicit. + * Add debian/conf/dbus-reconnect.conf, to tell upstart to connect to the + system bus once dbus is started. This is a temporary solution until + dbus in Debian has native upstart support. + + -- Steve Langasek Mon, 10 Dec 2012 00:28:29 -0800 + +upstart (1.6-3) unstable; urgency=low + + * init/tests/test_job_process.c: don't test the blocked/ignored signal list + in a spawned job; this is not testing the upstart code but the + characteristics of the system, and the test is wrong because it assumes + the signal lists in /proc/self/status fit in an unsigned long int + - patently untrue on mips, where we have 128 signals for historical + reasons. + + -- Steve Langasek Sun, 18 Nov 2012 12:25:21 -0600 + +upstart (1.6-2) unstable; urgency=low + + * init/tests/test_job_process.c: cherry-pick upstream fix for test which + was accidentally relying on a variable persisting after it's gone out of + scope. + * init/tests/test_job_process.c: drop change to print path in the test, + should be fixed by the above. + * init/job_class.[ch]: instead of assuming a fixed value (0) as the + default nice value for job processes, use whatever the nice value of the + current process is. This will be important later for user sessions + where an entire session may be started with a higher nice value; and it + fixes running the test suite as part of a nice'd build. + * init/tests/test_job_class.c: update test suite to match. + + -- Steve Langasek Sun, 18 Nov 2012 01:54:29 -0600 + +upstart (1.6-1) unstable; urgency=low + + * New upstream release. + * Add build-dependency on libjson0-dev. + * Export $TERM in init/Makefile.am; the Debian buildds don't set this, + which results in test failures because of assumptions that it will be + available. + * init/tests/test_job_process.c: tests are failing to re-exec the test + binary on mips for no clear reason; output the path so we can try to + debug. + * init/tests/test_job_process.c: amd64 build failed with an inscrutible + error from waitid(). Print errno on failure to try to diagnose this. + + -- Steve Langasek Sat, 17 Nov 2012 23:19:37 -0600 + +upstart (1.5-1) unstable; urgency=low + + * New maintainer. + * New upstream release. Closes: #627544. + * Drop /etc/init/dbus-reconnect.conf, no longer needed. + * Add new jobs from Ubuntu: console, container-detect, failsafe, + flush-early-job-log, rcS.conf, shutdown, wait-for-state. + * Use 'linux-any' in the architecture check in debian/control, instead of + trying to enumerate all non-linux archs. Closes: #634513. + * Conflict with lxcguest package (Ubuntu-specific). + * Breaks old friendly-recovery (Ubuntu-specific). + * Mark upstart multi-arch: foreign. + * Add upstart-events(7) manpage from Ubuntu. + * Update packaging to dh(1), debian/compat=9 (from Ubuntu). + * debian/running-in-container: a script using container.conf to + answer whether upstart is running in a container. + * refresh soon-to-be-obsolete upstart-job helper from Ubuntu. + * Add bash-completion support. + * Add /var/log/upstart directory and logrotate support. + * Don't re-exec init on upgrade, we don't currently support stateful + re-exec. + * Switch to source format 1.0 for consistency with Ubuntu and for sane(r) + VCS handling. + * Add versioned dependencies on ifupdown and udev for the prerequisite + boot events. + * util/shutdown.c: look for sysvinit at /run/initctl before /dev/initctl, + so that we're compatible with both the old and new paths used by + sysvinit in Debian. Closes: #659540. + * Move to bzr for the official package Vcs, for greater synergy with the + Ubuntu packaging. + * Use copyright-format/1.0 for debian/copyright. This drops Scott from + the list of copyright holders, as an individual copyright is not + attested in any of the upstream sources. + + -- Steve Langasek Mon, 12 Nov 2012 13:38:34 -0800 + +upstart (1.5-0ubuntu9) quantal-proposed; urgency=low + + * debian/apparmor-profile-load: exit 0 if apparmor_parser fails to not + block upgrades (errors will still be logged by upstart). This can be + removed once apparmor_parser better deals with new policy on old kernels + - LP: #1058356 + + -- Jamie Strandboge Fri, 12 Oct 2012 13:54:10 -0500 + +upstart (1.5-0ubuntu8) quantal; urgency=low + + * Merge of latest upstream including doc fixes, fixes for booting + on initramfs-less systems and improved error handling in spawn + failure scenarios (LP: #980917, #1032101). + + -- James Hunt Wed, 08 Aug 2012 10:05:34 +0100 + +upstart (1.5-0ubuntu7) precise-proposed; urgency=low + + * Correct a build failure from the previous upload. + + -- Steve Langasek Thu, 26 Apr 2012 07:48:17 -0700 + +upstart (1.5-0ubuntu6) precise-proposed; urgency=low + + * debian/upstart.logrotate: don't create empty files after rotation; + upstart will automatically create new log files for jobs as needed. + * init/main.c: restore the fix for bug #540256; we know the console setup + is taken care of by plymouth in Ubuntu, so upstart changing the console + settings just makes trouble (such as turning echo back on when it + shouldn't be). LP: #876626. + + [ James Hunt ] + * debian/upstart-job: Only attempt to handle disabled jobs if the running + version of Upstart supports such a query (LP: #985755, #984474). + * debian/manpages/upstart-events.7: Fixed typo and corrected reference to + 'kill signal' stanza. + + -- Steve Langasek Wed, 25 Apr 2012 13:23:34 -0700 + +upstart (1.5-0ubuntu5) precise; urgency=low + + * debian/upstart-job: Add in handling for disabled jobs: + - Do not restart a job if disabled, unless job was forcibly started. + - Do stop a disabled job that was forcibly started. + Resolves issue where 'invoke-rc.d restart' erroneously started disabled + jobs on package upgrade (LP: #974147) + + -- James Hunt Tue, 10 Apr 2012 09:19:03 +0100 + +upstart (1.5-0ubuntu4) precise; urgency=low + + * debian/apparmor-profile-load: don't run in a container. This can + hopefully be removed after stacked profiles are supported and + used by lxc. (LP: #978297) + + -- Serge Hallyn Tue, 10 Apr 2012 14:55:41 -0500 + +upstart (1.5-0ubuntu3) precise; urgency=low + + * debian/manpages/upstart-events.7: Correct emitter for + "static-network-up" event. + + -- James Hunt Wed, 28 Mar 2012 11:59:56 +0100 + +upstart (1.5-0ubuntu2) precise; urgency=low + + * debian/conf/flush-early-job-log.conf: Change initctl command from + 'flush-early-job-log' to 'notify-disk-writeable' to reflect new name. + * init/man/init.8: Remove duplicate telinit(8). + * debian/manpages/upstart-events.7: + - Added table 'Job Goals and State Transitions'. + - Corrected errors and omissions in 'Job Lifecycle' section. + + -- James Hunt Wed, 28 Mar 2012 11:00:04 +0100 + +upstart (1.5-0ubuntu1) precise; urgency=low + + * FFe. LP: #962124. + * New upstream 1.5 release. + - fix boot failure when /dev/pts is not mounted before upstart starts. + LP: #936667. + - fix a file descriptor leak on job restarts. LP: #940290. + * debian/conf/failsafe.conf: Added missing "emits" which breaks + 'initctl check-config'. + * debian/manpages/upstart-events.7: Added 'failsafe-boot' and + 'recovery' events. + + -- James Hunt Thu, 22 Mar 2012 13:50:31 +0000 + +upstart (1.4-0ubuntu9) precise; urgency=low + + [ Steve Langasek ] + * debian/conf/failsafe.conf: instead of waiting for the 'runlevel' event + before considering failsafe done, stop this job as soon as we're + starting rc-sysinit; that way, any delays in /etc/rcS.d will not cause + confusing messages about networking delays when the network is not the + problem. (LP: #950662) + + [ James Hunt ] + * init/log.c:log_read_watch(): Set remote_closed for scenarios where error + handler never called. (LP: #935585) + + [ Serge Hally ] + * debian/conf/power-status-changed.conf: shut down on getting SIGPWR. + Unprivileged tasks can't send this signal. In particular this will + allow clean shutdown of containers from the host. + (See http://www.makelinux.net/man/7/P/power-status-changed) + + [ Stéphane Graber ] + * Rename Serge's job to shutdown.conf to avoid a name conflict with the + event power-status-changed. + + -- Stéphane Graber Fri, 16 Mar 2012 13:48:04 -0400 + +upstart (1.4-0ubuntu8) precise; urgency=low + + * init/tests/test_job_process.c: + - close_all_files(): Correct type of index variable. + - test_run(): + - "with single line command writing lots of data fast and exiting": + - add waitid() call to ensure log is not added to unflushed list. + - "with log object freed on process exit": + - add waitid() call to ensure log is not added to unflushed list. + * util/tests/test_initctl.c: test_flush_early_job_log(): + - "with job ending before log disk writeable": Give Upstart a chance + to run the job as sometimes we see the job pid in the output which + causes the test to fail. + + -- James Hunt Fri, 17 Feb 2012 10:58:02 -0500 + +upstart (1.4-0ubuntu7) precise; urgency=low + + * debian/manpages/upstart-events.7: Added missing events 'container' and + 'not-container'. + * Update 'runlevel' event emission time in upstart-events(7) (LP: #921501). + * Merge of important upstream log fixes to avoid spinning when a job + which leaks fds (such as 'sshd -D') is stopped (LP: #926468). + * Merge of lp:~jamesodhunt/upstart/early-job-log-flush to allow jobs that + _end_ very early in the boot to have their output logged. + * debian/conf/flush-early-job-log.conf: Upstart job to force flushing of + early job log output data when disk becomes writeable. + * Re-enable job logging by default. + + [ Steve Langasek ] + * init/tests/test_job_process.c: close all fds before running tests that + check for unexpected open fds, so that files leaked from the environment + don't cause the test suite to fail gratuitously. LP: #926473. + * bump debhelper compat to 9 and adjust debian/rules to use the + dpkg-buildflags interfaces, so that upstart can be cross-compiled and + also so we pick up any future hardening flags for free. + + -- Steve Langasek Thu, 16 Feb 2012 07:52:11 +0000 + +upstart (1.4-0ubuntu6) precise; urgency=low + + [ Serge Hallyn ] + * debian/conf/container-detect.conf: an upstart job to track whether upstart + detected itself running in a container. + * debian/running-in-container: a script using container.conf to + answer whether upstart is running in a container. + * debian/conf/console.conf: run getty on /dev/console when running + in a lxc container. + * debian/control: conflict with lxcguest. + + [ Stéphane Graber ] + * debian/conf/container-detect.conf: extend to also detect OpenVZ and vserver + as well as write the type in /run/container_type and emit either: + - container CONTAINER=type + (where type is lxc, lxc-libvirt, openvz or vserver) + - not-container + * debian/running-in-container: extend to also print the type of container. + * Rebase debian/conf/console.conf on debian/conf/tty1.conf. + * Update tty[1234].conf to start on regular machines and LXC containers. + * Update tty[56].conf to only start on regular machines. + + -- Stéphane Graber Wed, 08 Feb 2012 16:44:59 -0500 + +upstart (1.4-0ubuntu5) precise; urgency=low + + * Merge of important upstream log fixes to handle scenario attempts + are made to exec(3) directly non-existent commands. (LP: #922754) + + -- James Hunt Fri, 03 Feb 2012 14:16:40 +0000 + +upstart (1.4-0ubuntu4) precise; urgency=low + + * Disable job logging by default again due to a reported regression with + plymouth-upstart-bridge and upstart itself taking 100% CPU. Use --log + at boot time again for testing. + + -- Steve Langasek Fri, 27 Jan 2012 11:04:05 -0800 + +upstart (1.4-0ubuntu3) precise; urgency=low + + [ Stéphane Graber ] + * Mark upstart Multi-Arch:foreign + + [ James Hunt ] + * Merge of important logger fixes from upstream lp:upstart + (LP: #912558). + * Reverted temporary fix to disable job logging. + + -- James Hunt Thu, 26 Jan 2012 15:13:25 +0000 + +upstart (1.4-0ubuntu2) precise; urgency=low + + * init/main.c: Temporarily disable default job logging whilst + investigating bug 912558 (can be re-enabled with + _temporary_ '--log' option). + + -- James Hunt Fri, 06 Jan 2012 16:11:23 +0000 + +upstart (1.4-0ubuntu1) precise; urgency=low + + * New upstream 1.4 release. + * debian/upstart.dirs: Create /var/log/upstart to hold job logs. + * debian/upstart.logrotate: Logrotate script for job logs. + * po/en@boldquot.gmo, po/en@quot.gmo: Overwrite with upstream versions to + keep bzr happy. This makes the files technically "wrong" (since the + Ubuntu Upstart code has additional messages not in upstream), but they get + re-genrated on build so it all works out. + * debian/manpages/upstart-events.7: Add missing 'static-network-up' + event (LP: #889047). + * debian/manpages/upstart-events.7: Add missing + 'deconfiguring-networking' event (LP: #904175). + * Upstream merge for minor test fixes. + * Upstream merge for review fixes. + * Merge of upstream fix for running tests in environment not + supporting full POSIX SIGCHLD semantics. + + -- James Hunt Thu, 22 Dec 2011 16:51:43 +0000 + +upstart (1.3-0ubuntu11) oneiric-proposed; urgency=low + + * debian/conf/failsafe.conf: stop on static-network-up, so that a slow + runlevel switch doesn't leave a confusing message on screen about + starting up without networking. LP: #881079. + + -- Steve Langasek Wed, 26 Oct 2011 12:05:47 -0700 + +upstart (1.3-0ubuntu10) oneiric; urgency=low + + [ Clint Byrum ] + * debian/conf/failsafe.conf: do delay as script, not pre-start, so + that the messages/delays are stopped on runlevel immediately. emit + as an event, failsafe-boot, to provide finer grained control. + (LP: #863864) + * conf/rc-sysinit.conf: change from 'started failsafe' to 'failsafe-boot' + to accomodate changes to failsafe.conf. + + [ Steve Langasek ] + * Document device-not-ready in upstart-events(7). LP: #805510. + * Document desktop-shutdown in upstart-events(7). LP: #854329. + * Mention lightdm in the list of example DMs in upstart-events(7), since + it's now the default... + + -- Steve Langasek Mon, 03 Oct 2011 18:37:04 -0700 + +upstart (1.3-0ubuntu9) oneiric; urgency=low + + * Update rcS.conf to only start single user mode but not friendly-recovery. + (LP: #575469) + * Mark upstart as breaking friendly-recovery << 0.2.13 + + -- Stéphane Graber Thu, 15 Sep 2011 16:04:17 -0400 + +upstart (1.3-0ubuntu8) oneiric; urgency=low + + * debian/conf/failsafe.conf: Add plymouth messages to help users + understand why the system boot takes longer when they have + static network interfaces defined. (LP: #847782) + + -- Clint Byrum Wed, 14 Sep 2011 18:53:10 -0700 + +upstart (1.3-0ubuntu7) oneiric; urgency=low + + * debian/conf/failsafe.conf: raise timeout to 120 seconds to + allow for very slow DHCP interfaces to come up on servers. + (LP: #839595) + + -- Clint Byrum Sun, 04 Sep 2011 09:29:27 -0700 + +upstart (1.3-0ubuntu6) oneiric; urgency=low + + [ Steve Langasek ] + * Fix maintainer field to be compliant with policy definition + + [ Clint Byrum ] + * conf/rc.conf: document events that are emitted by sysvinit + jobs to quiet 'initctl check-config' + * extra/conf/upstart-udev-bridge.conf: narrow definition to + only the events actually emitted. (LP: #819928) + * debian/conf/failsafe.conf: new job for critical services to + start on. + * conf/rc-sysinit.conf: start after static-network-up or failsafe + so that runlevel 2 is only entered with all static net interfaces + up. (LP: #580319) + + -- Clint Byrum Wed, 10 Aug 2011 08:44:43 -0500 + +upstart (1.3-0ubuntu5) oneiric; urgency=low + + * Upstream cherry-pick for user session fixes + ("bzr merge -r 1318..1324 lp:upstart"). + + -- James Hunt Mon, 25 Jul 2011 17:09:47 +0100 + +upstart (1.3-0ubuntu4) oneiric; urgency=low + + * init/main.c: main(): Add support for "/run" directory with fallback to + old location for initramfs state passing (LP: #810956). + * Upstream cherry-pick to get dbus fix ("bzr merge -r 1314.. lp:upstart"). + + -- James Hunt Wed, 20 Jul 2011 14:51:04 +0100 + +upstart (1.3-0ubuntu3) oneiric; urgency=low + + * init/paths.h: Syned with upstream since Ubuntu file appears to have + diff applied twice, causing redefines. + + -- James Hunt Fri, 17 Jun 2011 09:59:49 +0100 + +upstart (1.3-0ubuntu2) oneiric; urgency=low + + * init/Makefile.am: Sync up from upstream, dropping TEST define which is + no longer required now we set UPSTART_NO_SESSIONS for init/tests/*.c + and specify "--no-sessions" for util/tests/*.c. + + -- James Hunt Fri, 17 Jun 2011 09:47:36 +0100 + +upstart (1.3-0ubuntu1) oneiric; urgency=low + + * Merge of Upstart 1.3 (lp:upstart @ 1.3 release tag). + + -- James Hunt Thu, 16 Jun 2011 15:09:41 +0100 + +upstart (0.9.7-3) oneiric; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9: Updates for + init-checkconf. + + -- James Hunt Wed, 27 Apr 2011 15:19:47 +0100 + +upstart (0.9.7-2) oneiric; urgency=low + + * Add wait-for-state generic "wait job". + + -- Clint Byrum Wed, 04 May 2011 08:32:04 -0700 + +upstart (0.9.7-1) natty; urgency=low + + * New upstream release 0.9.7: Important session fix (LP: #767053). + + -- James Hunt Wed, 20 Apr 2011 17:44:41 +0100 + +upstart (0.9.6-1ubuntu1) natty; urgency=low + + [ James Hunt ] + * init/man/init.5: Remove mention of user jobs since facility is + disabled. + + [ Clint Byrum ] + * Noting bugs fixed by 0.9.6 release of upstart: (LP: #728531 , LP: #766206) + + -- Clint Byrum Tue, 19 Apr 2011 13:16:46 -0700 + +upstart (0.9.6-1) natty; urgency=low + + * New upstream release 0.9.6: Important session+chroot fixes. + + -- James Hunt Fri, 15 Apr 2011 15:36:40 +0100 + +upstart (0.9.5-1ubuntu1) natty; urgency=low + + [ Clint Byrum ] + * debian/upstart-job: change behavior to reload job configuration on + restart, which more closely matches expected sysvinit script + behavior. (LP: #707479) + + -- James Hunt Wed, 06 Apr 2011 17:50:53 +0100 + +upstart (0.9.5-1) natty; urgency=low + + * New upstream release 0.9.5. + + -- James Hunt Wed, 06 Apr 2011 17:45:38 +0100 + +upstart (0.9.4-1ubuntu1) natty; urgency=low + + * debian/manpages/upstart-events.7: + - Corrected reference to Upstart man page (actually init). + - Changed to using proper troff quotes. + - Escaped dashes in event names. + - Updated date. + - Table 1: + - Improved name. + - Sorted columns: Events, References, and Notes. + - Added unmounted-remote-filesystems event. + + -- James Hunt Thu, 24 Mar 2011 14:34:12 +0000 + +upstart (0.9.4-1) natty; urgency=low + + * New upstream release 0.9.4: + - scripts/initctl2dot.py: Fixes to handle 'emits' glob syntax. + + -- James Hunt Thu, 24 Mar 2011 14:31:26 +0000 + +upstart (0.9.3-1) natty; urgency=low + + * New upstream release 0.9.3: + - Added missing emits stanzas for supplied .conf files. + - Added wildcard/globbing facility to initctl.c (for check-config + command). + - Updated man page on emits stanza syntax. + + -- James Hunt Tue, 15 Mar 2011 11:57:11 +0000 + +upstart (0.9.2-1) natty; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9. + + -- James Hunt Fri, 11 Mar 2011 10:34:39 +0000 + +upstart (0.9.1-1ubuntu5) natty; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9. + + -- James Hunt Thu, 10 Mar 2011 14:23:28 +0000 + +upstart (0.9.1-1ubuntu4) natty; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9. + + -- James Hunt Mon, 07 Mar 2011 15:08:35 +0000 + +upstart (0.9.1-1ubuntu3) natty; urgency=low + + * debian/upstart.bash-completion: Fixed path so dh_bash-completion + considers it a file, not a snippet. + + -- James Hunt Fri, 04 Mar 2011 21:26:27 +0000 + +upstart (0.9.1-1ubuntu2) natty; urgency=low + + * debian/control: Added Suggests for python, graphviz and + bash-completion. + * debian/rules: Invoke bash-completion add-on explicitly. + * debian/manpages/upstart-events.7: New man page. + * debian/upstart.bash-completion: Install bash completion. + * debian/upstart.manpages: Install upstart-events.7. + + -- James Hunt Fri, 04 Mar 2011 17:16:26 +0000 + +upstart (0.9.1-1ubuntu1) natty; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9. + + -- James Hunt Fri, 04 Mar 2011 15:13:35 +0000 + +upstart (0.9.1-1) natty; urgency=low + + * Merge of upstream lp:~upstart-devel/upstart/0.9. + + -- James Hunt Thu, 03 Mar 2011 20:52:16 +0000 + +upstart (0.9.0-1ubuntu3) natty; urgency=low + + * Revert dbus/Upstart.conf to the version in 0.6.7, disabling user session + support until such time as it has comprehensive test suite coverage. + + -- Colin Watson Mon, 28 Feb 2011 20:29:01 +0000 + +upstart (0.9.0-1ubuntu2) natty; urgency=low + + * Added extra/Makefile.in to avoid build failing. These files need removing + at a later date and debian/rules updating to call dh-autoreconf. + + -- James Hunt Thu, 24 Feb 2011 16:39:28 +0000 + +upstart (0.9.0-1ubuntu1) natty; urgency=low + + * debian/control: Updated for nih version 1.0.3 (required for nih-dbus-tool + and DBUS_TYPE_UNIX_FD). + * removed binary message catalog files causing build issues: + - po/en@boldquot.gmo + - po/en@quot.gmo + + -- James Hunt Thu, 24 Feb 2011 16:06:13 +0000 + +upstart (0.9.0-1) natty; urgency=low + + * New upstream release: + - Session support (chroots, sessions and user-session). + - Socket bridge. + - Override file support. + + -- James Hunt Thu, 24 Feb 2011 14:22:14 +0000 + +upstart (0.6.7-7) natty; urgency=low + + * Re-add upstream r977 to allow proper re-exec on shutdown (LP: #672177) + * debian/control: adding Breaks on eglibc version that disables + telinit u to avoid accidentally installing a version of libc6 that + will cause upstart to re-exec and lose its state. + + -- Clint Byrum Fri, 21 Jan 2011 08:39:13 -0800 + +upstart (0.6.7-6) natty; urgency=low + + * debian/apparmor-profile-load: check for correct AppArmor profile loading + interface file (LP: #710649). + + -- Kees Cook Thu, 03 Feb 2011 13:45:32 -0800 + +upstart (0.6.7-5) natty; urgency=low + + * debian/upstart-job: properly handle jobs that are in state 'start/running' + with no PID, by checking only if the goal is 'start'. LP: #603934, + #707971. + + -- Steve Langasek Wed, 26 Jan 2011 14:05:43 -0800 + +upstart (0.6.7-4) natty; urgency=low + + * debian/apparmor-profile-load: allow profiles to be missing for saner + packaging integration. + + -- Kees Cook Fri, 14 Jan 2011 13:46:12 -0800 + +upstart (0.6.7-3) natty; urgency=low + + * debian/rules: make sure apparmor-profile-load is executable. + + -- Kees Cook Wed, 22 Dec 2010 10:55:09 -0800 + +upstart (0.6.7-2) natty; urgency=low + + * debian/apparmor-profile-load: common AppArmor profile loading helper + which can be used by any upstart services, regardless of the state + of AppArmor (LP: #692801). + + -- Kees Cook Mon, 20 Dec 2010 16:03:33 -0800 + +upstart (0.6.7-1) natty; urgency=low + + * New upstream release: + - Added manual stanza. + - Added debug stanza. + - Added start_on, stop_on and emits properties. + - Added GoalChanged, StateChanged and Failed signals. + - Documentation updates. + + * Added myself as a maintainer. + + -- James Hunt Tue, 14 Dec 2010 17:15:57 +0000 + +upstart (0.6.6-3) maverick; urgency=low + + * Ubuntu seems to have stopped installing Recommends of Build-Depends, + add a Build-Depend on dbus. LP: #602130. + + -- Scott James Remnant Thu, 12 Aug 2010 16:38:05 -0400 + +upstart (0.6.6-2) maverick; urgency=low + + * Apply patch from trunk to use /dev/null when /dev/console is unavailable + due to kernel bugs. This isn't a fix for those bugs, but it does work + around it for now. LP: #554172. + + -- Scott James Remnant Thu, 12 Aug 2010 09:52:07 -0400 + +upstart (0.6.6-1ubuntu1) maverick; urgency=low + + * Try buying with -fPIE/-pie on armel again; we have a shiny new armel + toolchain and this part of the rules was broken in 0.6.6-1 anyway. + + -- Loïc Minier Fri, 23 Jul 2010 14:54:11 +0200 + +upstart (0.6.6-1) maverick; urgency=low + + * New upstream release: + - All changes were previously merged into this package. + + * debian/upstart-job: + - Fix output for the force-reload command to only refer to reload(8). + LP: #532862. + + * Add debian/source/format with "1.0" to be future compatible. + * Add missing ${misc:Depends}. + * Bump standards version. + * Convert rules to dh7 format. + + -- Scott James Remnant Tue, 27 Apr 2010 13:41:18 -0700 + +upstart (0.6.5-6) lucid; urgency=low + + * Merge fixes from trunk: + - double-quoting of NIH_CFLAGS and NIH_DBUS_CFLAGS on --with-local-libnih + - document "env KEY" behaviour + * conf/rc.conf, conf/rc-sysinit.conf: + - enable console output. LP: #548954. + - pass value of INIT_VERBOSE from kernel command-line. + + -- Scott James Remnant Thu, 01 Apr 2010 19:25:36 +0100 + +upstart (0.6.5-5) lucid; urgency=low + + * init/main.c: + - Don't change the settings of the foreground console, this is often + owned by plymouth and not supposed to be in Canonical Mode; all other + paths have stty sane settings anyway (which these are not), so there + really isn't need for init to do this. LP: #540256. + + -- Scott James Remnant Wed, 17 Mar 2010 22:34:55 +0000 + +upstart (0.6.5-4) lucid; urgency=low + + * debian/control: + - change Pre-Depends back to Depends, this was a holdover from when we + attempted to make Upstart Essential to solve early sysvinit→upstart + upgrade issues, we backed out the Essential bit but never the use of + Pre-Depends. LP: #527722. + - add versioned-dependencies on ifupdown for loopback fix that can + prevent initscripts from being run. LP: #527830. + + * Merge patches from trunk to use /proc/self/fd instead of /dev/fd, and + to always mount /proc and /sys on boot. + + -- Scott James Remnant Fri, 26 Feb 2010 15:40:58 +0000 + +upstart (0.6.5-3) lucid; urgency=low + + * udev/upstart-udev-bridge.c: use right variable name, fixing a build + failure. (LP: #524484) + + -- Scott Moser Fri, 19 Feb 2010 10:21:33 -0500 + +upstart (0.6.5-2) lucid; urgency=low + + * udev/upstart-udev-bridge.c: + - Increase receiving buffer size for uevents so we don't miss any. + LP: #504883. + + -- Scott James Remnant Wed, 17 Feb 2010 15:50:40 +0000 + +upstart (0.6.5-1) lucid; urgency=low + + * New upstream release: + - libnih has been separated out into its own project. + - "start on" and "stop on" now support != matches. LP: #513035. + - Fixed crash in child when unable to spawn job. LP: #451917. + - No longer holds /dev/console open so SAK won't kill init. LP: #486005. + - Added missing OPTIONS section to init(8). LP: #449883. + + [ Scott James Remnant ] + * Build-depend on libnih-dev, libnih-dbus-dev and nih-dbus-tool to use + the separated out libnih. + - This has the fix for LP: #436758. + - Remove changelog.nih from the doc directory. + * Bump udev build-dependency to 147 to match upstream. + * udev/Makefile.am: Update to use external libnih + + [ Johan Kiviniemi ] + * udev/upstart-udev-bridge.c: Change -device-remove to -device-removed to + match -device-added and -device-changed. LP: #516698. + + -- Scott James Remnant Thu, 04 Feb 2010 16:30:10 -0800 + +upstart (0.6.3-11build1) lucid; urgency=low + + * Rebuild to pick up relaxed dependency on libc6, after checking that + __abort_msg is available with the same signature in eglibc 2.11. + LP: #508702. + + -- Matthias Klose Mon, 18 Jan 2010 16:10:11 +0100 + +upstart (0.6.3-11) karmic-proposed; urgency=low + + * Make rc-sysinit.conf wait on the loopback interface, to ensure that the + interface is up before we process the scripts in /etc/rc?.d. LP: #461725. + + -- Steve Langasek Tue, 08 Dec 2009 12:58:37 -0800 + +upstart (0.6.3-10) karmic; urgency=low + + * Retain the "telinit u" for the case when we're upgrading from pre-0.6 + (ie. hardy or jaunty). Whups. LP: #451556. + + -- Scott James Remnant Thu, 15 Oct 2009 17:48:47 +0100 + +upstart (0.6.3-9) karmic; urgency=low + + * Restore the call to sync() in reboot, have been observing some issues + and it looks like ext4 might not be explicitly flushing the disk when + remounting read-only. + + -- Scott James Remnant Wed, 14 Oct 2009 16:40:32 +0100 + +upstart (0.6.3-8) karmic; urgency=low + + * Rather than calling "telinit u" after upgrade, which will lose state, + have the umountroot initscript take care of it for us by setting a + flag. LP: #441796. + * Don't lose the original default runlevel if /etc/inittab exists without + an initdefault line. LP: #405847. + * Fix "unhandled error" in shutdown when unable to change runlevel, + e.g. due to previous Ubiquity bug. LP: #426332. + * Merge change from trunk that makes it possible to build Upstart using + a previously built copy of nih-dbus-tool, especially useful when + cross-compiling. LP: #426740. + * Merge change from libnih to store our assertion messages in the + glibc __abort_msg symbol so apport can pick them up. LP: #429411. + * Merge change from libnih to fix compilation issue with eglibc due + to changed alphasort() prototype. + + -- Scott James Remnant Wed, 14 Oct 2009 05:34:13 +0100 + +upstart (0.6.3-7) karmic; urgency=low + + * Ignore initramfs pids that don't exist. LP: #440071. + - you still need to ensure that the pid's parent is init, there's no + cheap way to test for that. + * Remove "console owner" and "console output" from rc scripts. + * Try harder to remove dbus-reconnect.conf + + -- Scott James Remnant Fri, 02 Oct 2009 21:09:03 +0100 + +upstart (0.6.3-6) karmic; urgency=low + + * Don't use "telinit q" to reconnect to D-Bus, since that breaks + lots of things. Invent another secret way instead. + + [ Steve Langasek ] + * upstart-job's restart target must also not fail when the service is not + yet started. LP: #430883. + + -- Scott James Remnant Thu, 01 Oct 2009 15:26:19 +0100 + +upstart (0.6.3-5) karmic; urgency=low + + * Update autoconf and automake files. LP: #435252. + + -- Scott James Remnant Wed, 23 Sep 2009 14:16:34 -0700 + +upstart (0.6.3-4) karmic; urgency=low + + [ Scott James Remnant ] + * Reduce the priority of the stopped by/continued by messages so that + they are only shown when --verbose on the kernel command-line. + LP: #401333. + * Add a hack to look for /dev/.initramfs/*.pid files on startup and + "fake" start jobs of those names. Basically this means that "status" + and "stop" work for things like bootchart and usplash. + * Implement a "reload" command in initctl that retrieves the current pid + of the job and sends it the HUP signal. LP: #433544. + + [ Steve Langasek ] + * debian/upstart-job: + - give proper policy-compliant behavior of the start command: detect if + the job is already running using upstart status, and if so return success. + - same for the stop command: return success if the job is already stopped. + - when $DPKG_MAINTSCRIPT_PACKAGE is set, don't spit warnings out because + it's not the user's fault - we're being invoked by a maintainer script. + + -- Scott James Remnant Tue, 22 Sep 2009 13:56:48 -0700 + +upstart (0.6.3-3) karmic; urgency=low + + * debian/upstart-job: + - force-reload should only send a HUP signal, since it may not be wise + to actually restart (cf. dbus) + + -- Scott James Remnant Wed, 16 Sep 2009 00:10:13 +0100 + +upstart (0.6.3-2) karmic; urgency=low + + FFE LP: #427356. + + * debian/upstart-job: + - Remove trailing "s" from file + - Support direct invocation better. + * udev/upstart-udev-bridge.c: + - New tool to capture events from the udev netlink socket and + convert into upstart events. + * conf/rc-sysinit.conf: + - Run once all filesystems are mounted, rather than on startup + * debian/control: + - Add dependency on mountall for the filesystem event. + + -- Scott James Remnant Tue, 15 Sep 2009 03:19:09 +0100 + +upstart (0.6.3-1) karmic; urgency=low + + * New upstream release: + - Fixed assertion when a job exits while stopping. LP: #406408. + - Fixed compilation on ia64. + - nih-dbus-tool(1) manpage no longer installed. + + -- Scott James Remnant Mon, 03 Aug 2009 23:58:47 +0100 + +upstart (0.6.2-1) karmic; urgency=low + + * New upstream release: + - Fixed assertion when stopping a job during its starting event. + - Fixed fork following to not stop on exec() before fork() + - Fixed missing chdir() in crash handler. + + -- Scott James Remnant Wed, 22 Jul 2009 10:39:50 +0100 + +upstart (0.6.1-1) karmic; urgency=low + + * New upstream release: + - Fixed race condition in ptrace() code. LP: #264711. + - Fixed runlevel to output "unknown" not "N N". LP: #400248. + - Fixed runlevel to prefix error messages with filename. LP: #400241. + + * Provide/Conflict/Replace the agreed "upstart-job" meta-package. + LP: #399799. + * Bump dpkg dependency to 1.2.16 + + -- Scott James Remnant Thu, 16 Jul 2009 18:26:23 +0100 + +upstart (0.6.0-5) karmic; urgency=low + + * Cherry-pick patch from -r1188 to fix "expect fork" and "expect daemon" + LP: #264711. + + -- Scott James Remnant Tue, 14 Jul 2009 15:19:17 +0100 + +upstart (0.6.0-4) karmic; urgency=low + + * Don't build the testsuite with -fPIE on armel; LP: #398403. + + -- Loïc Minier Mon, 13 Jul 2009 22:12:34 +0200 + +upstart (0.6.0-3) karmic; urgency=low + + * Add Conflicts on older Upstart packages to make update-manager's + job easier. + + -- Scott James Remnant Fri, 10 Jul 2009 10:11:21 +0100 + +upstart (0.6.0-2) karmic; urgency=low + + * Bump D-Bus build dependency to ensure we get the container abandonment + patches, and the GIT version bump. + * Actually ship /lib/init/upstart-job + + -- Scott James Remnant Thu, 09 Jul 2009 17:29:59 +0100 + +upstart (0.6.0-1) karmic; urgency=low + + * New upstream release ("How appropriate, you fight like a cow") + - my customary changes list since pointless, it's basically a + complete rewrite. + - Handles /bin/sh symlink disappearing. LP: #65024. + - Boot parameters may be passed to init scripts. LP: #74664. + - reboot implies --force during shutdown. LP: #388738. + - reboot no longer iterates /proc/ide. LP: #92685. + - much improved documentation. LP: #60429, #72058, #388715. + + * Merge the various upstart packages into a single package, it makes + little sense to have it all spread out. + + -- Scott James Remnant Wed, 08 Jul 2009 23:12:03 +0100 + +upstart (0.3.10-2) karmic; urgency=low + + * debian/upstart.postinst: Use telinit u to re-exec, rather than + kill just in case it's not Upstart that's running. LP: #92177. + * debian/event.d/system-services/tty*: Run getty in 8-bit clean + mode. LP: #273189. + * debian/event.d/upstart-compat-sysv/rc-default: + - Don't use grep -w, instead split on $IFS and iterate. LP: #385911. + - Check for any valid runlevel, not just S. LP: #85014. + - Make console owner, since it may spawn sulogin. + * debian/event.d/upstart-compat-sysv/rcS: + - Spawn sulogin if given -b or "emergency". LP: #193810. + * debian/event.d/upstart-compat-sysv/rcS: + - Make console owner. LP: #211402. + * debian/event.d/upstart-compat-sysv/rcS-sulogin: + - Place the telinit code in post-stop, checking $UPSTART_EVENT first so + we don't change the runlevel if we were stopped due to a runlevel + change. LP: #66002. + + -- Scott James Remnant Thu, 18 Jun 2009 16:19:34 +0100 + +upstart (0.3.10-1) karmic; urgency=low + + * Compilation fixes. + * Fixed assertion caused by the post-start or pre-stop scripts + exiting after the main process of a respawning job had exited. + LP: #381048. + + -- Scott James Remnant Wed, 17 Jun 2009 13:33:40 +0100 + +upstart (0.3.9-8) intrepid; urgency=low + + * Do not attempt to continue communicating with the restarted upstart + (LP: #273761). + + -- Kees Cook Mon, 29 Sep 2008 13:35:21 -0700 + +upstart (0.3.9-7) intrepid; urgency=low + + * Implement "telinit u" by just sending Upstart SIGTERM with a slightly + different patch than Fedora. LP: #188925. + + -- Scott James Remnant Tue, 23 Sep 2008 09:01:09 -0700 + +upstart (0.3.9-6) intrepid; urgency=low + + * Really fix LP: #237276 properly this time, lost the change while mucking + around with bzr. + + -- Scott James Remnant Wed, 04 Jun 2008 22:29:48 +0100 + +upstart (0.3.9-5) intrepid; urgency=low + + * Correct build problem on amd64 and ia64 by only building libnih and + libupstart statically. The shared objects were unwanted, and conflict + with -fPIE. + + -- Scott James Remnant Wed, 04 Jun 2008 17:07:12 +0100 + +upstart (0.3.9-4) intrepid; urgency=low + + * Add missing limits.h, required to build with current libc. + + -- Scott James Remnant Wed, 04 Jun 2008 13:09:32 +0100 + +upstart (0.3.9-3) intrepid; urgency=low + + * Change dependency from sysvutils to sysvinit-utils. LP: #237276. + * Compile with stack -fstack-protector, -fPIE, -z relro, -z now and -pie + (MMmm, pie) + + -- Scott James Remnant Wed, 04 Jun 2008 12:59:11 +0100 + +upstart (0.3.9-2) hardy; urgency=low + + * Start the getty on tty1 after the rc script has stopped rather then + at the same time it starts to avoid overwriting by console messages. + tty2..6 will still be active if you want an early login. LP: #65230. + * If the recovery menu is available start that instead of sulogin when + entering single-user-mode. + + -- Scott James Remnant Fri, 11 Apr 2008 13:38:50 +0100 + +upstart (0.3.9-1) hardy; urgency=low + + * New upstream release: + - many bug fixes. + + * Update reference to "edgy" in README.Debian to "hardy". LP: #140037. + + -- Scott James Remnant Sun, 28 Oct 2007 10:51:59 -0400 + +upstart (0.3.8-2) gutsy; urgency=low + + * Fix broken migration of old-style 'respawn process' stanzas which + produced corrupted 'exec' stanzas. Try to fix up files previously + corrupted by this. LP: #95210 + + -- Scott James Remnant Sun, 28 Oct 2007 10:50:36 -0400 + +upstart (0.3.8-1) feisty; urgency=low + + * New upstream release: + - much improved initctl tool. + + * Update my standard prep_/undo_/rm_conffile functions to take into account + current dpkg behaviour wrt obsolete conffiles. The conffile is now moved + out of the way in preinst and the moved file deleted in postinst, or moved + back in postrm abort-upgrade. This means it's not there when dpkg + configures the new version, so the conffile is not left in the list. + * Purge backups of modified obsolete conffiles when the package is purged. + + * Update runlevel and respawn rule generated in migrate-inittab.pl + LP: #89314 + + * Drop 00-libnih-update.patch and 01-libnih-sparc-ftbfs.patch; new upstream + release includes an up-to-date libnih which contains both patches. + * Drop 10-cant-stop-execless-job.patch; included upstream. + * Drop 20-complex-event-config.patch; this is going to be significantly + changed upstream, and we don't want to ship something strange. + * Drop 30-fix-warnings.patch; included upstream. + + -- Scott James Remnant Sun, 11 Mar 2007 19:19:00 +0000 + +upstart (0.3.5-2) feisty; urgency=low + + * Changed "start script" to "pre-start script" in sulogin event, the former + is no longer recognised. + + * Applied 01-libnih-sparc-ftbfs.patch; this updates the signal name list + to exclude signals not available on that architecture, and add one that's + unique to it. + * Applied 30-fix-warnings.patch; this corrects a few warnings that spoiled + an otherwise clean build log. + + -- Scott James Remnant Tue, 13 Feb 2007 15:56:33 +0000 + +upstart (0.3.5-1) feisty; urgency=low + + * New upstream release: + - inotify file descriptor leak fixed. LP: #83099. + - inotify support is no longer required. LP: #68904. + - new job state machine + - new event structure, can now include arguments and environment + + * Applied 00-libnih-update.patch; this updates the libnih library to the + latest bzr trunk version, required for the complex-event-config patch. + * Applied 10-cant-stop-execless-job.patch from upstream; this corrects a + bug where jobs without an "exec" or "script" stanza cannot be stopped. + * Applied 20-complex-event-config.patch from upstream; this is an + experimental implementation of the "on" keyword that allows definition + of complex system states. + + * System V compatibility jobs updated to match new event names. + * rcS job now sets PREVLEVEL and RUNLEVEL. LP: #76304. + + * NOTE: After this upgrade, init will appear to have "forgotten" the + process ids of your gettys, etc. This is not a critical problem and + will be fixed before release. Shutdown will still work as normal. + + -- Scott James Remnant Mon, 12 Feb 2007 13:51:40 +0000 + +upstart (0.3.1-1) feisty; urgency=low + + * New upstream release: + - start, stop and status are now symlinks to initctl, not to a + different, separate utility. + - initctl completely rewritten to behave properly. + - some upstart-specific options to shutdown and reboot dropped, as + these are considered SysV-compat tools. + - "console none" fixed. LP: #70782. + - improved documentation. LP: #68805. + + * shutdown and reboot moved to upstart-compat-sysv. + + * Replace the /usr/share/doc/* directory in upstart-logd, + upstart-compat-sysv, system-services and startup-tasks with a symlink to + /usr/share/doc/upstart. This was actually done in a previous package, + but the migration missed. LP: #70895. + + -- Scott James Remnant Wed, 13 Dec 2006 17:27:37 +0000 + +upstart (0.2.7-7) edgy; urgency=low + + * Don't abort the postinst if we can't send init SIGTERM. Ubuntu: #64499. + + -- Scott James Remnant Tue, 10 Oct 2006 10:13:05 +0100 + +upstart (0.2.7-6) edgy; urgency=low + + * Don't start gettys on tty2 thru tty6 in runlevels 4 and 5 (matches + our sysvinit configuration). + * Migrate common changes made to /etc/inittab to /etc/event.d by + adjusting the installed conffiles. Ubuntu: #61539. + + * Include missing AUTHORS and NEWS file in the upstart package. + * Include README.Debian which answers common questions. Ubuntu: #60429. + + -- Scott James Remnant Thu, 5 Oct 2006 16:08:34 +0100 + +upstart (0.2.7-5) edgy; urgency=low + + * Don't set the current runlevel in /var/run/utmp to 0 or 6 if it is + already either of those two values. That way we don't end up with + either 0 or 6 in the PREVLEVEL variable, which can cause + /etc/init.d/rc to be "efficient" and not bother doing + anything. Ubuntu: #63852. + + -- Scott James Remnant Wed, 4 Oct 2006 14:06:18 +0100 + +upstart (0.2.7-4) edgy; urgency=low + + * Can't just start rc-default once in single-user mode, because if we + boot into that, that will just return us back to sulogin again. Copy + the script out of rc-default into rcS-sulogin to call telinit with the + right default runlevel. Ubuntu: #62189. + + * Add Build-Depend on dpkg-dev (>= 1.13.19) due to our use of + ${binary:Version}. Ubuntu: #61693. + + -- Scott James Remnant Tue, 26 Sep 2006 17:20:42 +0100 + +upstart (0.2.7-3) edgy; urgency=low + + * Set the runlevel to "S" when we enter sulogin so that it appears + in utmp. + + -- Scott James Remnant Thu, 21 Sep 2006 05:37:25 +0100 + +upstart (0.2.7-2) edgy; urgency=low + + * Ensure that the same version of upstart is installed as the version of + upstart-compat-sysv and upstart-logd; as the IPC protocol may change + between releases. + + * Adjust the rcS-sulogin job so that if sulogin exits the default runlevel + is entered; but if the job is stopped (e.g. by shutdown) it isn't. The + solves the regression introduced in the previous release. + + * Revert upstream logd/"quiet" change in favour of doing it in our + lsb logging functions instead; seems to work better (fsvo better). + + -- Scott James Remnant Thu, 21 Sep 2006 03:12:33 +0100 + +upstart (0.2.7-1) edgy; urgency=low + + * New upstream release: + - logd now writes to the console unless "quiet" is specified + - runaway jobs caught when they start rather than respawn. Ubuntu: #59807 + + * Fix failure to shutdown while in single-user mode, however this means + that for edgy you can't exit the sulogin shell to enter the default + runlevel; explicitly say what works. Ubuntu: #60626. + * Drop unnecessary dependency on util-linux. + * Drop sulogin hack, instead depend on the version of sysvutils that + includes the real one. Ubuntu: #60965. + + -- Scott James Remnant Wed, 20 Sep 2006 05:39:16 +0100 + +upstart (0.2.6-1) edgy; urgency=low + + * New upstream release: + - fix infinite loop caused by bad waitid() call. Ubuntu: #59459. + - halt now behaves as "shutdown -h now". Ubuntu: #59720. + + -- Scott James Remnant Wed, 13 Sep 2006 22:16:17 +0100 + +upstart (0.2.5-1) edgy; urgency=low + + * New upstream release: + - no longer spins when no stalled event handler. Ubuntu: #59170. + - shutdown works when under sysvinit. Ubuntu: #58523; + - shutdown -k implemented. Ubuntu: #58723. + - telinit sends shutdown event for 0, 1 and 6. Ubuntu: #58913. + - basic manual pages included. Ubuntu: #58724. + + * upstart-compat-sysv Replaces: sysvinit. Ubuntu: #59427. + * upstart Recommends: upstart-compat-sysv, startup-tasks & system-services. + + * New upstart-logd package includes the logd daemon that can will log + output of jobs with "console logged" (the default) in their description + to /var/log/boot. + + * Add /etc/event.d/rc0 that is run on the "halt" event (neither -H or -P + given), and modify rc0-halt to run on "system-halt" (-H given) and + rc0-poweroff to run on "power-off" (-P given). Ubuntu: #59134. + * Fix the control-alt-delete job to run on the "ctrlaltdel" event so + that it's triggered properly. Ubuntu: #59398. + * Fix single-user mode. + + -- Scott James Remnant Sat, 9 Sep 2006 05:10:12 +0100 + +upstart (0.2.1-7) edgy; urgency=low + + * Remove the Essential tags again, they didn't solve the problem we + hoped they would (dpkg/apt still won't remove sysvinit without + serious persuasion) and I don't think these packages should be. + + -- Scott James Remnant Thu, 7 Sep 2006 02:42:33 +0100 + +upstart (0.2.1-6) edgy; urgency=low + + * Make packages Essential, and change Depends to Pre-Depends so that the + packages work when unconfigured (nothing interesting is performed in + postinst). Ubuntu: #59005. + * Sync priority in debian/control with that in the archive (required) + * Drop warning of dire consequences if you install upstart, seeing as it's + installed by default. + + * Add new startup-tasks and system-services packages which will contain + the /etc/event.d files themselves (other than the main ones). + * Move tty definitions into system-services. + * Modify tty definitions to start when the rcS task has finished. This + puts them in the "right" place when compared to gdm. Ubuntu: #58630. + + * Correct rcS compatibility script to ignore any information in utmp so + that all scripts are always run. Ubuntu: #59203. + * Make rcS the console owner while it runs, temporary fix for + Ubuntu: #58609, #58794, #58796 + * Include default control-alt-delete handler that reboots the machine. + + -- Scott James Remnant Wed, 6 Sep 2006 21:52:48 +0100 + +upstart (0.2.1-5) edgy; urgency=low + + * upstart-compat-sysv Depends: initscripts (closes: Malone #58979). + + -- Colin Watson Tue, 5 Sep 2006 12:22:50 +0100 + +upstart (0.2.1-4) edgy; urgency=low + + * Add missing #! line to top of postrm + + -- Scott James Remnant Mon, 4 Sep 2006 08:11:16 +0100 + +upstart (0.2.1-3) edgy; urgency=low + + * Remove the rc0 configuration file shipped in 0.1.0 that causes all + reboots to become shutdowns. Ubuntu: #58557. + + -- Scott James Remnant Sun, 3 Sep 2006 23:24:41 +0100 + +upstart (0.2.1-2) edgy; urgency=low + + * Don't send the SIGTERM signal unless we're upgrading from a version + of upstart that supports re-exec; older versions would cause a kernel + PANIC and change from sysvinit does nothing. + + -- Scott James Remnant Sat, 2 Sep 2006 17:18:38 +0100 + +upstart (0.2.1-1) edgy; urgency=low + + * New upstream release: + - compilation fixes. + + -- Scott James Remnant Fri, 1 Sep 2006 19:51:41 +0100 + +upstart (0.2.0-1) edgy; urgency=low + + * New upstream release: + - upstart includes shutdown, reboot, halt, poweroff, start, stop, status, + runlevel and telinit utilities. + - "initctl list" will list active jobs. + - Events vastly simplified to just simple strings. + + * Compatibility tasks for old rc scripts, along with runlevel and telinit + utilities now shipped in upstart-compat-sysv package. + + -- Scott James Remnant Fri, 1 Sep 2006 02:38:44 +0100 + +upstart (0.1.1-1) edgy; urgency=low + + * New upstream release: + - set PATH and TERM in processes + + -- Scott James Remnant Fri, 25 Aug 2006 16:17:52 +0200 + +upstart (0.1.0-2) edgy; urgency=low + + * Oops, rename /sbin/init to /sbin/upstart as documented. Lost this + while battling bzr. + + -- Scott James Remnant Thu, 24 Aug 2006 16:30:54 +0200 + +upstart (0.1.0-1) edgy; urgency=low + + * Initial release. + + -- Scott James Remnant Thu, 24 Aug 2006 14:27:47 +0200 --- upstart-1.10.orig/debian/xsession.d/00upstart +++ upstart-1.10/debian/xsession.d/00upstart @@ -0,0 +1,12 @@ +# Make ubuntu-upstart an alias for ubuntu +if grep -q "^$DESKTOP_SESSION\$" /etc/upstart-xsessions; then + export XDG_CONFIG_DIRS="/usr/share/upstart/xdg:/etc/xdg" + + BASESESSION=${1% *} + BASESESSION=${BASESESSION##*/} + if [ "$BASESESSION" = x-session-manager ]; then + BASESESSION=$(basename $(readlink /etc/alternatives/x-session-manager)) + fi + + UPSTART=1 +fi --- upstart-1.10.orig/debian/xsession.d/99upstart +++ upstart-1.10/debian/xsession.d/99upstart @@ -0,0 +1,14 @@ +# Start the user session +if [ -n "$UPSTART" ]; then + case "$BASESESSION" in + gnome-session*) + export SESSIONTYPE=gnome-session + ;; + lxsession*) + export SESSIONTYPE=lxsession + ;; + esac + + STARTUP="init --user" + unset UPSTART +fi --- upstart-1.10.orig/debian/conf/tty1.conf +++ upstart-1.10/debian/conf/tty1.conf @@ -0,0 +1,14 @@ +# tty1 - getty +# +# This service maintains a getty on tty1 from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + +stop on runlevel [!2345] + +respawn +exec /sbin/getty -8 38400 tty1 --- upstart-1.10.orig/debian/conf/console.conf +++ upstart-1.10/debian/conf/console.conf @@ -0,0 +1,11 @@ +# console - getty +# +# This service maintains a getty on console from the point the system is +# started until it is shut down again. + +start on stopped rc RUNLEVEL=[2345] and container CONTAINER=lxc + +stop on runlevel [!2345] + +respawn +exec /sbin/getty -8 38400 console --- upstart-1.10.orig/debian/conf/tty6.conf +++ upstart-1.10/debian/conf/tty6.conf @@ -0,0 +1,11 @@ +# tty6 - getty +# +# This service maintains a getty on tty6 from the point the system is +# started until it is shut down again. + +start on runlevel [23] and not-container + +stop on runlevel [!23] + +respawn +exec /sbin/getty -8 38400 tty6 --- upstart-1.10.orig/debian/conf/container-detect.conf +++ upstart-1.10/debian/conf/container-detect.conf @@ -0,0 +1,42 @@ +description "Track if upstart is running in a container" + +start on mounted MOUNTPOINT=/run + +env container +env LIBVIRT_LXC_UUID + +emits container +emits not-container + +pre-start script + # The "standard" way of telling if we are in a container + # is to check for "container" in init's environment. + # The code below is for cases where it's not set. + + # Detect old-style libvirt + if [ -z "$container" ]; then + [ -n "$LIBVIRT_LXC_UUID" ] && container=lxc-libvirt + fi + + # Detect OpenVZ containers + if [ -z "$container" ]; then + [ -d /proc/vz ] && [ ! -d /proc/bc ] && container=openvz + fi + + # Detect Vserver containers + if [ -z "$container" ]; then + VXID="$(cat /proc/self/status | grep ^VxID | cut -f2)" || true + [ "${VXID:-0}" -gt 1 ] && container=vserver + fi + + if [ -n "$container" ]; then + echo "$container" > /run/container_type || true + initctl emit --no-wait container CONTAINER=$container + exit 0 + fi + + # If not a container, stop there + rm -f /run/container_type + initctl emit --no-wait not-container + stop +end script --- upstart-1.10.orig/debian/conf/wait-for-state.conf +++ upstart-1.10/debian/conf/wait-for-state.conf @@ -0,0 +1,60 @@ +author "Clint Byrum " +description "Waiting for state" + +task +normal exit 2 + +stop on started $WAIT_FOR or stopped $WAIT_FOR + +# These are all arguments for use influencing how this job waits +env TIMEOUT=30 +env MANUAL_OVERRIDE="N" +env WAIT_FOREVER="N" +env WAIT_STATE="started" +env TARGET_GOAL="start" + +# Required args w/ no sensible default, the tests at the beginning of +# the script are just to guard against WAITER="" or WAIT_FOR="", as the +# instance line will fail if they are not set, since they have no env +instance $WAITER$WAIT_FOR + +script + test -n "$WAIT_FOR" || exit 1 + test -n "$WAITER" || exit 1 + + # We don't want to override the manual stanza + # XXX: initctl show-config should share manual w/ us too + case $MANUAL_OVERRIDE in + N|n|0) + if grep -q "^\s*manual\s*$" /etc/init/$WAIT_FOR.conf ; then + exit 0 + fi + ;; + esac + + if [ "$WAIT_STATE" = "stopped" ] ; then + TARGET_GOAL="stop" + fi + + # Already running/stopped? + status $WAIT_FOR | grep -q "$TARGET_GOAL/$WAIT_STATE" && exit 0 + + # Give it a push + $TARGET_GOAL $WAIT_FOR || : + + # upstart will kill this shell on started/stopped $WAIT_FOR + while sleep $TIMEOUT ; do + case $WAIT_FOREVER in + N|n|0) + exit 100 + ;; + Y|y|1) + ;; + *) + exit 1 + ;; + esac + done + # Very strange, sleep returned non-zero? + exit 1 +end script --- upstart-1.10.orig/debian/conf/tty5.conf +++ upstart-1.10/debian/conf/tty5.conf @@ -0,0 +1,11 @@ +# tty5 - getty +# +# This service maintains a getty on tty5 from the point the system is +# started until it is shut down again. + +start on runlevel [23] and not-container + +stop on runlevel [!23] + +respawn +exec /sbin/getty -8 38400 tty5 --- upstart-1.10.orig/debian/conf/tty4.conf +++ upstart-1.10/debian/conf/tty4.conf @@ -0,0 +1,14 @@ +# tty4 - getty +# +# This service maintains a getty on tty4 from the point the system is +# started until it is shut down again. + +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + +stop on runlevel [!23] + +respawn +exec /sbin/getty -8 38400 tty4 --- upstart-1.10.orig/debian/conf/shutdown.conf +++ upstart-1.10/debian/conf/shutdown.conf @@ -0,0 +1,9 @@ +# Trigger an immediate shutdown when upstart receives SIGPWR +# this is useful for some UPS monitoring tools and for clean +# shutdown of containers + +description "Trigger an immediate shutdown on SIGPWR" +start on power-status-changed + +task +exec shutdown -h now "SIGPWR received" --- upstart-1.10.orig/debian/conf/tty2.conf +++ upstart-1.10/debian/conf/tty2.conf @@ -0,0 +1,14 @@ +# tty2 - getty +# +# This service maintains a getty on tty2 from the point the system is +# started until it is shut down again. + +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + +stop on runlevel [!23] + +respawn +exec /sbin/getty -8 38400 tty2 --- upstart-1.10.orig/debian/conf/rcS.conf +++ upstart-1.10/debian/conf/rcS.conf @@ -0,0 +1,28 @@ +# rcS - System V single-user mode compatibility +# +# This task handles the old System V-style single-user mode, this is +# distinct from the other runlevels since running the rc script would +# be bad. + +description "System V single-user mode compatibility" +author "Scott James Remnant " + +start on runlevel S +stop on runlevel [!S] + +console owner +script + exec /sbin/sulogin +end script + +post-stop script + # Don't switch runlevels if we were stopped by an event, since that + # means we're already switching runlevels + if [ -n "${UPSTART_STOP_EVENTS}" ] + then + exit 0 + fi + + # Switch, passing a magic flag + start --no-wait rc-sysinit FROM_SINGLE_USER_MODE=y +end script --- upstart-1.10.orig/debian/conf/tty3.conf +++ upstart-1.10/debian/conf/tty3.conf @@ -0,0 +1,14 @@ +# tty3 - getty +# +# This service maintains a getty on tty3 from the point the system is +# started until it is shut down again. + +start on runlevel [23] and ( + not-container or + container CONTAINER=lxc or + container CONTAINER=lxc-libvirt) + +stop on runlevel [!23] + +respawn +exec /sbin/getty -8 38400 tty3 --- upstart-1.10.orig/debian/conf/failsafe.conf +++ upstart-1.10/debian/conf/failsafe.conf @@ -0,0 +1,44 @@ +# failsafe + +description "Failsafe Boot Delay" +author "Clint Byrum " + +start on filesystem and net-device-up IFACE=lo +stop on static-network-up or starting rc-sysinit + +emits failsafe-boot + +console output + +script + # Determine if plymouth is available + if [ -x /bin/plymouth ] && /bin/plymouth --ping ; then + PLYMOUTH=/bin/plymouth + else + PLYMOUTH=":" + fi + + # The point here is to wait for 2 minutes before forcibly booting + # the system. Anything that is in an "or" condition with 'started + # failsafe' in rc-sysinit deserves consideration for mentioning in + # these messages. currently only static-network-up counts for that. + + sleep 20 + + # Plymouth errors should not stop the script because we *must* reach + # the end of this script to avoid letting the system spin forever + # waiting on it to start. + $PLYMOUTH message --text="Waiting for network configuration..." || : + sleep 40 + + $PLYMOUTH message --text="Waiting up to 60 more seconds for network configuration..." || : + sleep 59 + $PLYMOUTH message --text="Booting system without full network configuration..." || : + + # give user 1 second to see this message since plymouth will go + # away as soon as failsafe starts. + sleep 1 + exec initctl emit --no-wait failsafe-boot +end script + +post-start exec logger -t 'failsafe' -p daemon.warning "Failsafe of 120 seconds reached." --- upstart-1.10.orig/debian/conf/flush-early-job-log.conf +++ upstart-1.10/debian/conf/flush-early-job-log.conf @@ -0,0 +1,11 @@ +# flush-early-job-log - Ensure cached output from jobs that finish +# before the disk is writeable are flushed to disk as soon as it does +# becomes writeable. + +description "flush early job output to logs" + +task + +start on filesystem + +exec initctl notify-disk-writeable --- upstart-1.10.orig/debian/source/format +++ upstart-1.10/debian/source/format @@ -0,0 +1 @@ +1.0 --- upstart-1.10.orig/debian/source/options +++ upstart-1.10/debian/source/options @@ -0,0 +1 @@ +--extend-diff-ignore=.*.gmo --- upstart-1.10.orig/debian/manpages/upstart-events.7 +++ upstart-1.10/debian/manpages/upstart-events.7 @@ -0,0 +1,516 @@ +'\" t +.TH upstart-events 7 2011-03-24 upstart +.\" +.SH NAME +upstart-events \- Well-known Upstart events summary +.\" +.SH Event Summary + +This manual page summarizes well-known events generated by Upstart +running both as the +.BR init (8) +daemon (process ID 1) and a Session Init (process that supervises a user +session). + +It is not an exhaustive list of all possible events, but rather details +a standard set of events expected to be generated on any Ubuntu system +running Upstart. + +The primary tables, \fBTable 1\fP and \fBTable 2\fP, encode the +well-known system and session events respectively, along with the type +of each event (listed in \fBTable 3\fP), the emitter of the event (see +\fBTable 4\fP) and the approximate time at which the event could be +generated. Additionally, the \fINote\fP column indexes into \fBTable +5\fP for further details on a particular event. + +\fBTable 6\fP shows job goals and possible state transitions. See the +.B status +command in +.BR initctl (8) +for further details. + +Note that some events listed in +.B Table 1 +.I may +be available to session jobs (depending on when the Session Init +starts). Those events that are available will be prefixed with +\fI:sys:\fR. See +.BR upstart\-event\-bridge (8) +for further details. + +The \fIRef\fP (Reference) column is used to refer to individual +events succinctly in the \fITime\fP column. + +Note that the \(aq<\(aq and \(aq>\(aq characters in the \fITime\fP column denote +that the event in the \fIEvent\fP column occurs respectively before or +after the event specified in the \fITime\fP column (for example, the +\fBmounting\fP(7) event occurs "at some time" after the \fBstartup\fP(7) +event, and the \fBvirtual\-filesystems\fP(7) event occurs after the last +\fBmounted\fP(7) event relating to a virtual filesystem has been emitted). + +For further details on events, consult the manual pages and the system +job configuration files, usually located in \fI/etc/init\fP. +.\" + +.\" Flush-left to allow table to be viewed on 80-col display without +.\" wrapping. +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +.sp 1 +\fBTable 1: Well-Known System Events Summary.\fP +.TS +box, tab (@); +c | c | c | c | c | c +c | l | c | c | l | c. +Ref@Event@Type@Emit@Time@Note += + @\fBall\-swaps\fP@S@M@> (5)@ + @\fBcontrol\-alt\-delete\fP(7)@S@A@> (5)@A + @container@S@C@> \fI/run\fP mounted@Q + @dbus\-activation@S@B@> D\-Bus client request@ + @deconfiguring\-networking@H@V@< non-local IFs down@P + @desktop\-session\-start@H@D@> \fBX\fP(7) session created@B + @desktop\-shutdown@H@D@> \fBX\fP(7) session ended@O + @device\-not\-ready@H@M@> (2)@N + @drm\-device\-added@S@U@> (5)@C + @failsafe\-boot@S@X@> (7) and local IF@S + @file@S@K@> (1)@U +7@\fBfilesystem\fP@S@M@After last (1)@D + @graphics\-device\-added@S@U@> (5)@C + @\fBkeyboard\-request\fP(7)@S@A@> (5)@E + @\fBlocal\-filesystems\fP(7)@S@M@> (6)@ + @login\-session\-start@H@D@< DM running@F +1@\fBmounted\fP(7)@H@M@> associated (2)@G +2@\fBmounting\fP(7)@H@M@> (5)@H +3@net\-device\-added@S@U@> (5)@C + @net\-device\-changed@S@U@> (5)@C + @net\-device\-down@S@F@< (4)@C +4@net\-device\-removed@S@U@> (5)@C + @net\-device\-up@S@F,N@> (3)@C + @not\-container@S@C@> \fI/run\fP mounted@Q + @\fBpower\-\%status\-\%changed\fP(7)@S@I@> (5)@I + @recovery@S@G@Boot (<5)@R + @\fBremote\-\%filesystems\fP(7)@S@M@> (6)@ + @\fBrunlevel\fP(7)@M@T@> (7) + (8)@ + @\fBsocket\fP(7)@S@S@> socket connection@ +5@\fBstartup\fP(7)@S@I@Boot@J + @\fBstarted\fP(7)@S@I@> job started@K + @\fBstarting\fP(7)@H@I@< job starts@K + 8@static\-network\-up@S@N@> last static IF up@ + @\fBstopped\fP(7)@S@I@> job stopped@K + @\fBstopping\fP(7)@H@I@< job stops@K + @T{ +unmounted\-\:remote\-\:filesystems +T}@H@V@T{ +> last remote FS unmounted +T}@L +6@\fBvirtual\-\:filesystems\fP(7)@S@M@> last virtual FS (1)@M +.TE +.po \n[old_po] +.in \n[old_in] +.P +Key: + \(aqDM\(aq is an abbreviation for Display Manager. + \(aqFS\(aq is an abbreviation for filesystem. + \(aqIF\(aq is an abbreviation for Network Interface. + +.\" Flush-left to allow table to be viewed on 80-col display without +.\" wrapping. +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +.sp 1 +\fBTable 2: Well-Known User Events Summary.\fP +.TS +box, tab (@); +c | c | c | c | c | c +c | l | c | c | l | c. +Ref@Event@Type@Emit@Time@Note += + @\fBdesktop\-end\fP(7)@S@J@< (2)@ + @\fBdesktop\-start\fP(7)@H@J@> (3)@ + @file@S@K@> (1)@U +2@\fBsession\-end\fP(7)@M@I@< Session Init end@ +1@\fBstartup\fP(7)@S@I@> Session Init start@J + @:sys:*@S@E@> \fBupstart\-event\-bridge\fP(8) start@ + @:sys:restarted@S@E@> \fBupstart\-event\-bridge\fP(8) start@V +3@xsession@M@H@> (1)@T +.TE +.po \n[old_po] +.in \n[old_in] + +.\" +.P +.sp 1 +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +\fBTable 3: Event Types.\fP +.TS +box, tab (@); +c | l |l +c | l |l. +Ref@Event Type@Notes += +H@Hook@T{ +Blocking. Waits for events that \fBstart on\fP or \fBstop on\fP this +event. +T} +M@Method@Blocking task. +S@Signal@Non-blocking. +.TE +.po \n[old_po] +.in \n[old_in] + +.\" +.P +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +.sp 1 +\fBTable 4: Event Emitters.\fP +.TS +box, tab (@); +c | l |l +c | l |l. +Ref@Emitter@Notes += +A@System Administrator (initiator)@Technically emitted by init(8). +B@\fBdbus\-daemon\fP(1)@Run with "\fI\-\-activation=upstart"\fP +C@container\-detect job@ +D@Display Manager@e.g. lightdm/gdm/kdm/xdm. +E@\fBupstart\-event\-bridge\fP(8)@ +F@\fBifup\fP(8) or \fBifdown\fP(8)@See \fI/etc/network/\fP. +G@bootloader or initramfs@ +H@xsession\-init session job@ +I@\fBinit\fP(8)@Either PID 1 or a Session Init. +J@job that starts desktop@gnome\-session job for Ubuntu. +K@\fBupstart\-file\-bridge\fP(8)@ +M@\fBmountall\fP(8)@ +N@network\-interface job@ +S@\fBupstart\-socket\-bridge\fP(8)@ +T@\fBtelinit\fP(8), \fBshutdown\fP(8)@ +U@\fBupstart\-udev\-bridge\fP(8)@ +V@System V init system@ +X@failsafe job@ +.TE +.po \n[old_po] +.in \n[old_in] + +.\" +.P +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +\fBTable 5: Event Summary Notes.\fP +.TS +box, tab (@); +c | l +c | l. +Note@Detail += +A@T{ +Requires administrator to press Control-Alt-Delete key +combination on the console. +T} +B@Event generated when user performs graphical login. +C@T{ +These are specific examples. \fBupstart\-udev\-bridge\fP(8) will emit +events which match the pattern, "\fIS\fP\-device\-\fIA\fP" where +\(aqS\(aq is the udev \fIsubsystem\fP and \(aqA\(aq is the udev \fIaction\fP. See +\fBudev\fP(7) and for further details. If you have sysfs +mounted, you can look in \fI/sys/class/\fP for possible values for subsystem. +T} +D@Note this is in the singular - there is no \(aqfilesystems\(aq event. +E@T{ +Emitted when administrator presses Alt-UpArrow key combination on +the console. +T} +F@T{ +Denotes Display Manager running (about to be displayed), but no users +logged in yet. +T} +G@Generated for each mount that completes successfully. +H@T{ +Emitted when mount attempt for single entry from \fBfstab\fP(5) +for any filesystem type is about to begin. +T} +I@Emitted when Upstart receives the SIGPWR signal. +J@Initial event (system or Session Init). +K@T{ +Although the events are emmitted by \fBinit\fP(8), the instigator may be +\fBinitctl\fP(8) if a System Administrator has manually started or +stopped a job. +T} +L@\fI/etc/init/umountnfs.sh\fP. +M@Emitted when all virtual filesystems (such as \fI/proc\fR) mounted. +N@T{ +Emitted when the \fI\-\-dev\-wait\-time\fP timeout is exceeded for +\fBmountall\fP(8). This defaults to 30 seconds. +T} +O@T{ +Emitted when the \fIX\fP(7) display manager exits at shutdown or reboot, to +hand off to the shutdown splash manager. +T} +P@T{ +Emitted by /etc/init.d/networking just prior to stopping all non-local +network interfaces. +T} +Q@T{ +Either \(aqcontainer\(aq or \(aqnot-container\(aq is emitted (depending +on the environment), but not both. +T} +R@T{ +Emitted by either the initramfs or bootloader (for example grub) as the \fIinitial\fP +event (rather than \fBstartup\fP(7)) to denote the system has booted into +recovery mode. If recovery was successful, the standard \fBstartup\fP(7) +event is \fIthen\fP emitted, allowing the system to boot as normal. +T} +S@T{ +Emitted to indicate the system has failed to boot within the expected +time. This event will trigger other jobs to forcibly attempt to bring +the system into a usable state. +T} +T@Only emitted for a graphical session. +U@See \fBfile\-event\fP(7). +V@T{ +This is a pseudo-system event emitted directly by the +.BR upstart\-event\-bridge (8) "" . +T} +.TE +.po \n[old_po] +.in \n[old_in] + +.\" ------------------------------------------------------------ +.SH Job States + +.\" +.P +.sp 1 +.nr old_po .po +.nr old_in .in +.po 0 +.in 0 +\fBTable 6: Job Goals and State Transitions.\fP +.TS +box,tab(@); +c | c s +c | c s +c | c | c +c | l l. + @Goal + @_ +Current State @start @ stop += +waiting @ starting @ n/a +starting @ pre\-start @ stopping +pre\-start @ spawned @ stopping +spawned @ post\-start @ stopping +post\-start @ running @ stopping +running @ stopping @ pre\-stop / stopping (*) +pre\-stop @ running @ stopping +stopping @ killed @ killed +killed @ post\-stop @ post\-stop +post\-stop @ starting @ waiting +.TE +.po \n[old_po] +.in \n[old_in] +.P +Key: + (*) If there is a \fBscript\fP or \fBexec\fP section and this process is running, + state will be \(aqpre\-stop\(aq, else it will be \(aqstopping\(aq. + +.\" ------------------------------------------------------------ +.SH Job Lifecycle +.\" +.\" ------------------------------ +.SS Starting a Job + +.nr step 1 1 +.\" +.IP \n[step] 3 +Initially the job is "at rest" with a goal of \(aqstop\(aq +and a state of \(aqwaiting\(aq (shown as \(aqstop/waiting\(aq by the +.BR initctl (8) +.B list +and +.B status +commands). +.\" +.IP \n+[step] 3 +The goal is changed from \(aqstop\(aq to +\(aqstart\(aq indicating the job is attempting to start. +.\" +.IP \n+[step] 3 +The state is changed from \(aqwaiting\(aq to +\(aqstarting\(aq. +.\" +.IP \n+[step] 3 +The \fBstarting\fP(7) event is emitted denoting the job is +"about to start". +.\" +.IP \n+[step] 3 +Any jobs whose \(aqstart on\(aq (or \(aqstop on\(aq) condition would be satisfied +by this job starting are started (or stopped respectively). +.\" +.IP \n+[step] 3 +The \fBstarting\fP(7) event completes. +.\" +.IP \n+[step] 3 +The state is changed from \(aqstarting\(aq to \(aqpre\-start\(aq. +.\" +.IP \n+[step] 3 +If the \fBpre\-start\fP stanza exists, the pre\-start process is +spawned. +.\" +.IP \n+[step] 3 +If the pre\-start process fails, the goal is changed from +\(aqstart\(aq to \(aqstop\(aq, and the +.BR stopping(7) +and +.BR stopped(7) +events are emitted with appropriate variables set denoting the error. +.\" +.IP \n+[step] 3 +Assuming the pre\-start did not fail or did not call "stop", the main +process is spawned. +.\" +.IP \n+[step] 3 +The state is changed from \(aqpre\-start\(aq to \(aqspawned\(aq. +.\" +.IP \n+[step] 3 +Upstart then ascertains the \fIfinal\fP PID for the job which may be a +descendent of the immediate child process if \fBexpect fork\fP or +\fBexpect daemon\fP has been specified. +.\" +.IP \n+[step] 3 +The state is changed from \(aqspawned\(aq to \(aqpost\-start\(aq. +.\" +.IP \n+[step] 3 +If the \fBpost\-start\fP stanza exists, the post\-start process is +spawned. +.\" +.IP \n+[step] 3 +The state is changed from \(aqpost\-start\(aq to \(aqrunning\(aq. +.\" +.IP \n+[step] 3 +The \fBstarted\fP(7) event is emitted. +.sp 1 +For services, when this event completes the main process will now be fully +running. If the job refers to a task, it will now have completed +(successfully or otherwise). +.\" +.IP \n+[step] 3 +Any jobs whose \(aqstart on\(aq (or \(aqstop on\(aq) condition would be satisfied +by this job being started are started (or stopped respectively). + +.\" ------------------------------ +.SS Stopping a Job + +.nr step 1 1 +.\" +.IP \n[step] 3 +Assuming the job is fully running, it will have a goal of \(aqstart\(aq +and a state of \(aqrunning\(aq (shown as \(aqstart/running\(aq by the +.BR initctl (8) +.B list +and +.B status +commands). +.\" +.IP \n+[step] 3 +The goal is changed from \(aqstart\(aq to \(aqstop\(aq indicating the +job is attempting to stop. +.\" +.IP \n+[step] 3 +The state is changed from \(aqrunning\(aq to +\(aqpre\-stop\(aq. +.\" +.IP \n+[step] 3 +If the \fBpre\-stop\fP stanza exists, the pre\-stop process is +spawned. +.\" +.IP \n+[step] 3 +The state is changed from \(aqpre\-stop\(aq to \(aqstopping\(aq. +.\" +.IP \n+[step] 3 +The \fBstopping\fP(7) event is emitted. +.\" +.IP \n+[step] 3 +Any jobs whose \(aqstart on\(aq (or \(aqstop on\(aq) condition would be satisfied by this +job stopping are started (or stopped respectively). +.\" +.IP \n+[step] 3 +The main process is stopped: +.RS +.nr step2 1 1 +.af step2 i +.IP \n[step2] 3 +The signal specified by the +.B kill signal +stanza is sent to the process group of the main process +(such that all processes belonging to the jobs main process are killed). +By default this signal is +.BR SIGTERM "." +.sp 1 +See \fBsignal\fP(7) and \fBinit\fP(5). +.IP \n+[step2] 3 +Upstart waits for up to "kill timeout" seconds (default 5 seconds) for +the process to end. +.IP \n+[step2] 3 +If the process is still running after the timeout, a +.B SIGKILL +signal is sent to the process which cannot be ignored and will forcibly +stop the processes in the process group. +.RE +.\" +.IP \n+[step] 3 +The state is changed from \(aqkilled\(aq to \(aqpost\-stop\(aq. +.\" +.IP \n+[step] 3 +If the \fBpost\-stop\fP stanza exists, the post\-stop process is +spawned. +.\" +.IP \n+[step] 3 +The state is changed from \(aqpost\-stop\(aq to \(aqwaiting\(aq. +.\" +.IP \n+[step] 3 +The \fBstopped\fP(7) event is emitted. +.sp 1 +When this event completes, the job is fully stopped. +.\" +.IP \n+[step] 3 +Any jobs whose \(aqstart on\(aq (or \(aqstop on\(aq) condition would be satisfied +by this job being stopped are started (or stopped respectively). + +.SH AUTHOR +Manual page written by James Hunt +.RB < james.hunt@ubuntu.com > +.\" +.SH REPORTING BUGS +Report bugs at +.RB < https://launchpad.net/ubuntu/+source/upstart/+bugs > +.\" +.SH COPYRIGHT +Copyright \(co 2011-2013 Canonical Ltd. +.br +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +.\" +.SH SEE ALSO +.BR init (5) +.BR init (8) +.BR initctl (8) +.BR mountall (8) +.BR started (7) +.BR starting (7) +.BR stopped (7) +.BR stopping (7) +.BR telinit (8) +.BR upstart\-event\-bridge (8) --- upstart-1.10.orig/debian/user-conf/xsession-init.conf +++ upstart-1.10/debian/user-conf/xsession-init.conf @@ -0,0 +1,13 @@ +description "XSession handling" +author "Stéphane Graber " + +start on startup +emits xsession + +pre-start script + [ -z "$DESKTOP_SESSION" ] && stop || true +end script + +script + exec initctl emit xsession SESSION=$DESKTOP_SESSION SESSIONTYPE=$SESSIONTYPE +end script --- upstart-1.10.orig/debian/user-conf/logrotate.conf +++ upstart-1.10/debian/user-conf/logrotate.conf @@ -0,0 +1,55 @@ +# logrotate - rotate Upstart job log files to conserve disk space. +# +# Currently runs automatically 1 minute after session starts (to give +# jobs a chance to settle). However, can be run manually any time using +# 'start logrotate' to force logs to be rotated in low-disk space +# scenarios. + +description "Rotate job log files" + +start on startup + +pre-start script + +logrotate=$(command -v logrotate) + +# logrotate is not installed +[ -z "$logrotate" ] && exit 0 + +# started by event, so run logrotate normally +[ -n "$UPSTART_EVENTS" ] && exit 0 + +# started manually, so force a rotation +initctl set-env FORCE=--force + +end script + +script + +# started by event, so allow time for main jobs to settle +[ -n "$UPSTART_EVENTS" ] && sleep 60 + +statedir=${XDG_CACHE_HOME:-$HOME/.cache}/logrotate +statefile="$statedir/status" + +logdir=${XDG_CACHE_HOME:-$HOME/.cache}/upstart + +mkdir -p "$statedir" || : +mkdir -p "$logdir" || : + +conf=$(mktemp) + +cat <$conf +"$logdir/*.log" { + daily + missingok + rotate 7 + compress + notifempty + nocreate +} +EOF + +logrotate $FORCE -s "$statefile" "$conf" || : +rm -f "$conf" +end script --- upstart-1.10.orig/debian/tests/control +++ upstart-1.10/debian/tests/control @@ -0,0 +1,3 @@ +Tests: force +Depends: @, dbus +Restrictions: needs-root build-needed --- upstart-1.10.orig/debian/tests/test_setup +++ upstart-1.10/debian/tests/test_setup @@ -0,0 +1,25 @@ +#--------------------------------------------------------------------- +# Source this file in all tests +#--------------------------------------------------------------------- + +# user provided by auto-package-testing environment +user=ubuntu + +#------------------------------ +# Assertions + +# We must be running as root initially to perform setup +test $(id -u) -eq 0 || { echo "ERROR: not root"; exit 1; } + +# User must exist +getent passwd $user >/dev/null 2>&1 || \ + { echo "ERROR: no user '$user'"; exit 1; } + +#------------------------------ +# Init + +# we need to run as root, but that means all unpacked files are owned by +# root too. +chown -R ${user}: . .. + +#--------------------------------------------------------------------- --- upstart-1.10.orig/debian/tests/force +++ upstart-1.10/debian/tests/force @@ -0,0 +1,13 @@ +#!/bin/sh -e +#--------------------------------------------------------------------- +# Dummy DEP-8 test that does nothing. The reason for having it though +# is to force auto-package-test to build Upstart and thus run its test +# suite. This is not strictly necessary (as we already run it on all +# architectures as part of the package build), running the tests in +# the the virtualised auto-package-test environment (different to the +# buildd environment) has shaken out a few bugs in the past. +#--------------------------------------------------------------------- + +. $(dirname $0)/test_setup + +exit 0 --- upstart-1.10.orig/util/Makefile.in +++ upstart-1.10/util/Makefile.in @@ -85,8 +85,7 @@ check_PROGRAMS = $(am__EXEEXT_1) subdir = util DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(dist_man_MANS) \ - $(top_srcdir)/test-driver + $(top_srcdir)/depcomp $(dist_man_MANS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ @@ -290,161 +289,6 @@ std=''; \ fi; \ } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_COMPLIANCE_CHECKER = @ABI_COMPLIANCE_CHECKER@ ACLOCAL = @ACLOCAL@ @@ -536,6 +380,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -758,7 +604,7 @@ $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +.SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1186,189 +1032,98 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ else \ - color_start= color_end=; \ + skipped="($$skip tests were not run)"; \ fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_PROGRAMS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test_initctl.log: test_initctl$(EXEEXT) - @p='test_initctl$(EXEEXT)'; \ - b='test_initctl'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_utmp.log: test_utmp$(EXEEXT) - @p='test_utmp$(EXEEXT)'; \ - b='test_utmp'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_sysv.log: test_sysv$(EXEEXT) - @p='test_sysv$(EXEEXT)'; \ - b='test_sysv'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_telinit.log: test_telinit$(EXEEXT) - @p='test_telinit$(EXEEXT)'; \ - b='test_telinit'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -1431,9 +1186,6 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -1540,9 +1292,9 @@ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic maintainer-clean-local mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am recheck tags tags-am uninstall \ - uninstall-am uninstall-hook uninstall-man uninstall-man7 \ - uninstall-man8 uninstall-sbinPROGRAMS + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-hook uninstall-man uninstall-man7 uninstall-man8 \ + uninstall-sbinPROGRAMS $(com_ubuntu_Upstart_OUTPUTS): $(com_ubuntu_Upstart_XML) --- upstart-1.10.orig/util/tests/test_initctl.c +++ upstart-1.10/util/tests/test_initctl.c @@ -11125,6 +11125,7 @@ { char confdir[PATH_MAX]; char logdir[PATH_MAX]; + char pid_file[PATH_MAX]; char sessiondir[PATH_MAX]; nih_local char *cmd = NULL; pid_t upstart_pid = 0; @@ -11135,6 +11136,8 @@ nih_local NihDBusProxy *upstart = NULL; nih_local char *orig_xdg_runtime_dir = NULL; nih_local char *session_file = NULL; + nih_local char *job = NULL; + pid_t job_pid; TEST_GROUP ("Session Init quiesce"); @@ -11204,21 +11207,64 @@ TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running"); + TEST_NE (job_pid, -1); + /* Trigger shutdown */ assert0 (kill (upstart_pid, SIGTERM)); /* Force reset */ test_user_mode = FALSE; - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + /* Wait for longer than we expect the Session Init to take to + * shutdown to give it time to send SIGKILL to all job + * processes. This is unrealistic, but safer for the tests since + * the exact behaviour can be checked. + * + * In reality, the following steps either side of the markers *will* + * occur and those within the markers *may* occur: + * + * 1) A System Shutdown is triggered. + * 2) The Display Manager receives SIGTERM. + * 3) The Display Manager sends SIGTERM to all its clients. + * (including the Session Init). + * 4) The Session Init sends SIGTERM to all running job + * processes. + * + * --- :XXX: START MARKER :XXX: --- + * + * 5) The Session Init will attempt to wait for + * MAX(kill_timeout) seconds. + * 6) The Session Init will send all running job processes + * SIGKILL. + * 7) The Session Init will wait for all remaining job processes + * to end. + * 8) The Session Init will exit. + * + * --- :XXX: END MARKER :XXX: --- + * + * 9) The Display Manager sends SIGKILL to all its clients. + * 10) If still running, the Session Init is killed and exits. + * + * The problem is that the Session Init cannot know when the + * Display Manager will kill *it* so it may be that the Session + * Init cannot send SIGKILL to each job process instead relying + * on the System Init to clean up. + */ + TEST_EQ (timed_waitpid (upstart_pid, 1+TEST_QUIESCE_KILL_PHASE), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + DELETE_FILE (confdir, "long-running.conf"); /*******************************************************************/ @@ -11243,33 +11289,45 @@ TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running-term"); + TEST_NE (job_pid, -1); + /* Trigger shutdown */ assert0 (kill (upstart_pid, SIGTERM)); /* Force reset */ test_user_mode = FALSE; - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, 1+TEST_QUIESCE_KILL_PHASE), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + DELETE_FILE (confdir, "long-running-term.conf"); /*******************************************************************/ TEST_FEATURE ("system shutdown: one job which starts on session-end"); - CREATE_FILE (confdir, "session-end.conf", - "start on session-end\n" - "\n" - "script\n" - " echo hello\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " echo hello\n" + " echo $$ >\"%s\"\n" + " exec sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11282,10 +11340,11 @@ /* Force reset */ test_user_mode = FALSE; - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, 1+TEST_QUIESCE_KILL_PHASE), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); logfile = NIH_MUST (nih_sprintf (NULL, "%s/%s", logdir, @@ -11302,19 +11361,36 @@ sessiondir, (int)upstart_pid)); unlink (session_file); + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* pid should be running since Upstart won't have signalled it + * to stop (since it started as a result of session-end being + * emitted _after_ the job pids were sent SIGTERM). + */ + TEST_EQ (kill (job_pid, SIGKILL), 0); + + assert0 (unlink (pid_file)); + DELETE_FILE (confdir, "session-end.conf"); /*******************************************************************/ TEST_FEATURE ("system shutdown: one job which starts on session-end and ignores SIGTERM"); - CREATE_FILE (confdir, "session-end-term.conf", - "start on session-end\n" - "\n" - "script\n" - " trap '' TERM\n" - " echo hello\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " trap '' TERM\n" + " echo hello\n" + " echo $$ >\"%s\"\n" + " exec sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end-term.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11327,10 +11403,11 @@ /* Force reset */ test_user_mode = FALSE; - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, 1+TEST_QUIESCE_KILL_PHASE), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); logfile = NIH_MUST (nih_sprintf (NULL, "%s/%s", logdir, @@ -11347,6 +11424,17 @@ sessiondir, (int)upstart_pid)); unlink (session_file); + /* kill job pid if not already dead */ + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* pid should still be running */ + TEST_EQ (kill (job_pid, SIGKILL), 0); + + assert0 (unlink (pid_file)); + DELETE_FILE (confdir, "session-end-term.conf"); /*******************************************************************/ @@ -11357,17 +11445,20 @@ CREATE_FILE (confdir, "long-running-term.conf", "script\n" " trap '' TERM\n" - " sleep 999\n" + " exec sleep 999\n" "end script"); - CREATE_FILE (confdir, "session-end-term.conf", - "start on session-end\n" - "\n" - "script\n" - " trap '' TERM\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " trap '' TERM\n" + " echo $$ >\"%s\"\n" + " exec sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end-term.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11382,21 +11473,39 @@ TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running-term"); + TEST_NE (job_pid, -1); + /* Trigger shutdown */ assert0 (kill (upstart_pid, SIGTERM)); /* Force reset */ test_user_mode = FALSE; - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, 1+TEST_QUIESCE_KILL_PHASE), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); + /* the long-running job pid should no longer exist */ + kill (job_pid, SIGKILL); + TEST_EQ (errno, ESRCH); + + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* .... but the session-end job pid should still be running */ + TEST_EQ (kill (job_pid, SIGKILL), 0); + + assert0 (unlink (pid_file)); + DELETE_FILE (confdir, "long-running-term.conf"); DELETE_FILE (confdir, "session-end-term.conf"); @@ -11449,6 +11558,9 @@ TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running"); + TEST_NE (job_pid, -1); + upstart = upstart_open (NULL); TEST_NE_P (upstart, NULL); @@ -11465,14 +11577,62 @@ /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + DELETE_FILE (confdir, "long-running.conf"); /*******************************************************************/ + TEST_FEATURE ("session shutdown: one long-running job which starts on startup"); + + CREATE_FILE (confdir, "startup.conf", + "start on startup\n" + "exec sleep 999"); + + start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); + + upstart = upstart_open (NULL); + TEST_NE_P (upstart, NULL); + + /* Should be running */ + assert0 (kill (upstart_pid, 0)); + + job_pid = job_to_pid ("startup"); + TEST_NE (job_pid, -1); + + /* Force reset */ + test_user_mode = FALSE; + + /* Trigger session shutdown */ + assert0 (upstart_end_session_sync (NULL, upstart)); + + /* Session Init should end very quickly since there will be no + * wait phase. + */ + TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + + /* Should not now be running */ + TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); + + session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", + sessiondir, (int)upstart_pid)); + unlink (session_file); + + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + + DELETE_FILE (confdir, "startup.conf"); + + /*******************************************************************/ TEST_FEATURE ("session shutdown: one long-running job which ignores SIGTERM"); CREATE_FILE (confdir, "long-running-term.conf", @@ -11484,13 +11644,16 @@ start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); cmd = nih_sprintf (NULL, "%s start %s 2>&1", - get_initctl (), "long-running"); + get_initctl (), "long-running-term"); TEST_NE_P (cmd, NULL); RUN_COMMAND (NULL, cmd, &output, &lines); TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running-term"); + TEST_NE (job_pid, -1); + upstart = upstart_open (NULL); TEST_NE_P (upstart, NULL); @@ -11507,23 +11670,32 @@ /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); + TEST_EQ (errno, ESRCH); session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + DELETE_FILE (confdir, "long-running-term.conf"); /*******************************************************************/ TEST_FEATURE ("session shutdown: one job which starts on session-end"); - CREATE_FILE (confdir, "session-end.conf", - "start on session-end\n" - "\n" - "script\n" - " echo hello\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " echo hello\n" + " echo $$ >\"%s\"\n" + " exec sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11539,7 +11711,7 @@ /* Trigger session shutdown */ assert0 (upstart_end_session_sync (NULL, upstart)); - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_TOTAL_WAIT_TIME), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); @@ -11555,6 +11727,17 @@ TEST_EQ (fclose (file), 0); assert0 (unlink (logfile)); + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + + assert0 (unlink (pid_file)); + session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); @@ -11564,14 +11747,18 @@ /*******************************************************************/ TEST_FEATURE ("session shutdown: one job which starts on session-end"); - CREATE_FILE (confdir, "session-end-term.conf", - "start on session-end\n" - "\n" - "script\n" - " trap '' TERM\n" - " echo hello\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " trap '' TERM\n" + " echo hello\n" + " echo $$ >\"%s\"\n" + " exec sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end-term.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11587,7 +11774,7 @@ /* Trigger session shutdown */ assert0 (upstart_end_session_sync (NULL, upstart)); - TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_KILL_PHASE), upstart_pid); + TEST_EQ (timed_waitpid (upstart_pid, TEST_QUIESCE_TOTAL_WAIT_TIME), upstart_pid); /* Should not now be running */ TEST_EQ (kill (upstart_pid, 0), -1); @@ -11603,6 +11790,17 @@ TEST_EQ (fclose (file), 0); assert0 (unlink (logfile)); + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + + assert0 (unlink (pid_file)); + session_file = NIH_MUST (nih_sprintf (NULL, "%s/upstart/sessions/%d.session", sessiondir, (int)upstart_pid)); unlink (session_file); @@ -11620,13 +11818,17 @@ " sleep 999\n" "end script"); - CREATE_FILE (confdir, "session-end-term.conf", - "start on session-end\n" - "\n" - "script\n" - " trap '' TERM\n" - " sleep 999\n" - "end script"); + TEST_FILENAME (pid_file); + + job = NIH_MUST (nih_sprintf (NULL, "start on session-end\n" + "\n" + "script\n" + " trap '' TERM\n" + " echo $$ >\"%s\"\n" + " sleep 999\n" + "end script", pid_file)); + + CREATE_FILE (confdir, "session-end-term.conf", job); start_upstart_common (&upstart_pid, TRUE, confdir, logdir, NULL); @@ -11638,6 +11840,9 @@ TEST_EQ (lines, 1); nih_free (output); + job_pid = job_to_pid ("long-running-term"); + TEST_NE (job_pid, -1); + upstart = upstart_open (NULL); TEST_NE_P (upstart, NULL); @@ -11659,6 +11864,21 @@ sessiondir, (int)upstart_pid)); unlink (session_file); + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + + file = fopen (pid_file, "r"); + TEST_NE_P (file, NULL); + TEST_EQ (fscanf (file, "%d", &job_pid), 1); + fclose (file); + + /* pid should no longer exist */ + TEST_EQ (kill (job_pid, SIGKILL), -1); + TEST_EQ (errno, ESRCH); + + assert0 (unlink (pid_file)); + DELETE_FILE (confdir, "long-running-term.conf"); DELETE_FILE (confdir, "session-end-term.conf"); --- upstart-1.10.orig/util/tests/test_utmp.c +++ upstart-1.10/util/tests/test_utmp.c @@ -857,14 +857,6 @@ gettimeofday (&tv, NULL); record.ut_tv.tv_sec = tv.tv_sec; record.ut_tv.tv_usec = tv.tv_usec; - /* utmp/wtmp records do not have nanosecond resolution - * yet the tests expect time to lapse, but it might not - * on very, very fast machines. - * https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-adt-upstart/ - * Is there a better way to fix the tests? - */ - usleep(200); - utmpxname (utmp_file); setutxent (); @@ -873,6 +865,14 @@ updwtmpx (wtmp_file, &record); + /* utmp/wtmp records do not have nanosecond resolution + * yet the tests expect time to lapse, but it might not + * on very, very fast machines. + * https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-adt-upstart/ + * Is there a better way to fix the tests? + */ + usleep (200); + ret = utmp_write_runlevel (utmp_file, wtmp_file, '5', '2'); TEST_EQ (ret, 0); @@ -970,6 +970,13 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); ret = utmp_write_runlevel (utmp_file, wtmp_file, '2', 'S'); @@ -1077,6 +1084,13 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); ret = utmp_write_runlevel (utmp_file, wtmp_file, '2', 'S'); @@ -1349,6 +1363,14 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); + ret = utmp_write_shutdown (utmp_file, wtmp_file); TEST_EQ (ret, 0); --- upstart-1.10.orig/scripts/Makefile.in +++ upstart-1.10/scripts/Makefile.in @@ -298,6 +298,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/scripts/data/Makefile.in +++ upstart-1.10/scripts/data/Makefile.in @@ -236,6 +236,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/lib/Makefile.in +++ upstart-1.10/lib/Makefile.in @@ -85,8 +85,7 @@ subdir = lib DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/libupstart.pc.in.in $(top_srcdir)/depcomp \ - $(include_HEADERS) $(upstartinclude_HEADERS) \ - $(top_srcdir)/test-driver + $(include_HEADERS) $(upstartinclude_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ @@ -246,161 +245,6 @@ std=''; \ fi; \ } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_COMPLIANCE_CHECKER = @ABI_COMPLIANCE_CHECKER@ ACLOCAL = @ACLOCAL@ @@ -492,6 +336,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -663,7 +509,7 @@ $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +.SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -936,168 +782,98 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ else \ - color_start= color_end=; \ + skipped="($$skip tests were not run)"; \ fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_PROGRAMS) $(check_SCRIPTS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test_libupstart.log: test_libupstart$(EXEEXT) - @p='test_libupstart$(EXEEXT)'; \ - b='test_libupstart'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -1161,9 +937,6 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -1267,9 +1040,9 @@ installdirs maintainer-clean maintainer-clean-generic \ maintainer-clean-local mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - recheck tags tags-am uninstall uninstall-am \ - uninstall-includeHEADERS uninstall-libLTLIBRARIES \ - uninstall-pkgconfigDATA uninstall-upstartincludeHEADERS + tags tags-am uninstall uninstall-am uninstall-includeHEADERS \ + uninstall-libLTLIBRARIES uninstall-pkgconfigDATA \ + uninstall-upstartincludeHEADERS upstart/upstart-dbus.h: \ --- upstart-1.10.orig/contrib/Makefile.in +++ upstart-1.10/contrib/Makefile.in @@ -206,6 +206,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/dbus/Makefile.in +++ upstart-1.10/dbus/Makefile.in @@ -237,6 +237,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/test/test_util_common.h +++ upstart-1.10/test/test_util_common.h @@ -10,7 +10,7 @@ #define BUFFER_SIZE 1024 /** - * TEST_QUIESCE_WAIT_PHASE: + * TEST_EXIT_TIME: * * Maximum time we expect upstart to wait in the QUIESCE_PHASE_WAIT * phase. @@ -733,4 +733,7 @@ const char *from, const char *to) __attribute__ ((warn_unused_result)); +int file_exists (const char *path) + __attribute__ ((warn_unused_result)); + #endif /* TEST_UTIL_COMMON_H */ --- upstart-1.10.orig/test/Makefile.in +++ upstart-1.10/test/Makefile.in @@ -260,6 +260,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/test/test_util_common.c +++ upstart-1.10/test/test_util_common.c @@ -384,7 +384,7 @@ argv = NIH_MUST (nih_str_array_new (NULL)); NIH_MUST (nih_str_array_add (&argv, NULL, NULL, - UPSTART_BINARY)); + get_upstart_binary ())); if (args) NIH_MUST (nih_str_array_append (&argv, NULL, NULL, args)); @@ -447,9 +447,6 @@ } NIH_MUST (nih_str_array_add (&args, NULL, NULL, - "--no-startup-event")); - - NIH_MUST (nih_str_array_add (&args, NULL, NULL, "--no-sessions")); NIH_MUST (nih_str_array_add (&args, NULL, NULL, @@ -561,7 +558,11 @@ const char * get_upstart_binary (void) { - return UPSTART_BINARY; + static const char *upstart_binary = UPSTART_BINARY; + + TEST_TRUE (file_exists (upstart_binary)); + + return upstart_binary; } const char * @@ -740,3 +741,21 @@ return new; } + +/** + * file_exists: + * @path: file to check. + * + * Determine if specified file exists. + * + * Returns: TRUE if @path exists, else FALSE. + **/ +int +file_exists (const char *path) +{ + struct stat st; + + nih_assert (path); + + return ! stat (path, &st); +} --- upstart-1.10.orig/extra/Makefile.in +++ upstart-1.10/extra/Makefile.in @@ -396,6 +396,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/extra/Makefile.am +++ upstart-1.10/extra/Makefile.am @@ -6,9 +6,7 @@ AM_CFLAGS = \ $(NIH_CFLAGS) \ $(NIH_DBUS_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(UDEV_CFLAGS) \ - $(DCONF_CFLAGS) + $(DBUS_CFLAGS) AM_CPPFLAGS = \ -DLOCALEDIR="\"$(localedir)\"" \ @@ -128,6 +126,11 @@ $(DBUS_LIBS) \ $(GIO_LIBS) \ $(DCONF_LIBS) +upstart_dconf_bridge_CFLAGS = \ + $(NIH_CFLAGS) \ + $(NIH_DBUS_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(DCONF_CFLAGS) else EXTRA_DIST += \ upstart-dconf-bridge.c @@ -153,6 +156,11 @@ $(NIH_DBUS_LIBS) \ $(DBUS_LIBS) \ $(UDEV_LIBS) +upstart_udev_bridge_CFLAGS = \ + $(NIH_CFLAGS) \ + $(NIH_DBUS_CFLAGS) \ + $(DBUS_CFLAGS) \ + $(UDEV_CFLAGS) install-data-hook: src=`echo upstart-udev-bridge| sed '$(transform)'`.8; \ --- upstart-1.10.orig/extra/upstart-dbus-bridge.c +++ upstart-1.10/extra/upstart-dbus-bridge.c @@ -513,7 +513,7 @@ if (path) { nih_local char *var = NULL; - var = NIH_MUST (nih_sprintf (NULL, "PATH=%s", path)); + var = NIH_MUST (nih_sprintf (NULL, "OBJPATH=%s", path)); NIH_MUST (nih_str_array_addp (&env, NULL, &env_len, var)); } --- upstart-1.10.orig/extra/man/dbus-event.7 +++ upstart-1.10/extra/man/dbus-event.7 @@ -8,7 +8,7 @@ .BI [ "" BUS\fR= BUS_NAME ] .BI SIGNAL\fR= SIGNAL .BI INTERFACE\fR= INTERFACE -.BI PATH\fR= PATH +.BI OBJPATH\fR= PATH .BI SENDER\fR= SENDER .BI DESTINATION\fR= DESTINATION .BI ARG0\fR= VALUE @@ -43,7 +43,7 @@ .\" .SH EXAMPLES .\" -.IP "start on dbus SIGNAL=NameAcquired INTERFACE=org.freedesktop.DBus PATH=/org/freedesktop/DBus SENDER=org.freedesktop.DBus ARG0=com.mycorp.foo" +.IP "start on dbus SIGNAL=NameAcquired INTERFACE=org.freedesktop.DBus OBJPATH=/org/freedesktop/DBus SENDER=org.freedesktop.DBus ARG0=com.mycorp.foo" Start job when a particular .I NameAcquired D-Bus signal is received. --- upstart-1.10.orig/doc/Makefile.in +++ upstart-1.10/doc/Makefile.in @@ -206,6 +206,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ --- upstart-1.10.orig/init/job_process.c +++ upstart-1.10/init/job_process.c @@ -1259,7 +1259,9 @@ /** * job_process_jobs_running: * - * Determine if any jobs are running. + * Determine if any jobs are running. Note that simply checking if class + * instances exist is insufficient: since this call is used for shutdown + * abstract jobs must not be able to block the shutdown. * * Returns: TRUE if jobs are still running, else FALSE. **/ @@ -1271,8 +1273,17 @@ NIH_HASH_FOREACH (job_classes, iter) { JobClass *class = (JobClass *)iter; - NIH_HASH_FOREACH (class->instances, job_iter) - return TRUE; + NIH_HASH_FOREACH (class->instances, job_iter) { + Job *job = (Job *)job_iter; + nih_local char *cmd = NULL; + int i; + nih_local char *pids = NULL; + + for (i = 0; i < PROCESS_LAST; i++) { + if (job->pid[i]) + return TRUE; + } + } } return FALSE; @@ -1668,10 +1679,18 @@ /* We should always fail the job if the security profile * failed to load */ + + /* Disabled for now to emulate current Ubuntu behaviour + * in /lib/init/apparmor-profile-load to work around bug + * LP: #1058356 + if (status) { failed = TRUE; stop = TRUE; } + + */ + break; case PROCESS_PRE_START: nih_assert (job->state == JOB_PRE_START); --- upstart-1.10.orig/init/apparmor.c +++ upstart-1.10/init/apparmor.c @@ -111,6 +111,18 @@ return FALSE; } + /* Do not load if running in a container. + * This is a distro-specific patch. + */ + if (stat ("/run/container_type", &statbuf) == 0) + return FALSE; + + /* Do not load if running in a Ubuntu live CD. + * This is a distro-specific patch. + */ + if (stat ("/rofs/etc/apparmor.d", &statbuf) == 0) + return FALSE; + return TRUE; } --- upstart-1.10.orig/init/Makefile.in +++ upstart-1.10/init/Makefile.in @@ -83,8 +83,7 @@ check_PROGRAMS = $(am__EXEEXT_1) test_conf$(EXEEXT) subdir = init DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/depcomp $(dist_man_MANS) \ - $(top_srcdir)/test-driver + $(top_srcdir)/depcomp $(dist_man_MANS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ @@ -141,7 +140,7 @@ am__DEPENDENCIES_1 = init_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_test_blocked_OBJECTS = test_blocked.$(OBJEXT) test_blocked_OBJECTS = $(am_test_blocked_OBJECTS) test_blocked_DEPENDENCIES = system.o environ.o process.o job_class.o \ @@ -428,161 +427,6 @@ std=''; \ fi; \ } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI_COMPLIANCE_CHECKER = @ABI_COMPLIANCE_CHECKER@ ACLOCAL = @ACLOCAL@ @@ -674,6 +518,8 @@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ +SELINUX_CFLAGS = @SELINUX_CFLAGS@ +SELINUX_LIBS = @SELINUX_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ @@ -742,6 +588,7 @@ $(NIH_CFLAGS) \ $(NIH_DBUS_CFLAGS) \ $(DBUS_CFLAGS) \ + $(SELINUX_CFLAGS) \ $(JSON_CFLAGS) AM_CPPFLAGS = -DLOCALEDIR="\"$(localedir)\"" \ @@ -801,6 +648,7 @@ $(NIH_LIBS) \ $(NIH_DBUS_LIBS) \ $(DBUS_LIBS) \ + $(SELINUX_LIBS) \ $(JSON_LIBS) \ -lrt @@ -1112,7 +960,7 @@ $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs +.SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1827,287 +1675,98 @@ distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - else \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ else \ - color_start= color_end=; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_LTLIBRARIES) $(check_PROGRAMS) $(check_SCRIPTS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test_system.log: test_system$(EXEEXT) - @p='test_system$(EXEEXT)'; \ - b='test_system'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_environ.log: test_environ$(EXEEXT) - @p='test_environ$(EXEEXT)'; \ - b='test_environ'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_process.log: test_process$(EXEEXT) - @p='test_process$(EXEEXT)'; \ - b='test_process'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_job_class.log: test_job_class$(EXEEXT) - @p='test_job_class$(EXEEXT)'; \ - b='test_job_class'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_job_process.log: test_job_process$(EXEEXT) - @p='test_job_process$(EXEEXT)'; \ - b='test_job_process'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_job.log: test_job$(EXEEXT) - @p='test_job$(EXEEXT)'; \ - b='test_job'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_log.log: test_log$(EXEEXT) - @p='test_log$(EXEEXT)'; \ - b='test_log'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_state.log: test_state$(EXEEXT) - @p='test_state$(EXEEXT)'; \ - b='test_state'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_event.log: test_event$(EXEEXT) - @p='test_event$(EXEEXT)'; \ - b='test_event'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_event_operator.log: test_event_operator$(EXEEXT) - @p='test_event_operator$(EXEEXT)'; \ - b='test_event_operator'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_blocked.log: test_blocked$(EXEEXT) - @p='test_blocked$(EXEEXT)'; \ - b='test_blocked'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_parse_job.log: test_parse_job$(EXEEXT) - @p='test_parse_job$(EXEEXT)'; \ - b='test_parse_job'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_parse_conf.log: test_parse_conf$(EXEEXT) - @p='test_parse_conf$(EXEEXT)'; \ - b='test_parse_conf'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_conf_static.log: test_conf_static$(EXEEXT) - @p='test_conf_static$(EXEEXT)'; \ - b='test_conf_static'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_xdg.log: test_xdg$(EXEEXT) - @p='test_xdg$(EXEEXT)'; \ - b='test_xdg'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_control.log: test_control$(EXEEXT) - @p='test_control$(EXEEXT)'; \ - b='test_control'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_main.log: test_main$(EXEEXT) - @p='test_main$(EXEEXT)'; \ - b='test_main'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test_conf_preload.sh.log: test_conf_preload.sh$(EXEEXT) - @p='test_conf_preload.sh$(EXEEXT)'; \ - b='test_conf_preload.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -2171,9 +1830,6 @@ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) @@ -2277,9 +1933,9 @@ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic maintainer-clean-local mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am recheck tags tags-am uninstall \ - uninstall-am uninstall-man uninstall-man5 uninstall-man7 \ - uninstall-man8 uninstall-sbinPROGRAMS + pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ + uninstall-man uninstall-man5 uninstall-man7 uninstall-man8 \ + uninstall-sbinPROGRAMS $(com_ubuntu_Upstart_OUTPUTS): $(com_ubuntu_Upstart_XML) --- upstart-1.10.orig/init/quiesce.c +++ upstart-1.10/init/quiesce.c @@ -48,9 +48,16 @@ static QuiescePhase quiesce_phase = QUIESCE_PHASE_NOT_QUIESCED; /** + * quiesce_reason: + * + * Human-readable string denoting what triggered the quiesce. + **/ +static char *quiesce_reason = NULL; + +/** * max_kill_timeout: * - * Maxiumum kill_timout value calculated from all running jobs used to + * Maxiumum kill_timeout value calculated from all running jobs used to * determine how long to wait before exiting. **/ static time_t max_kill_timeout = 0; @@ -62,6 +69,24 @@ **/ static time_t quiesce_phase_time = 0; +/** + * quiesce_start_time: + * + * Time quiesce commenced. + **/ +static time_t quiesce_start_time = 0; + +/** + * session_end_jobs: + * + * TRUE if any job specifies a 'start on' including SESSION_END_EVENT. + * + **/ +static int session_end_jobs = FALSE; + +static int quiesce_event_match (Event *event) + __attribute__ ((warn_unused_result)); + /* External definitions */ extern int disable_respawn; @@ -76,7 +101,7 @@ quiesce (QuiesceRequester requester) { nih_local char **env = NULL; - const char *reason; + Event *event; job_class_init (); @@ -98,12 +123,12 @@ ? QUIESCE_PHASE_KILL : QUIESCE_PHASE_WAIT; - reason = (requester == QUIESCE_REQUESTER_SESSION) + quiesce_reason = (requester == QUIESCE_REQUESTER_SESSION) ? _("logout") : _("shutdown"); - nih_info (_("Quiescing due to %s request"), reason); + nih_info (_("Quiescing due to %s request"), quiesce_reason); - quiesce_phase_time = time (NULL); + quiesce_start_time = quiesce_phase_time = time (NULL); /* Stop existing jobs from respawning */ disable_respawn = TRUE; @@ -116,11 +141,43 @@ env = NIH_MUST (nih_str_array_new (NULL)); NIH_MUST (environ_set (&env, NULL, NULL, TRUE, - "TYPE=%s", reason)); + "TYPE=%s", quiesce_reason)); + + event = NIH_MUST (event_new (NULL, SESSION_END_EVENT, env)); - NIH_MUST (event_new (NULL, SESSION_END_EVENT, env)); + /* Check if any jobs care about the session end event. If not, + * the wait phase can be avoided entirely resulting in a much + * faster shutdown. + * + * Note that simply checking if running instances exist is not + * sufficient since if a job cares about the session end event, + * it won't yet have started but needs to be given a chance to + * run. + */ + if (quiesce_phase == QUIESCE_PHASE_WAIT) { + + session_end_jobs = quiesce_event_match (event); - if (requester == QUIESCE_REQUESTER_SYSTEM) { + if (session_end_jobs) { + /* Some as-yet unscheduled jobs care about the + * session end event. They will be started the + * next time through the main loop and will be + * waited for (hence the quiesce phase is not + * changed). + * + * However, already-running jobs *can* be stopped + * at this time since by definition they do not + * care about the session end event and may just + * as well die now to avoid slowing the shutdown. + */ + job_process_stop_all (); + } else { + nih_debug ("Skipping wait phase"); + quiesce_phase = QUIESCE_PHASE_KILL; + } + } + + if (quiesce_phase == QUIESCE_PHASE_KILL) { /* We'll attempt to wait for this long, but system * policy may prevent it such that we just get killed * and job processes reparented to PID 1. @@ -153,32 +210,34 @@ nih_assert (timer); nih_assert (quiesce_phase_time); + nih_assert (quiesce_requester != QUIESCE_REQUESTER_INVALID); now = time (NULL); - nih_assert (quiesce_requester != QUIESCE_REQUESTER_INVALID); - - if (quiesce_requester == QUIESCE_REQUESTER_SYSTEM) { - nih_assert (quiesce_phase == QUIESCE_PHASE_KILL); + if (quiesce_phase == QUIESCE_PHASE_KILL) { + nih_assert (max_kill_timeout); if ((now - quiesce_phase_time) > max_kill_timeout) - goto out; + goto timed_out; } else if (quiesce_phase == QUIESCE_PHASE_WAIT) { + int timed_out = 0; + + timed_out = ((now - quiesce_phase_time) >= QUIESCE_DEFAULT_JOB_RUNTIME); + + if (timed_out + || (session_end_jobs && ! job_process_jobs_running ()) + || ! job_process_jobs_running ()) { - if ((now - quiesce_phase_time) > QUIESCE_DEFAULT_JOB_RUNTIME) { quiesce_phase = QUIESCE_PHASE_KILL; /* reset for new phase */ quiesce_phase_time = time (NULL); max_kill_timeout = job_class_max_kill_timeout (); + job_process_stop_all (); } - } else if (quiesce_phase == QUIESCE_PHASE_KILL) { - - if ((now - quiesce_phase_time) > max_kill_timeout) - goto out; } else { nih_assert_not_reached (); } @@ -188,9 +247,10 @@ return; -out: +timed_out: quiesce_show_slow_jobs (); +out: /* Note that we might skip the kill phase for the session * requestor if no jobs are actually running at this point. */ @@ -237,7 +297,100 @@ void quiesce_finalise (void) { + static int finalising = FALSE; + time_t diff; + + nih_assert (quiesce_start_time); nih_assert (quiesce_phase == QUIESCE_PHASE_CLEANUP); + if (finalising) + return; + + finalising = TRUE; + + diff = time (NULL) - quiesce_start_time; + + nih_info (_("Quiesce %s sequence took %s%d second%s"), + quiesce_reason, + ! (int)diff ? "<" : "", + (int)diff ? (int)diff : 1, + diff <= 1 ? "" : "s"); + nih_main_loop_exit (0); + +} + +/** + * quiesce_complete: + * + * Force quiesce phase to finish. + **/ +void +quiesce_complete (void) +{ + quiesce_phase = QUIESCE_PHASE_CLEANUP; + + quiesce_finalise (); +} + +/** + * quiesce_event_match: + * @event: event. + * + * Identify if any jobs _may_ start when the session ends. + * + * A simple heuristic is used such that there is no guarantee that the + * jobs entire start condition will be satisfied at session-end. + * + * Returns: TRUE if any class specifies @event in its start + * condition, else FALSE. + **/ +static int +quiesce_event_match (Event *event) +{ + nih_assert (event); + + job_class_init (); + + NIH_HASH_FOREACH (job_classes, iter) { + JobClass *class = (JobClass *)iter; + + if (! class->start_on) + continue; + + /* Note that only the jobs start on condition is + * relevant. + */ + NIH_TREE_FOREACH_POST (&class->start_on->node, iter) { + EventOperator *oper = (EventOperator *)iter; + + switch (oper->type) { + case EVENT_OR: + case EVENT_AND: + break; + case EVENT_MATCH: + /* Job may attempt to start as the session ends */ + if (event_operator_match (oper, event, NULL)) + return TRUE; + break; + default: + nih_assert_not_reached (); + } + } + } + + return FALSE; +} + +/** + * quiesce_in_progress: + * + * Determine if shutdown is in progress. + * + * Returns: TRUE if quiesce is in progress, else FALSE. + **/ +int +quiesce_in_progress (void) +{ + return quiesce_phase != QUIESCE_PHASE_NOT_QUIESCED; } --- upstart-1.10.orig/init/main.c +++ upstart-1.10/init/main.c @@ -21,7 +21,6 @@ # include #endif /* HAVE_CONFIG_H */ - #include #include #include @@ -39,6 +38,7 @@ #include #include +#include #include #include #include @@ -46,6 +46,10 @@ #include #include +#ifdef HAVE_SELINUX +#include +#endif + #include #include @@ -190,6 +194,25 @@ { char **args = NULL; int ret; +#ifdef HAVE_SELINUX + int enforce = 0; + + if (getenv ("SELINUX_INIT") == NULL) { + putenv ("SELINUX_INIT=YES"); + if (selinux_init_load_policy (&enforce) == 0 ) { + execv (argv[0], argv); + } else { + if (enforce > 0) { + /* SELinux in enforcing mode but load_policy + * failed. At this point, we probably can't + * open /dev/console, so log() won't work. + */ + fprintf (stderr, "Unable to load SELinux Policy. Machine is in enforcing mode. Halting now.\n"); + exit (1); + } + } + } +#endif /* HAVE_SELINUX */ conf_dirs = NIH_MUST (nih_str_array_new (NULL)); @@ -321,23 +344,16 @@ * resetting it to sane defaults unless we're inheriting from another * init process which we know left it in a sane state. */ - if (system_setup_console (CONSOLE_OUTPUT, (! restart)) < 0) { + if (system_setup_console (CONSOLE_NONE, (! restart)) < 0) { NihError *err; err = nih_error_get (); - nih_warn ("%s: %s", _("Unable to initialize console, will try /dev/null"), - err->message); + nih_fatal ("%s: %s", _("Unable to initialize console as /dev/null"), + err->message); nih_free (err); - if (system_setup_console (CONSOLE_NONE, FALSE) < 0) { - err = nih_error_get (); - nih_fatal ("%s: %s", _("Unable to initialize console as /dev/null"), - err->message); - nih_free (err); - - exit (1); - } + exit (1); } /* Set the PATH environment variable */ @@ -629,6 +645,16 @@ * init daemon that exec'd us */ if (! restart) { + DIR *piddir; + + /* Look in well-known locations for pid files. + * + * Try /run (the newer) location first, but fall back to + * the original location for older systems. + */ + const char * const pid_paths[] = { "/run/initramfs/", "/dev/.initramfs/", NULL }; + const char * const *pid_path; + if (disable_startup_event) { nih_debug ("Startup event disabled"); } else { @@ -637,6 +663,68 @@ ? initial_event : STARTUP_EVENT, NULL)); + } + + for (pid_path = pid_paths; pid_path && *pid_path; pid_path++) { + struct dirent *ent; + + /* Total hack, look for .pid files in known + * locations - if there's a job config for them pretend + * that we started it and it has that pid. + */ + piddir = opendir (*pid_path); + if (! piddir) + continue; + + while ((ent = readdir (piddir)) != NULL) { + char path[PATH_MAX]; + char * ptr; + FILE * pidfile; + pid_t pid; + JobClass *class; + Job * job; + + if (ent->d_name[0] == '.') + continue; + + strcpy (path, *pid_path); + strcat (path, ent->d_name); + + ptr = strrchr (ent->d_name, '.'); + if ((! ptr) || strcmp (ptr, ".pid")) + continue; + + *ptr = '\0'; + pidfile = fopen (path, "r"); + if (! pidfile) + continue; + + pid = -1; + if (fscanf (pidfile, "%d", &pid)) + ; + fclose (pidfile); + + if ((pid < 0) || (kill (pid, 0) < 0)) + continue; + + class = (JobClass *)nih_hash_lookup (job_classes, ent->d_name); + if (! class) + continue; + if (! class->process[PROCESS_MAIN]) + continue; + if (strlen (class->instance)) + continue; + + job = NIH_MUST (job_new (class, "")); + job->goal = JOB_START; + job->state = JOB_RUNNING; + job->pid[PROCESS_MAIN] = pid; + + nih_debug ("%s inherited from initramfs with pid %d", class->name, pid); + } + + closedir (piddir); + break; } } else { --- upstart-1.10.orig/init/Makefile.am +++ upstart-1.10/init/Makefile.am @@ -8,6 +8,7 @@ $(NIH_CFLAGS) \ $(NIH_DBUS_CFLAGS) \ $(DBUS_CFLAGS) \ + $(SELINUX_CFLAGS) \ $(JSON_CFLAGS) AM_CPPFLAGS = \ @@ -70,6 +71,7 @@ $(NIH_LIBS) \ $(NIH_DBUS_LIBS) \ $(DBUS_LIBS) \ + $(SELINUX_LIBS) \ $(JSON_LIBS) \ -lrt --- upstart-1.10.orig/init/event.c +++ upstart-1.10/init/event.c @@ -44,6 +44,7 @@ #include "blocked.h" #include "control.h" #include "errors.h" +#include "quiesce.h" #include "com.ubuntu.Upstart.h" @@ -299,6 +300,8 @@ static void event_pending_handle_jobs (Event *event) { + int empty = TRUE; + nih_assert (event != NULL); job_class_init (); @@ -432,6 +435,26 @@ event_operator_reset (class->start_on); } } + + if (! quiesce_in_progress ()) + return; + + /* Determine if any job instances remain */ + NIH_HASH_FOREACH_SAFE (job_classes, iter) { + JobClass *class = (JobClass *)iter; + + NIH_HASH_FOREACH_SAFE (class->instances, job_iter) { + empty = FALSE; + break; + } + + if (! empty) + break; + } + + /* If no instances remain, force quiesce to finish */ + if (empty) + quiesce_complete (); } --- upstart-1.10.orig/init/quiesce.h +++ upstart-1.10/init/quiesce.h @@ -70,6 +70,9 @@ void quiesce_wait_callback (void *data, NihTimer *timer); void quiesce_show_slow_jobs (void); void quiesce_finalise (void); +void quiesce_complete (void); +int quiesce_in_progress (void) + __attribute__ ((warn_unused_result)); NIH_END_EXTERN --- upstart-1.10.orig/init/tests/test_job_process.c +++ upstart-1.10/init/tests/test_job_process.c @@ -3068,7 +3068,7 @@ TEST_NE_P (output, NULL); TEST_TRUE (fgets (buffer, sizeof(buffer), output)); - TEST_EQ (fnmatch ("*sh*/this/command/does/not/exist*not found*", buffer, 0), 0); + TEST_STR_MATCH (buffer, "*sh:*/this/command/does/not/exist:*"); TEST_FILE_END (output); fclose (output); @@ -3555,7 +3555,7 @@ TEST_NE_P (output, NULL); TEST_TRUE (fgets (buffer, sizeof(buffer), output)); - TEST_EQ (fnmatch ("/proc/self/fd/9*/this/command/does/not/exist*not found*", buffer, 0), 0); + TEST_STR_MATCH (buffer, "/proc/self/fd/9*/this/command/does/not/exist:*"); TEST_FILE_END (output); fclose (output); @@ -8058,6 +8058,7 @@ class->expect = EXPECT_STOP; TEST_ALLOC_FAIL { + pid_t tmp_pid; TEST_ALLOC_SAFE { job = job_new (class, ""); @@ -8071,7 +8072,10 @@ exit (0); } - assert0 (waitid (P_PID, pid, &info, WSTOPPED | WNOWAIT)); + tmp_pid = waitid (P_PID, pid, &info, WSTOPPED | WNOWAIT); + if (tmp_pid < 0) + printf("waitid failed: %m"); + assert0 (tmp_pid); job->goal = JOB_START; job->state = JOB_SPAWNED; --- upstart-1.10.orig/init/man/init.5 +++ upstart-1.10/init/man/init.5 @@ -1116,4 +1116,5 @@ .BR prctl (2) .BR pty (7) .BR sh (1) +.BR upstart-events (7) .BR apparmor (7) --- upstart-1.10.orig/init/man/init.8 +++ upstart-1.10/init/man/init.8 @@ -48,6 +48,10 @@ and .BR stopped (7) events emitted as jobs change state. + +See +.BR upstart-events (7) +for a summary of well-known events. .\" .SS System V compatibility The Upstart @@ -227,3 +231,4 @@ .BR stopping (7) .BR stopped (7) .BR telinit (8) +.BR upstart-events (7)