unblock: systemd/215-8
Martin Pitt
mpitt at debian.org
Mon Dec 15 06:27:05 GMT 2014
Package: release.debian.org
Severity: normal
User: release.debian.org at packages.debian.org
Usertags: unblock
systemd 215-8 has now been in unstable for 9 days without any
regression reports. It fixes the three current RC bugs in testing, so
I think it's time to let this in.
I attach the full debdiff between 215-7 and -8. As usual the changes
are also on anonscm, but as there has been some back and forth for one
of the changes I'll add the URLs individually.
Annotated changelog:
| [ Didier Roche ]
| * Cherry-pick shared-add-readlink_value.patch, we will use that function in
| the generator.
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=e76eee88
Trivial backport, no-op for existing code as the new function isn't
being used anywhere so far.
| * Cherry-pick util-allow-strappenda-to-take-any-number-of-args.patch, we
| will use that function in the generator.
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=0885f4
Make this macro more generic. This does change existing code, but it
has been in upstream, unstable, experimental, and Ubuntu for quite
some time without problems and there's also a new test case.
| * Handle multiple display managers which don't ship a systemd unit or the
| corresponding postinst logic for updating display-manager.service: Add a
| generator to ensure /etc/X11/default-display-manager is controlling which
| display-manager is started. (Closes: #771287)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=86e37e61
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=9868be77
This is certainly the most intrusive change. It's a workaround for
many of our packaged display managers having no or a broken systemd
unit, but fixing them all was already NACK'ed by the release team.
Thus Didier wrote this generator which synchronizes the
display-manager.service symlink to what
/etc/X11/default-display-manager is saying, so that we can stop
assuming that DM postinsts do that correctly by themselves.
Fixes RC bug.
Note that there is now also a test suite for this:
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=f724296
But this isn't in -8 yet (will be in -9).
| [ Sjoerd Simons ]
| * d/p/core-Fix-bind-error-message.patch:
| + Added. Fix error message on bind failure to print the full path
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=87b516cef
(the core-Fix-bind-error-message.patch part)
Trivial error message string fix.
| * d/p/core-Make-binding-notify-private-dbus-socket-more-ro.patch:
| + Added. Be more robust when binding private unix sockets (Based on current
| upstream logic) (Closes: #761306)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=87b516cef
(the other part)
Obvious and safe fix for RC bug.
| [ Martin Pitt ]
| * Clean up ...journal~ files from unclean shutdowns. (Closes: #771707)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=917d7123
Not RC, but a trivial fix for piling up stale files.
| * debian/systemd.postinst: Don't always restart journald, as this currently
| can't be done without losing the current journal and breaking attached
| processes. So only restart it from upgrades < 215-3 (where the socket
| location got moved) as an one-time upgrade path from wheezy.
| (Closes: #771122)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=6e14dff8b
Upstream doesn't support restarting the journal transparently yet, and
many programs which listen to it don't get along with SIGPIPEs on the
journal fd when it restarts. Fixing all of them for Jessie is rather
unrealistic, so limit the restart to the one case where it's truly
necessary. Fixes RC bug.
| * journalctl: Fix help text for --until. (Closes: #766598)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=1f4a9a14
Not RC, but trivial --help output fix to avoid confusion.
| * Bump systemd's udev dependency to >= 208-8, so that on partial upgrades we
| make sure that the udev package has appropriate Breaks:. In particular,
| this avoids installing current udev with kmod << 14. (Closes: #771726)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=db6ad7b9
Not RC (I don't consider partial upgrades as something we can ever
truly support), but as it's trivial to fix, let's do it.
| [ Michael Biebl ]
| * systemd.postinst: Move unit enablement after restarting systemd, so that
| we don't fail to enable units with keywords that wheezy's systemd does not
| understand yet. Fixes enabling getty units on wheezy upgrades with
| systemd. (Closes: #771204)
http://anonscm.debian.org/cgit/pkg-systemd/systemd.git/commit/?id=0c504dd62
Not RC, but still an upgrade regression from wheezy. This merely moves
existing postinst code around.
Thanks for considering!
Martin
unblock systemd/215-8
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)
-------------- next part --------------
diff -Nru systemd-215/debian/changelog systemd-215/debian/changelog
--- systemd-215/debian/changelog 2014-11-28 06:44:09.000000000 +0100
+++ systemd-215/debian/changelog 2014-12-05 10:01:35.000000000 +0100
@@ -1,3 +1,42 @@
+systemd (215-8) unstable; urgency=medium
+
+ [ Didier Roche ]
+ * Cherry-pick shared-add-readlink_value.patch, we will use that function in
+ the generator.
+ * Cherry-pick util-allow-strappenda-to-take-any-number-of-args.patch, we
+ will use that function in the generator.
+ * Handle multiple display managers which don't ship a systemd unit or the
+ corresponding postinst logic for updating display-manager.service: Add a
+ generator to ensure /etc/X11/default-display-manager is controlling which
+ display-manager is started. (Closes: #771287)
+
+ [ Sjoerd Simons ]
+ * d/p/core-Fix-bind-error-message.patch:
+ + Added. Fix error message on bind failure to print the full path
+ * d/p/core-Make-binding-notify-private-dbus-socket-more-ro.patch:
+ + Added. Be more robust when binding private unix sockets (Based on current
+ upstream logic) (Closes: #761306)
+
+ [ Martin Pitt ]
+ * Clean up ...journal~ files from unclean shutdowns. (Closes: #771707)
+ * debian/systemd.postinst: Don't always restart journald, as this currently
+ can't be done without losing the current journal and breaking attached
+ processes. So only restart it from upgrades < 215-3 (where the socket
+ location got moved) as an one-time upgrade path from wheezy.
+ (Closes: #771122)
+ * journalctl: Fix help text for --until. (Closes: #766598)
+ * Bump systemd's udev dependency to >= 208-8, so that on partial upgrades we
+ make sure that the udev package has appropriate Breaks:. In particular,
+ this avoids installing current udev with kmod << 14. (Closes: #771726)
+
+ [ Michael Biebl ]
+ * systemd.postinst: Move unit enablement after restarting systemd, so that
+ we don't fail to enable units with keywords that wheezy's systemd does not
+ understand yet. Fixes enabling getty units on wheezy upgrades with
+ systemd. (Closes: #771204)
+
+ -- Martin Pitt <mpitt at debian.org> Fri, 05 Dec 2014 10:01:24 +0100
+
systemd (215-7) unstable; urgency=medium
[ Martin Pitt ]
diff -Nru systemd-215/debian/control systemd-215/debian/control
--- systemd-215/debian/control 2014-11-28 06:44:09.000000000 +0100
+++ systemd-215/debian/control 2014-12-05 10:01:35.000000000 +0100
@@ -55,7 +55,7 @@
mount (>= 2.21),
initscripts (>= 2.88dsf-53.2),
sysv-rc,
- udev,
+ udev (>= 208-8),
acl,
adduser,
libcap2-bin
diff -Nru systemd-215/debian/patches/core-Fix-bind-error-message.patch systemd-215/debian/patches/core-Fix-bind-error-message.patch
--- systemd-215/debian/patches/core-Fix-bind-error-message.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/core-Fix-bind-error-message.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,25 @@
+From: Sjoerd Simons <sjoerd at luon.net>
+Date: Mon, 1 Dec 2014 22:32:39 +0100
+Subject: core: Fix bind error message
+
+The notify socket is no longer an abstract socket, so the full path
+should be printed instead of skipping the first character.
+
+Upstream has the same change as a side-effect in commit 70af4d17da
+---
+ src/core/manager.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 454ae47..9c96750 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -554,7 +554,7 @@ static int manager_setup_notify(Manager *m) {
+ strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
+ r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
+ if (r < 0) {
+- log_error("bind(@%s) failed: %m", sa.un.sun_path+1);
++ log_error("bind(%s) failed: %m", sa.un.sun_path);
+ return -errno;
+ }
+
diff -Nru systemd-215/debian/patches/core-Make-binding-notify-private-dbus-socket-more-ro.patch systemd-215/debian/patches/core-Make-binding-notify-private-dbus-socket-more-ro.patch
--- systemd-215/debian/patches/core-Make-binding-notify-private-dbus-socket-more-ro.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/core-Make-binding-notify-private-dbus-socket-more-ro.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,50 @@
+From: Sjoerd Simons <sjoerd at luon.net>
+Date: Mon, 1 Dec 2014 22:34:34 +0100
+Subject: core: Make binding notify & private dbus socket more robust
+
+Use mkdir + unlink right before calling bind on private unix sockets to
+prevent issues with stray sockets. This patch is based on a serie of
+upstream commits with the net code change in this patch as a result
+ 0c3f25e0c1f028d4da9cc5253abf0322230e6835
+ e7bc519620cb7bcdbe2166fc2a446453769d827e
+ 498e87d6b7ef025fef2e089931f355b5cd3c7dad
+ f0e62e89970b8c38eb07a9beebd277ce13a5fcc2
+
+Bug-Debian: https://bugs.debian.org/761306
+---
+ src/core/dbus.c | 5 ++---
+ src/core/manager.c | 3 +++
+ 2 files changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/dbus.c b/src/core/dbus.c
+index fb8e496..1c9c0aa 100644
+--- a/src/core/dbus.c
++++ b/src/core/dbus.c
+@@ -974,11 +974,10 @@ static int bus_init_private(Manager *m) {
+ left = strpcpy(&p, left, "/systemd/private");
+
+ salen = sizeof(sa.un) - left;
+-
+- mkdir_parents_label(sa.un.sun_path, 0755);
+ }
+
+- unlink(sa.un.sun_path);
++ (void) mkdir_parents_label(sa.un.sun_path, 0755);
++ (void) unlink(sa.un.sun_path);
+
+ fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
+ if (fd < 0) {
+diff --git a/src/core/manager.c b/src/core/manager.c
+index 9c96750..c99f6ec 100644
+--- a/src/core/manager.c
++++ b/src/core/manager.c
+@@ -551,6 +551,9 @@ static int manager_setup_notify(Manager *m) {
+ if (!m->notify_socket)
+ return log_oom();
+
++ (void) mkdir_parents_label(m->notify_socket, 0755);
++ (void) unlink(m->notify_socket);
++
+ strncpy(sa.un.sun_path, m->notify_socket, sizeof(sa.un.sun_path)-1);
+ r = bind(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path));
+ if (r < 0) {
diff -Nru systemd-215/debian/patches/journalctl-correct-help-text-for-until.patch systemd-215/debian/patches/journalctl-correct-help-text-for-until.patch
--- systemd-215/debian/patches/journalctl-correct-help-text-for-until.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/journalctl-correct-help-text-for-until.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,22 @@
+From: Santiago Vila <sanvila at unex.es>
+Date: Sat, 25 Oct 2014 10:40:30 -0400
+Subject: journalctl: correct help text for --until
+
+http://bugs.debian.org/766598
+---
+ src/journal/journalctl.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
+index 86453e6..a1bb466 100644
+--- a/src/journal/journalctl.c
++++ b/src/journal/journalctl.c
+@@ -171,7 +171,7 @@ static int help(void) {
+ " --user Show only the user journal for the current user\n"
+ " -M --machine=CONTAINER Operate on local container\n"
+ " --since=DATE Start showing entries on or newer than the specified date\n"
+- " --until=DATE Stop showing entries on or older than the specified date\n"
++ " --until=DATE Stop showing entries on or newer than the specified date\n"
+ " -c --cursor=CURSOR Start showing entries from the specified cursor\n"
+ " --after-cursor=CURSOR Start showing entries from after the specified cursor\n"
+ " --show-cursor Print the cursor after all the entries\n"
diff -Nru systemd-215/debian/patches/journal-do-server_vacuum-for-sigusr1.patch systemd-215/debian/patches/journal-do-server_vacuum-for-sigusr1.patch
--- systemd-215/debian/patches/journal-do-server_vacuum-for-sigusr1.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/journal-do-server_vacuum-for-sigusr1.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,26 @@
+From: WaLyong Cho <walyong.cho at samsung.com>
+Date: Thu, 28 Aug 2014 21:33:03 +0900
+Subject: journal: do server_vacuum for sigusr1
+
+runtime journal is migrated to system journal when only
+"/run/systemd/journal/flushed" exist. It's ok but according to this
+the system journal directory size(max use) can be over the config. If
+journal is not rotated during some time the journal directory can be
+remained as over the config(or default) size. To avoid, do
+server_vacuum just after the system journal migration from runtime.
+---
+ src/journal/journald-server.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
+index 58410a2..1c69563 100644
+--- a/src/journal/journald-server.c
++++ b/src/journal/journald-server.c
+@@ -1224,6 +1224,7 @@ static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *
+ touch("/run/systemd/journal/flushed");
+ server_flush_to_var(s);
+ server_sync(s);
++ server_vacuum(s);
+
+ return 0;
+ }
diff -Nru systemd-215/debian/patches/Prefer-etc-X11-default-display-manager-if-present.patch systemd-215/debian/patches/Prefer-etc-X11-default-display-manager-if-present.patch
--- systemd-215/debian/patches/Prefer-etc-X11-default-display-manager-if-present.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/Prefer-etc-X11-default-display-manager-if-present.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,188 @@
+From: Didier Roche <didrocks at ubuntu.com>
+Date: Thu, 27 Nov 2014 10:51:50 +0100
+Subject: Prefer /etc/X11/default-display-manager if present
+
+Add a generator to ensure /etc/X11/default-display-manager is controlling
+which display-manager is started.
+---
+ Makefile.am | 11 ++-
+ src/default-display-manager-generator/Makefile | 28 ++++++
+ .../default-display-manager-generator.c | 105 +++++++++++++++++++++
+ 3 files changed, 143 insertions(+), 1 deletion(-)
+ create mode 100644 src/default-display-manager-generator/Makefile
+ create mode 100644 src/default-display-manager-generator/default-display-manager-generator.c
+
+diff --git a/Makefile.am b/Makefile.am
+index ec5b871..b607a4a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -402,7 +402,8 @@ systemgenerator_PROGRAMS = \
+ systemd-getty-generator \
+ systemd-fstab-generator \
+ systemd-system-update-generator \
+- systemd-debug-generator
++ systemd-debug-generator \
++ systemd-default-display-manager-generator
+
+ dist_bashcompletion_DATA = \
+ shell-completion/bash/busctl \
+@@ -2190,6 +2191,14 @@ systemd_delta_LDADD = \
+ libsystemd-shared.la
+
+ # ------------------------------------------------------------------------------
++systemd_default_display_manager_generator_SOURCES = \
++ src/default-display-manager-generator/default-display-manager-generator.c
++
++systemd_default_display_manager_generator_LDADD = \
++ libsystemd-label.la \
++ libsystemd-shared.la
++
++# ------------------------------------------------------------------------------
+ systemd_insserv_generator_SOURCES = \
+ src/insserv-generator/insserv-generator.c
+
+diff --git a/src/default-display-manager-generator/Makefile b/src/default-display-manager-generator/Makefile
+new file mode 100644
+index 0000000..b29b937
+--- /dev/null
++++ b/src/default-display-manager-generator/Makefile
+@@ -0,0 +1,28 @@
++# This file is part of systemd.
++#
++# Copyright 2014 Canonical
++#
++# systemd is free software; you can redistribute it and/or modify it
++# under the terms of the GNU Lesser General Public License as published by
++# the Free Software Foundation; either version 2.1 of the License, or
++# (at your option) any later version.
++#
++# systemd 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
++# Lesser General Public License for more details.
++#
++# You should have received a copy of the GNU Lesser General Public License
++# along with systemd; If not, see <http://www.gnu.org/licenses/>.
++
++# This file is a dirty trick to simplify compilation from within
++# emacs. This file is not intended to be distributed. So, don't touch
++# it, even better ignore it!
++
++all:
++ $(MAKE) -C ..
++
++clean:
++ $(MAKE) -C .. clean
++
++.PHONY: all clean
+diff --git a/src/default-display-manager-generator/default-display-manager-generator.c b/src/default-display-manager-generator/default-display-manager-generator.c
+new file mode 100644
+index 0000000..2fe9521
+--- /dev/null
++++ b/src/default-display-manager-generator/default-display-manager-generator.c
+@@ -0,0 +1,105 @@
++/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
++
++/***
++ This file is part of systemd.
++
++ Copyright 2014 Canonical
++
++ systemd is free software; you can redistribute it and/or modify it
++ under the terms of the GNU Lesser General Public License as published by
++ the Free Software Foundation; either version 2.1 of the License, or
++ (at your option) any later version.
++
++ systemd 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
++ Lesser General Public License for more details.
++
++ You should have received a copy of the GNU Lesser General Public License
++ along with systemd; If not, see <http://www.gnu.org/licenses/>.
++***/
++
++#include <errno.h>
++#include <unistd.h>
++
++#include "fileio.h"
++#include "log.h"
++#include "mkdir.h"
++#include "util.h"
++
++
++/*
++ * Ensure that the started display-manager is matching
++ * /etc/X11/default-display-manager if present, otherwise
++ * let display-manager.service symlinks pick the preferred one
++ * if any.
++ */
++
++static const char *dm_service_unit = SYSTEM_CONFIG_UNIT_PATH "/display-manager.service";
++static const char *default_dm_file = "/etc/X11/default-display-manager";
++static const char *dest = NULL;
++
++static int generate_display_manager_alias(void) {
++
++ _cleanup_free_ char *default_dm_path = NULL, *enabled_dm_unit = NULL;
++ const char *default_dm = NULL, *in_mem_symlink = NULL, *target_unit_path = NULL;
++ int r;
++
++ r = read_full_file(default_dm_file, &default_dm_path, NULL);
++ if (r < 0) {
++ log_debug("No %s file, nothing to generate", default_dm_file);
++ return 0;
++ }
++ default_dm = strstrip(basename(default_dm_path));
++
++ r = readlink_value(dm_service_unit, &enabled_dm_unit);
++ if (r < 0) {
++ log_warning("No default display manager unit service enabled, setup is manual or a sysvinit file");
++ return 0;
++ }
++
++ /* all is fine if the info matches */
++ if (streq(strappenda(default_dm, ".service"), enabled_dm_unit))
++ return 0;
++
++ target_unit_path = strappenda(SYSTEM_DATA_UNIT_PATH, "/", default_dm, ".service");
++
++ /* we only create the alias symlink for non sysvinit services */
++ if (access(target_unit_path, F_OK) < 0 && (errno == ENOENT)) {
++ log_warning("%s doesn't seem to be a system unit, we disable the systemd enabled display manager", target_unit_path);
++ target_unit_path = "/dev/null";
++ } else {
++ log_warning("%s point at %s while the default systemd unit is %s. Reconfiguring %s as default.",
++ default_dm_file, default_dm, enabled_dm_unit, default_dm);
++ }
++
++ in_mem_symlink = strappenda(dest, "/display-manager.service");
++ mkdir_parents_label(in_mem_symlink, 0755);
++ if (symlink(target_unit_path, in_mem_symlink) < 0) {
++ log_error("Failed to create symlink %s: %m", in_mem_symlink);
++ return -errno;
++ }
++
++ return 0;
++}
++
++int main(int argc, char *argv[]) {
++ int r;
++
++ if (argc != 4) {
++ log_error("This program takes three arguments.");
++ return EXIT_FAILURE;
++ }
++
++ dest = argv[2];
++
++ log_set_target(LOG_TARGET_SAFE);
++ log_parse_environment();
++ log_open();
++
++ umask(0022);
++
++ r = generate_display_manager_alias();
++
++ return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
++}
diff -Nru systemd-215/debian/patches/series systemd-215/debian/patches/series
--- systemd-215/debian/patches/series 2014-11-28 06:44:09.000000000 +0100
+++ systemd-215/debian/patches/series 2014-12-05 10:01:35.000000000 +0100
@@ -118,6 +118,10 @@
core-swap-advertise-Discard-over-dbus.patch
core-swap-only-make-configured-units-part-of-swap.ta.patch
swap-replace-Discard-setting-by-a-more-generic-Optio.patch
+shared-add-readlink_value.patch
+util-allow-strappenda-to-take-any-number-of-args.patch
+journal-do-server_vacuum-for-sigusr1.patch
+journalctl-correct-help-text-for-until.patch
## Debian specific patches:
Add-back-support-for-Debian-specific-config-files.patch
@@ -166,3 +170,6 @@
udev-re-enable-mount-propagation-for-udevd.patch
Add-env-variable-for-machine-ID-path.patch
sysv-generator-Avoid-wrong-dependencies-for-failing-.patch
+Prefer-etc-X11-default-display-manager-if-present.patch
+core-Fix-bind-error-message.patch
+core-Make-binding-notify-private-dbus-socket-more-ro.patch
diff -Nru systemd-215/debian/patches/shared-add-readlink_value.patch systemd-215/debian/patches/shared-add-readlink_value.patch
--- systemd-215/debian/patches/shared-add-readlink_value.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/shared-add-readlink_value.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,55 @@
+From: Tom Gundersen <teg at jklm.no>
+Date: Fri, 7 Nov 2014 19:19:02 +0100
+Subject: shared: add readlink_value
+
+Reads the basename of the target of a symlink.
+---
+ src/shared/util.c | 22 ++++++++++++++++++++++
+ src/shared/util.h | 1 +
+ 2 files changed, 23 insertions(+)
+
+diff --git a/src/shared/util.c b/src/shared/util.c
+index 4143f6d..1b3bbeb 100644
+--- a/src/shared/util.c
++++ b/src/shared/util.c
+@@ -893,6 +893,28 @@ int readlink_malloc(const char *p, char **ret) {
+ return readlinkat_malloc(AT_FDCWD, p, ret);
+ }
+
++int readlink_value(const char *p, char **ret) {
++ _cleanup_free_ char *link = NULL;
++ char *value;
++ int r;
++
++ r = readlink_malloc(p, &link);
++ if (r < 0)
++ return r;
++
++ value = basename(link);
++ if (!value)
++ return -ENOENT;
++
++ value = strdup(value);
++ if (!value)
++ return -ENOMEM;
++
++ *ret = value;
++
++ return 0;
++}
++
+ int readlink_and_make_absolute(const char *p, char **r) {
+ _cleanup_free_ char *target = NULL;
+ char *k;
+diff --git a/src/shared/util.h b/src/shared/util.h
+index 3558446..f928034 100644
+--- a/src/shared/util.h
++++ b/src/shared/util.h
+@@ -270,6 +270,7 @@ char **replace_env_argv(char **argv, char **env);
+
+ int readlinkat_malloc(int fd, const char *p, char **ret);
+ int readlink_malloc(const char *p, char **r);
++int readlink_value(const char *p, char **ret);
+ int readlink_and_make_absolute(const char *p, char **r);
+ int readlink_and_canonicalize(const char *p, char **r);
+
diff -Nru systemd-215/debian/patches/util-allow-strappenda-to-take-any-number-of-args.patch systemd-215/debian/patches/util-allow-strappenda-to-take-any-number-of-args.patch
--- systemd-215/debian/patches/util-allow-strappenda-to-take-any-number-of-args.patch 1970-01-01 01:00:00.000000000 +0100
+++ systemd-215/debian/patches/util-allow-strappenda-to-take-any-number-of-args.patch 2014-12-05 10:01:35.000000000 +0100
@@ -0,0 +1,139 @@
+From 8085f163c50d998f3e30a6ddfc72c73d5dc57747 Mon Sep 17 00:00:00 2001
+From: Dave Reisner <dreisner at archlinux.org>
+Date: Tue, 11 Mar 2014 10:41:22 -0400
+Subject: util: allow strappenda to take any number of args
+
+This makes strappenda3 redundant, so we remove its usage and
+definition. Add a few tests along the way for sanity.
+
+Index: systemd-debian/src/fstab-generator/fstab-generator.c
+===================================================================
+--- systemd-debian.orig/src/fstab-generator/fstab-generator.c
++++ systemd-debian/src/fstab-generator/fstab-generator.c
+@@ -437,7 +437,7 @@ static int add_root_mount(void) {
+ else if (arg_root_rw >= 0 ||
+ (!mount_test_option(arg_root_options, "ro") &&
+ !mount_test_option(arg_root_options, "rw")))
+- opts = strappenda3(arg_root_options, ",", arg_root_rw > 0 ? "rw" : "ro");
++ opts = strappenda(arg_root_options, ",", arg_root_rw > 0 ? "rw" : "ro");
+ else
+ opts = arg_root_options;
+
+Index: systemd-debian/src/getty-generator/getty-generator.c
+===================================================================
+--- systemd-debian.orig/src/getty-generator/getty-generator.c
++++ systemd-debian/src/getty-generator/getty-generator.c
+@@ -42,7 +42,7 @@ static int add_symlink(const char *fserv
+ assert(tservice);
+
+ from = strappenda(SYSTEM_DATA_UNIT_PATH "/", fservice);
+- to = strappenda3(arg_dest, "/getty.target.wants/", tservice);
++ to = strappenda(arg_dest, "/getty.target.wants/", tservice);
+
+ mkdir_parents_label(to, 0755);
+
+Index: systemd-debian/src/shared/install.c
+===================================================================
+--- systemd-debian.orig/src/shared/install.c
++++ systemd-debian/src/shared/install.c
+@@ -1064,7 +1064,7 @@ static int unit_file_load(
+ assert(path);
+
+ if (!isempty(root_dir))
+- path = strappenda3(root_dir, "/", path);
++ path = strappenda(root_dir, "/", path);
+
+ fd = open(path, O_RDONLY|O_CLOEXEC|O_NOCTTY|(allow_symlink ? 0 : O_NOFOLLOW));
+ if (fd < 0)
+Index: systemd-debian/src/shared/util.h
+===================================================================
+--- systemd-debian.orig/src/shared/util.h
++++ systemd-debian/src/shared/util.h
+@@ -841,29 +841,19 @@ int unlink_noerrno(const char *path);
+ (void *) memset(_new_, 0, _len_); \
+ })
+
+-#define strappenda(a, b) \
+- ({ \
+- const char *_a_ = (a), *_b_ = (b); \
+- char *_c_; \
+- size_t _x_, _y_; \
+- _x_ = strlen(_a_); \
+- _y_ = strlen(_b_); \
+- _c_ = alloca(_x_ + _y_ + 1); \
+- strcpy(stpcpy(_c_, _a_), _b_); \
+- _c_; \
+- })
+-
+-#define strappenda3(a, b, c) \
+- ({ \
+- const char *_a_ = (a), *_b_ = (b), *_c_ = (c); \
+- char *_d_; \
+- size_t _x_, _y_, _z_; \
+- _x_ = strlen(_a_); \
+- _y_ = strlen(_b_); \
+- _z_ = strlen(_c_); \
+- _d_ = alloca(_x_ + _y_ + _z_ + 1); \
+- strcpy(stpcpy(stpcpy(_d_, _a_), _b_), _c_); \
+- _d_; \
++#define strappenda(a, ...) \
++ ({ \
++ int _len = strlen(a); \
++ unsigned _i; \
++ char *_d_, *_p_; \
++ const char *_appendees_[] = { __VA_ARGS__ }; \
++ for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
++ _len += strlen(_appendees_[_i]); \
++ _d_ = alloca(_len + 1); \
++ _p_ = stpcpy(_d_, a); \
++ for (_i = 0; _i < ELEMENTSOF(_appendees_); _i++) \
++ _p_ = stpcpy(_p_, _appendees_[_i]); \
++ _d_; \
+ })
+
+ #define procfs_file_alloca(pid, field) \
+Index: systemd-debian/src/systemctl/systemctl.c
+===================================================================
+--- systemd-debian.orig/src/systemctl/systemctl.c
++++ systemd-debian/src/systemctl/systemctl.c
+@@ -4861,7 +4861,7 @@ static int switch_root(sd_bus *bus, char
+ const char *root_systemd_path = NULL, *root_init_path = NULL;
+
+ root_systemd_path = strappenda(root, "/" SYSTEMD_BINARY_PATH);
+- root_init_path = strappenda3(root, "/", init);
++ root_init_path = strappenda(root, "/", init);
+
+ /* If the passed init is actually the same as the
+ * systemd binary, then let's suppress it. */
+Index: systemd-debian/src/test/test-util.c
+===================================================================
+--- systemd-debian.orig/src/test/test-util.c
++++ systemd-debian/src/test/test-util.c
+@@ -906,6 +906,19 @@ static void test_strshorten(void) {
+ assert_se(strlen(strshorten(s, 0)) == 0);
+ }
+
++static void test_strappenda(void) {
++ char *actual;
++
++ actual = strappenda("", "foo", "bar");
++ assert_se(streq(actual, "foobar"));
++
++ actual = strappenda("foo", "bar", "baz");
++ assert_se(streq(actual, "foobarbaz"));
++
++ actual = strappenda("foo", "", "bar", "baz");
++ assert_se(streq(actual, "foobarbaz"));
++}
++
+ int main(int argc, char *argv[]) {
+ log_parse_environment();
+ log_open();
+@@ -964,6 +977,7 @@ int main(int argc, char *argv[]) {
+ test_read_one_char();
+ test_ignore_signals();
+ test_strshorten();
++ test_strappenda();
+
+ return 0;
+ }
diff -Nru systemd-215/debian/systemd.postinst systemd-215/debian/systemd.postinst
--- systemd-215/debian/systemd.postinst 2014-11-28 06:44:09.000000000 +0100
+++ systemd-215/debian/systemd.postinst 2014-12-05 10:01:35.000000000 +0100
@@ -18,14 +18,6 @@
exit 0
fi
-# Enable getty and remote-fs.target by default on new installs, and on
-# upgrades from old systemd versions (where the symlinks included as deb
-# content, and will thus have been removed by dpkg during the upgrade).
-if dpkg --compare-versions "$2" lt "214-1"; then
- systemctl enable getty at tty1.service || true
- systemctl enable remote-fs.target || true
-fi
-
# Cleanup state files from the auto-enabler which we used in wheezy
if dpkg --compare-versions "$2" lt "204-1"; then
rm -f /var/lib/systemd/enabled-units
@@ -123,25 +115,34 @@
setfacl -R -nm g:adm:rx,d:g:adm:rx /var/log/journal || true
fi
-# Re-run systemctl enable for any service that was enabled when preinst was run.
-if dpkg --compare-versions "$2" ge "204"; then
- while read UNIT ; do
- systemctl enable $UNIT || true
- done </run/systemd/was-enabled || true
-fi
-
if [ -n "$2" ]; then
_systemctl daemon-reexec || true
- _systemctl try-restart systemd-journald.service || true
_systemctl try-restart systemd-logind.service || true
_systemctl try-restart systemd-networkd.service || true
_systemctl try-restart systemd-resolved.service || true
_systemctl try-restart systemd-timesyncd.service || true
fi
+# Enable getty and remote-fs.target by default on new installs, and on
+# upgrades from old systemd versions (where the symlinks included as deb
+# content, and will thus have been removed by dpkg during the upgrade).
+if dpkg --compare-versions "$2" lt "214-1"; then
+ systemctl enable getty at tty1.service || true
+ systemctl enable remote-fs.target || true
+fi
+
+# Re-run systemctl enable for any service that was enabled when preinst was run.
+if dpkg --compare-versions "$2" ge "204"; then
+ while read UNIT ; do
+ systemctl enable $UNIT || true
+ done </run/systemd/was-enabled || true
+fi
+
# The /dev/log socket and /dev/initctl FIFO have been moved to /run and
# replaced by symlinks. Create the symlinks manually on upgrades as well.
-# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=761340
+# (https://bugs.debian.org/761340). Note that this will break the current
+# journal as we cannot restart it properly (https://bugs.debian.org/771122) so
+# this is mostly an one-time upgrade path from wheezy.
if dpkg --compare-versions "$2" lt-nl "215-3"; then
if [ -p /run/systemd/initctl/fifo ] && [ ! -L /dev/initctl ]; then
ln -sf /run/systemd/initctl/fifo /dev/initctl
@@ -149,6 +150,7 @@
if [ -S /run/systemd/journal/dev-log ] && [ ! -L /dev/log ]; then
ln -sf /run/systemd/journal/dev-log /dev/log
fi
+ _systemctl try-restart systemd-journald.service || true
fi
#DEBHELPER#
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20141215/59f59d12/attachment-0001.sig>
More information about the Pkg-systemd-maintainers
mailing list