diff --git a/core/systemd/0001-core-do-not-spawn-jobs-or-touch-other-units-during-c.patch b/core/systemd/0001-core-do-not-spawn-jobs-or-touch-other-units-during-c.patch new file mode 100644 index 000000000..f1d7c0461 --- /dev/null +++ b/core/systemd/0001-core-do-not-spawn-jobs-or-touch-other-units-during-c.patch @@ -0,0 +1,376 @@ +From 6e392c9c45643d106673c6643ac8bf4e65da13c1 Mon Sep 17 00:00:00 2001 +From: Ivan Shapovalov +Date: Sat, 7 Mar 2015 08:44:52 -0500 +Subject: [PATCH] core: do not spawn jobs or touch other units during + coldplugging + +Because the order of coldplugging is not defined, we can reference a +not-yet-coldplugged unit and read its state while it has not yet been +set to a meaningful value. + +This way, already active units may get started again. + +We fix this by deferring such actions until all units have been at +least somehow coldplugged. + +Fixes https://bugs.freedesktop.org/show_bug.cgi?id=88401 +--- + src/core/automount.c | 2 +- + src/core/busname.c | 2 +- + src/core/device.c | 2 +- + src/core/manager.c | 35 +++++++++++++++++++++++++++++++++-- + src/core/mount.c | 2 +- + src/core/path.c | 14 ++++++++++---- + src/core/scope.c | 2 +- + src/core/service.c | 2 +- + src/core/slice.c | 2 +- + src/core/snapshot.c | 2 +- + src/core/socket.c | 2 +- + src/core/swap.c | 2 +- + src/core/target.c | 2 +- + src/core/timer.c | 14 ++++++++++---- + src/core/unit.c | 25 ++++++++++++++++--------- + src/core/unit.h | 12 +++++++++--- + 16 files changed, 89 insertions(+), 33 deletions(-) + +diff --git a/src/core/automount.c b/src/core/automount.c +index 4a509ef..0539fbb 100644 +--- a/src/core/automount.c ++++ b/src/core/automount.c +@@ -233,7 +233,7 @@ static void automount_set_state(Automount *a, AutomountState state) { + unit_notify(UNIT(a), state_translation_table[old_state], state_translation_table[state], true); + } + +-static int automount_coldplug(Unit *u) { ++static int automount_coldplug(Unit *u, Hashmap *deferred_work) { + Automount *a = AUTOMOUNT(u); + int r; + +diff --git a/src/core/busname.c b/src/core/busname.c +index 1d77292..43d7607 100644 +--- a/src/core/busname.c ++++ b/src/core/busname.c +@@ -335,7 +335,7 @@ static void busname_set_state(BusName *n, BusNameState state) { + unit_notify(UNIT(n), state_translation_table[old_state], state_translation_table[state], true); + } + +-static int busname_coldplug(Unit *u) { ++static int busname_coldplug(Unit *u, Hashmap *deferred_work) { + BusName *n = BUSNAME(u); + int r; + +diff --git a/src/core/device.c b/src/core/device.c +index eb976b8..6b489a4 100644 +--- a/src/core/device.c ++++ b/src/core/device.c +@@ -140,7 +140,7 @@ static void device_set_state(Device *d, DeviceState state) { + unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], true); + } + +-static int device_coldplug(Unit *u) { ++static int device_coldplug(Unit *u, Hashmap *deferred_work) { + Device *d = DEVICE(u); + + assert(d); +diff --git a/src/core/manager.c b/src/core/manager.c +index 7a6d519..3e87aa9 100644 +--- a/src/core/manager.c ++++ b/src/core/manager.c +@@ -975,7 +975,28 @@ static int manager_coldplug(Manager *m) { + Unit *u; + char *k; + +- assert(m); ++ /* ++ * Some unit types tend to spawn jobs or check other units' state ++ * during coldplug. This is wrong because it is undefined whether the ++ * units in question have been already coldplugged (i. e. their state ++ * restored). This way, we can easily re-start an already started unit ++ * or otherwise make a wrong decision based on the unit's state. ++ * ++ * Solve this by providing a way for coldplug functions to defer ++ * such actions until after all units have been coldplugged. ++ * ++ * We store Unit* -> int(*)(Unit*). ++ * ++ * https://bugs.freedesktop.org/show_bug.cgi?id=88401 ++ */ ++ _cleanup_hashmap_free_ Hashmap *deferred_work = NULL; ++ int(*proc)(Unit*); ++ ++ assert(m); ++ ++ deferred_work = hashmap_new(&trivial_hash_ops); ++ if (!deferred_work) ++ return -ENOMEM; + + /* Then, let's set up their initial state. */ + HASHMAP_FOREACH_KEY(u, k, m->units, i) { +@@ -985,7 +1006,17 @@ static int manager_coldplug(Manager *m) { + if (u->id != k) + continue; + +- q = unit_coldplug(u); ++ q = unit_coldplug(u, deferred_work); ++ if (q < 0) ++ r = q; ++ } ++ ++ /* After coldplugging and setting up initial state of the units, ++ * let's perform operations which spawn jobs or query units' state. */ ++ HASHMAP_FOREACH_KEY(proc, u, deferred_work, i) { ++ int q; ++ ++ q = proc(u); + if (q < 0) + r = q; + } +diff --git a/src/core/mount.c b/src/core/mount.c +index 5ee679d..1251c94 100644 +--- a/src/core/mount.c ++++ b/src/core/mount.c +@@ -612,7 +612,7 @@ static void mount_set_state(Mount *m, MountState state) { + m->reload_result = MOUNT_SUCCESS; + } + +-static int mount_coldplug(Unit *u) { ++static int mount_coldplug(Unit *u, Hashmap *deferred_work) { + Mount *m = MOUNT(u); + MountState new_state = MOUNT_DEAD; + int r; +diff --git a/src/core/path.c b/src/core/path.c +index fbb695d..6be9ac8 100644 +--- a/src/core/path.c ++++ b/src/core/path.c +@@ -438,7 +438,12 @@ static void path_set_state(Path *p, PathState state) { + + static void path_enter_waiting(Path *p, bool initial, bool recheck); + +-static int path_coldplug(Unit *u) { ++static int path_enter_waiting_coldplug(Unit *u) { ++ path_enter_waiting(PATH(u), true, true); ++ return 0; ++} ++ ++static int path_coldplug(Unit *u, Hashmap *deferred_work) { + Path *p = PATH(u); + + assert(p); +@@ -447,9 +452,10 @@ static int path_coldplug(Unit *u) { + if (p->deserialized_state != p->state) { + + if (p->deserialized_state == PATH_WAITING || +- p->deserialized_state == PATH_RUNNING) +- path_enter_waiting(p, true, true); +- else ++ p->deserialized_state == PATH_RUNNING) { ++ hashmap_put(deferred_work, u, &path_enter_waiting_coldplug); ++ path_set_state(p, PATH_WAITING); ++ } else + path_set_state(p, p->deserialized_state); + } + +diff --git a/src/core/scope.c b/src/core/scope.c +index 1c3c6bb..8b2bb29 100644 +--- a/src/core/scope.c ++++ b/src/core/scope.c +@@ -171,7 +171,7 @@ static int scope_load(Unit *u) { + return scope_verify(s); + } + +-static int scope_coldplug(Unit *u) { ++static int scope_coldplug(Unit *u, Hashmap *deferred_work) { + Scope *s = SCOPE(u); + int r; + +diff --git a/src/core/service.c b/src/core/service.c +index a89ff3f..cc4ea19 100644 +--- a/src/core/service.c ++++ b/src/core/service.c +@@ -878,7 +878,7 @@ static void service_set_state(Service *s, ServiceState state) { + s->reload_result = SERVICE_SUCCESS; + } + +-static int service_coldplug(Unit *u) { ++static int service_coldplug(Unit *u, Hashmap *deferred_work) { + Service *s = SERVICE(u); + int r; + +diff --git a/src/core/slice.c b/src/core/slice.c +index 0bebdbc..0285c49 100644 +--- a/src/core/slice.c ++++ b/src/core/slice.c +@@ -150,7 +150,7 @@ static int slice_load(Unit *u) { + return slice_verify(s); + } + +-static int slice_coldplug(Unit *u) { ++static int slice_coldplug(Unit *u, Hashmap *deferred_work) { + Slice *t = SLICE(u); + + assert(t); +diff --git a/src/core/snapshot.c b/src/core/snapshot.c +index b70c3be..b1d8448 100644 +--- a/src/core/snapshot.c ++++ b/src/core/snapshot.c +@@ -75,7 +75,7 @@ static int snapshot_load(Unit *u) { + return 0; + } + +-static int snapshot_coldplug(Unit *u) { ++static int snapshot_coldplug(Unit *u, Hashmap *deferred_work) { + Snapshot *s = SNAPSHOT(u); + + assert(s); +diff --git a/src/core/socket.c b/src/core/socket.c +index 9606ac2..f67370b 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -1322,7 +1322,7 @@ static void socket_set_state(Socket *s, SocketState state) { + unit_notify(UNIT(s), state_translation_table[old_state], state_translation_table[state], true); + } + +-static int socket_coldplug(Unit *u) { ++static int socket_coldplug(Unit *u, Hashmap *deferred_work) { + Socket *s = SOCKET(u); + int r; + +diff --git a/src/core/swap.c b/src/core/swap.c +index 4dd6be8..bb1398f 100644 +--- a/src/core/swap.c ++++ b/src/core/swap.c +@@ -506,7 +506,7 @@ static void swap_set_state(Swap *s, SwapState state) { + job_add_to_run_queue(UNIT(other)->job); + } + +-static int swap_coldplug(Unit *u) { ++static int swap_coldplug(Unit *u, Hashmap *deferred_work) { + Swap *s = SWAP(u); + SwapState new_state = SWAP_DEAD; + int r; +diff --git a/src/core/target.c b/src/core/target.c +index 8817ef2..5f64402 100644 +--- a/src/core/target.c ++++ b/src/core/target.c +@@ -103,7 +103,7 @@ static int target_load(Unit *u) { + return 0; + } + +-static int target_coldplug(Unit *u) { ++static int target_coldplug(Unit *u, Hashmap *deferred_work) { + Target *t = TARGET(u); + + assert(t); +diff --git a/src/core/timer.c b/src/core/timer.c +index 9405501..79a7540 100644 +--- a/src/core/timer.c ++++ b/src/core/timer.c +@@ -267,7 +267,12 @@ static void timer_set_state(Timer *t, TimerState state) { + + static void timer_enter_waiting(Timer *t, bool initial); + +-static int timer_coldplug(Unit *u) { ++static int timer_enter_waiting_coldplug(Unit *u) { ++ timer_enter_waiting(TIMER(u), false); ++ return 0; ++} ++ ++static int timer_coldplug(Unit *u, Hashmap *deferred_work) { + Timer *t = TIMER(u); + + assert(t); +@@ -275,9 +280,10 @@ static int timer_coldplug(Unit *u) { + + if (t->deserialized_state != t->state) { + +- if (t->deserialized_state == TIMER_WAITING) +- timer_enter_waiting(t, false); +- else ++ if (t->deserialized_state == TIMER_WAITING) { ++ hashmap_put(deferred_work, u, &timer_enter_waiting_coldplug); ++ timer_set_state(t, TIMER_WAITING); ++ } else + timer_set_state(t, t->deserialized_state); + } + +diff --git a/src/core/unit.c b/src/core/unit.c +index b639d68..ec4fa82 100644 +--- a/src/core/unit.c ++++ b/src/core/unit.c +@@ -2856,27 +2856,34 @@ int unit_add_node_link(Unit *u, const char *what, bool wants) { + return 0; + } + +-int unit_coldplug(Unit *u) { ++static int unit_add_deserialized_job_coldplug(Unit *u) { ++ int r; ++ ++ r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL); ++ if (r < 0) ++ return r; ++ ++ u->deserialized_job = _JOB_TYPE_INVALID; ++ ++ return 0; ++} ++ ++int unit_coldplug(Unit *u, Hashmap *deferred_work) { + int r; + + assert(u); + + if (UNIT_VTABLE(u)->coldplug) +- if ((r = UNIT_VTABLE(u)->coldplug(u)) < 0) ++ if ((r = UNIT_VTABLE(u)->coldplug(u, deferred_work)) < 0) + return r; + + if (u->job) { + r = job_coldplug(u->job); + if (r < 0) + return r; +- } else if (u->deserialized_job >= 0) { ++ } else if (u->deserialized_job >= 0) + /* legacy */ +- r = manager_add_job(u->manager, u->deserialized_job, u, JOB_IGNORE_REQUIREMENTS, false, NULL, NULL); +- if (r < 0) +- return r; +- +- u->deserialized_job = _JOB_TYPE_INVALID; +- } ++ hashmap_put(deferred_work, u, &unit_add_deserialized_job_coldplug); + + return 0; + } +diff --git a/src/core/unit.h b/src/core/unit.h +index ac5647a..11242c2 100644 +--- a/src/core/unit.h ++++ b/src/core/unit.h +@@ -301,8 +301,14 @@ struct UnitVTable { + int (*load)(Unit *u); + + /* If a lot of units got created via enumerate(), this is +- * where to actually set the state and call unit_notify(). */ +- int (*coldplug)(Unit *u); ++ * where to actually set the state and call unit_notify(). ++ * ++ * This must not reference other units (maybe implicitly through spawning ++ * jobs), because it is possible that they are not yet coldplugged. ++ * Such actions must be deferred until the end of coldplug bу adding ++ * a "Unit* -> int(*)(Unit*)" entry into the hashmap. ++ */ ++ int (*coldplug)(Unit *u, Hashmap *deferred_work); + + void (*dump)(Unit *u, FILE *f, const char *prefix); + +@@ -538,7 +544,7 @@ int unit_deserialize(Unit *u, FILE *f, FDSet *fds); + + int unit_add_node_link(Unit *u, const char *what, bool wants); + +-int unit_coldplug(Unit *u); ++int unit_coldplug(Unit *u, Hashmap *deferred_work); + + void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_(3, 0); + +-- +2.3.2 + diff --git a/core/systemd/0001-core-shared-in-deserializing-match-same-files-reache.patch b/core/systemd/0001-core-shared-in-deserializing-match-same-files-reache.patch new file mode 100644 index 000000000..d2785d322 --- /dev/null +++ b/core/systemd/0001-core-shared-in-deserializing-match-same-files-reache.patch @@ -0,0 +1,135 @@ +From c78e47a61fa8d9a21fece01c83e4c26ce0938d27 Mon Sep 17 00:00:00 2001 +From: Michal Schmidt +Date: Thu, 19 Feb 2015 23:12:38 +0100 +Subject: [PATCH] core, shared: in deserializing, match same files reached via + different paths + +When dbus.socket is updated like this: +-ListenStream=/var/run/dbus/system_bus_socket ++ListenStream=/run/dbus/system_bus_socket +... and daemon-reload is performed, bad things happen. +During deserialization systemd does not recognize that the two paths +refer to the same named socket and replaces the socket file with a new +one. As a result, applications hang when they try talking to dbus. + +Fix this by finding a match not only when the path names are equal, but +also when they point to the same inode. +In socket_address_equal() it is necessary to move the address size +comparison into the abstract sockets branch. For path name sockets the +comparison must not be done and for other families it is redundant +(their sizes are constant and checked by socket_address_verify()). + +FIFOs and special files can also have multiple pathnames, so compare the +inodes for them as well. Note that previously the pathname checks used +streq_ptr(), but the paths cannot be NULL. + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1186018 +--- + src/core/socket.c | 6 +++--- + src/shared/path-util.c | 4 ++++ + src/shared/path-util.h | 1 + + src/shared/socket-util.c | 10 ++++------ + 4 files changed, 12 insertions(+), 9 deletions(-) + +diff --git a/src/core/socket.c b/src/core/socket.c +index 48c43a2..88aae48 100644 +--- a/src/core/socket.c ++++ b/src/core/socket.c +@@ -2100,7 +2100,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, + + LIST_FOREACH(port, p, s->ports) + if (p->type == SOCKET_FIFO && +- streq_ptr(p->path, value+skip)) ++ path_equal_or_files_same(p->path, value+skip)) + break; + + if (p) { +@@ -2119,7 +2119,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, + + LIST_FOREACH(port, p, s->ports) + if (p->type == SOCKET_SPECIAL && +- streq_ptr(p->path, value+skip)) ++ path_equal_or_files_same(p->path, value+skip)) + break; + + if (p) { +@@ -2138,7 +2138,7 @@ static int socket_deserialize_item(Unit *u, const char *key, const char *value, + + LIST_FOREACH(port, p, s->ports) + if (p->type == SOCKET_MQUEUE && +- streq_ptr(p->path, value+skip)) ++ streq(p->path, value+skip)) + break; + + if (p) { +diff --git a/src/shared/path-util.c b/src/shared/path-util.c +index b9db7f1..70bc1ca 100644 +--- a/src/shared/path-util.c ++++ b/src/shared/path-util.c +@@ -436,6 +436,10 @@ bool path_equal(const char *a, const char *b) { + } + } + ++bool path_equal_or_files_same(const char *a, const char *b) { ++ return path_equal(a, b) || files_same(a, b) > 0; ++} ++ + char* path_join(const char *root, const char *path, const char *rest) { + assert(path); + +diff --git a/src/shared/path-util.h b/src/shared/path-util.h +index bd0d324..bcf116e 100644 +--- a/src/shared/path-util.h ++++ b/src/shared/path-util.h +@@ -45,6 +45,7 @@ int path_make_relative(const char *from_dir, const char *to_path, char **_r); + char* path_kill_slashes(char *path); + char* path_startswith(const char *path, const char *prefix) _pure_; + bool path_equal(const char *a, const char *b) _pure_; ++bool path_equal_or_files_same(const char *a, const char *b); + char* path_join(const char *root, const char *path, const char *rest); + + char** path_strv_make_absolute_cwd(char **l); +diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c +index c6f6487..c278d6f 100644 +--- a/src/shared/socket-util.c ++++ b/src/shared/socket-util.c +@@ -325,9 +325,6 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) { + if (a->type != b->type) + return false; + +- if (a->size != b->size) +- return false; +- + if (socket_address_family(a) != socket_address_family(b)) + return false; + +@@ -352,14 +349,16 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) { + break; + + case AF_UNIX: +- + if ((a->sockaddr.un.sun_path[0] == 0) != (b->sockaddr.un.sun_path[0] == 0)) + return false; + + if (a->sockaddr.un.sun_path[0]) { +- if (!strneq(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path, sizeof(a->sockaddr.un.sun_path))) ++ if (!path_equal_or_files_same(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path)) + return false; + } else { ++ if (a->size != b->size) ++ return false; ++ + if (memcmp(a->sockaddr.un.sun_path, b->sockaddr.un.sun_path, a->size) != 0) + return false; + } +@@ -367,7 +366,6 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) { + break; + + case AF_NETLINK: +- + if (a->protocol != b->protocol) + return false; + +-- +2.3.2 + diff --git a/core/systemd/0001-journal-fix-dangling-else-ambiguity.patch b/core/systemd/0001-journal-fix-dangling-else-ambiguity.patch deleted file mode 100644 index d05e8c295..000000000 --- a/core/systemd/0001-journal-fix-dangling-else-ambiguity.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 8d1c8bd746a6a14dec7470f93f843bcb0699f4b8 Mon Sep 17 00:00:00 2001 -From: David Herrmann -Date: Fri, 12 Dec 2014 09:52:06 +0100 -Subject: [PATCH] journal: fix dangling 'else' ambiguity - -Rework the sd-journal iterators to avoid dangling 'else' ambiguity. For a -detailed explanation, see: - - commit bff686e2a981ccd0888cdf1981977d24320f1770 - Author: David Herrmann - Date: Fri Dec 12 09:43:54 2014 +0100 - - hwdb: fix dangling 'else' ambuguity ---- - src/systemd/sd-journal.h | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/src/systemd/sd-journal.h b/src/systemd/sd-journal.h -index eb24372..00237a2 100644 ---- a/src/systemd/sd-journal.h -+++ b/src/systemd/sd-journal.h -@@ -138,13 +138,15 @@ int sd_journal_reliable_fd(sd_journal *j); - int sd_journal_get_catalog(sd_journal *j, char **text); - int sd_journal_get_catalog_for_message_id(sd_id128_t id, char **text); - -+/* the inverse condition avoids ambiguity of danling 'else' after the macro */ - #define SD_JOURNAL_FOREACH(j) \ -- if (sd_journal_seek_head(j) >= 0) \ -- while (sd_journal_next(j) > 0) -+ if (sd_journal_seek_head(j) < 0) { } \ -+ else while (sd_journal_next(j) > 0) - -+/* the inverse condition avoids ambiguity of danling 'else' after the macro */ - #define SD_JOURNAL_FOREACH_BACKWARDS(j) \ -- if (sd_journal_seek_tail(j) >= 0) \ -- while (sd_journal_previous(j) > 0) -+ if (sd_journal_seek_tail(j) < 0) { } \ -+ else while (sd_journal_previous(j) > 0) - - #define SD_JOURNAL_FOREACH_DATA(j, data, l) \ - for (sd_journal_restart_data(j); sd_journal_enumerate_data((j), &(data), &(l)) > 0; ) --- -2.3.0 - diff --git a/core/systemd/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch b/core/systemd/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch new file mode 100644 index 000000000..3e3c9e4c4 --- /dev/null +++ b/core/systemd/0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch @@ -0,0 +1,293 @@ +From 9c857b9d160c10b4454fc9f83442c1878343422f Mon Sep 17 00:00:00 2001 +From: Lennart Poettering +Date: Wed, 18 Feb 2015 23:32:55 +0100 +Subject: [PATCH] nspawn: when connected to pipes for stdin/stdout, pass them + as-is to PID 1 + +Previously we always invoked the container PID 1 on /dev/console of the +container. With this change we do so only if nspawn was invoked +interactively (i.e. its stdin/stdout was connected to a TTY). In all other +cases we directly pass through the fds unmodified. + +This has the benefit that nspawn can be added into shell pipelines. + +https://bugs.freedesktop.org/show_bug.cgi?id=87732 +--- + src/machine/machinectl.c | 2 +- + src/nspawn/nspawn.c | 48 +++++++++++++++++-------------- + src/run/run.c | 2 +- + src/shared/ptyfwd.c | 75 ++++++++++++++++++++++++++++-------------------- + src/shared/ptyfwd.h | 2 +- + 5 files changed, 74 insertions(+), 55 deletions(-) + +diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c +index 053c8fb..55cd854 100644 +--- a/src/machine/machinectl.c ++++ b/src/machine/machinectl.c +@@ -1150,7 +1150,7 @@ static int login_machine(int argc, char *argv[], void *userdata) { + sd_event_add_signal(event, NULL, SIGINT, NULL, NULL); + sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL); + +- r = pty_forward_new(event, master, true, &forward); ++ r = pty_forward_new(event, master, true, false, &forward); + if (r < 0) + return log_error_errno(r, "Failed to create PTY forwarder: %m"); + +diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c +index 232629d..c84ed11 100644 +--- a/src/nspawn/nspawn.c ++++ b/src/nspawn/nspawn.c +@@ -3606,6 +3606,7 @@ int main(int argc, char *argv[]) { + int ret = EXIT_SUCCESS; + union in_addr_union exposed = {}; + _cleanup_release_lock_file_ LockFile tree_global_lock = LOCK_FILE_INIT, tree_local_lock = LOCK_FILE_INIT; ++ bool interactive; + + log_parse_environment(); + log_open(); +@@ -3779,6 +3780,8 @@ int main(int argc, char *argv[]) { + goto finish; + } + ++ interactive = isatty(STDIN_FILENO) > 0 && isatty(STDOUT_FILENO) > 0; ++ + master = posix_openpt(O_RDWR|O_NOCTTY|O_CLOEXEC|O_NDELAY); + if (master < 0) { + r = log_error_errno(errno, "Failed to acquire pseudo tty: %m"); +@@ -3791,15 +3794,15 @@ int main(int argc, char *argv[]) { + goto finish; + } + +- if (!arg_quiet) +- log_info("Spawning container %s on %s.\nPress ^] three times within 1s to kill container.", +- arg_machine, arg_image ?: arg_directory); +- + if (unlockpt(master) < 0) { + r = log_error_errno(errno, "Failed to unlock tty: %m"); + goto finish; + } + ++ if (!arg_quiet) ++ log_info("Spawning container %s on %s.\nPress ^] three times within 1s to kill container.", ++ arg_machine, arg_image ?: arg_directory); ++ + assert_se(sigemptyset(&mask) == 0); + sigset_add_many(&mask, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, -1); + assert_se(sigprocmask(SIG_BLOCK, &mask, NULL) == 0); +@@ -3885,9 +3888,6 @@ int main(int argc, char *argv[]) { + + master = safe_close(master); + +- close_nointr(STDIN_FILENO); +- close_nointr(STDOUT_FILENO); +- close_nointr(STDERR_FILENO); + + kmsg_socket_pair[0] = safe_close(kmsg_socket_pair[0]); + rtnl_socket_pair[0] = safe_close(rtnl_socket_pair[0]); +@@ -3895,21 +3895,27 @@ int main(int argc, char *argv[]) { + reset_all_signal_handlers(); + reset_signal_mask(); + +- r = open_terminal(console, O_RDWR); +- if (r != STDIN_FILENO) { +- if (r >= 0) { +- safe_close(r); +- r = -EINVAL; +- } ++ if (interactive) { ++ close_nointr(STDIN_FILENO); ++ close_nointr(STDOUT_FILENO); ++ close_nointr(STDERR_FILENO); + +- log_error_errno(r, "Failed to open console: %m"); +- _exit(EXIT_FAILURE); +- } ++ r = open_terminal(console, O_RDWR); ++ if (r != STDIN_FILENO) { ++ if (r >= 0) { ++ safe_close(r); ++ r = -EINVAL; ++ } + +- if (dup2(STDIN_FILENO, STDOUT_FILENO) != STDOUT_FILENO || +- dup2(STDIN_FILENO, STDERR_FILENO) != STDERR_FILENO) { +- log_error_errno(errno, "Failed to duplicate console: %m"); +- _exit(EXIT_FAILURE); ++ log_error_errno(r, "Failed to open console: %m"); ++ _exit(EXIT_FAILURE); ++ } ++ ++ if (dup2(STDIN_FILENO, STDOUT_FILENO) != STDOUT_FILENO || ++ dup2(STDIN_FILENO, STDERR_FILENO) != STDERR_FILENO) { ++ log_error_errno(errno, "Failed to duplicate console: %m"); ++ _exit(EXIT_FAILURE); ++ } + } + + if (setsid() < 0) { +@@ -4252,7 +4258,7 @@ int main(int argc, char *argv[]) { + + rtnl_socket_pair[0] = safe_close(rtnl_socket_pair[0]); + +- r = pty_forward_new(event, master, true, &forward); ++ r = pty_forward_new(event, master, true, !interactive, &forward); + if (r < 0) { + log_error_errno(r, "Failed to create PTY forwarder: %m"); + goto finish; +diff --git a/src/run/run.c b/src/run/run.c +index 32191a6..3ded2c7 100644 +--- a/src/run/run.c ++++ b/src/run/run.c +@@ -776,7 +776,7 @@ static int start_transient_service( + if (!arg_quiet) + log_info("Running as unit %s.\nPress ^] three times within 1s to disconnect TTY.", service); + +- r = pty_forward_new(event, master, false, &forward); ++ r = pty_forward_new(event, master, false, false, &forward); + if (r < 0) + return log_error_errno(r, "Failed to create PTY forwarder: %m"); + +diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c +index 31274a1..164c9b6 100644 +--- a/src/shared/ptyfwd.c ++++ b/src/shared/ptyfwd.c +@@ -42,6 +42,8 @@ struct PTYForward { + struct termios saved_stdin_attr; + struct termios saved_stdout_attr; + ++ bool read_only:1; ++ + bool saved_stdin:1; + bool saved_stdout:1; + +@@ -298,7 +300,13 @@ static int on_sigwinch_event(sd_event_source *e, const struct signalfd_siginfo * + return 0; + } + +-int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward **ret) { ++int pty_forward_new( ++ sd_event *event, ++ int master, ++ bool ignore_vhangup, ++ bool read_only, ++ PTYForward **ret) { ++ + _cleanup_(pty_forward_freep) PTYForward *f = NULL; + struct winsize ws; + int r; +@@ -307,6 +315,7 @@ int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward + if (!f) + return -ENOMEM; + ++ f->read_only = read_only; + f->ignore_vhangup = ignore_vhangup; + + if (event) +@@ -317,13 +326,15 @@ int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward + return r; + } + +- r = fd_nonblock(STDIN_FILENO, true); +- if (r < 0) +- return r; ++ if (!read_only) { ++ r = fd_nonblock(STDIN_FILENO, true); ++ if (r < 0) ++ return r; + +- r = fd_nonblock(STDOUT_FILENO, true); +- if (r < 0) +- return r; ++ r = fd_nonblock(STDOUT_FILENO, true); ++ if (r < 0) ++ return r; ++ } + + r = fd_nonblock(master, true); + if (r < 0) +@@ -334,36 +345,34 @@ int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward + if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws) >= 0) + (void)ioctl(master, TIOCSWINSZ, &ws); + +- if (tcgetattr(STDIN_FILENO, &f->saved_stdin_attr) >= 0) { +- struct termios raw_stdin_attr; +- +- f->saved_stdin = true; ++ if (!read_only) { ++ if (tcgetattr(STDIN_FILENO, &f->saved_stdin_attr) >= 0) { ++ struct termios raw_stdin_attr; + +- raw_stdin_attr = f->saved_stdin_attr; +- cfmakeraw(&raw_stdin_attr); +- raw_stdin_attr.c_oflag = f->saved_stdin_attr.c_oflag; +- tcsetattr(STDIN_FILENO, TCSANOW, &raw_stdin_attr); +- } ++ f->saved_stdin = true; + +- if (tcgetattr(STDOUT_FILENO, &f->saved_stdout_attr) >= 0) { +- struct termios raw_stdout_attr; ++ raw_stdin_attr = f->saved_stdin_attr; ++ cfmakeraw(&raw_stdin_attr); ++ raw_stdin_attr.c_oflag = f->saved_stdin_attr.c_oflag; ++ tcsetattr(STDIN_FILENO, TCSANOW, &raw_stdin_attr); ++ } + +- f->saved_stdout = true; ++ if (tcgetattr(STDOUT_FILENO, &f->saved_stdout_attr) >= 0) { ++ struct termios raw_stdout_attr; + +- raw_stdout_attr = f->saved_stdout_attr; +- cfmakeraw(&raw_stdout_attr); +- raw_stdout_attr.c_iflag = f->saved_stdout_attr.c_iflag; +- raw_stdout_attr.c_lflag = f->saved_stdout_attr.c_lflag; +- tcsetattr(STDOUT_FILENO, TCSANOW, &raw_stdout_attr); +- } ++ f->saved_stdout = true; + +- r = sd_event_add_io(f->event, &f->master_event_source, master, EPOLLIN|EPOLLOUT|EPOLLET, on_master_event, f); +- if (r < 0) +- return r; ++ raw_stdout_attr = f->saved_stdout_attr; ++ cfmakeraw(&raw_stdout_attr); ++ raw_stdout_attr.c_iflag = f->saved_stdout_attr.c_iflag; ++ raw_stdout_attr.c_lflag = f->saved_stdout_attr.c_lflag; ++ tcsetattr(STDOUT_FILENO, TCSANOW, &raw_stdout_attr); ++ } + +- r = sd_event_add_io(f->event, &f->stdin_event_source, STDIN_FILENO, EPOLLIN|EPOLLET, on_stdin_event, f); +- if (r < 0 && r != -EPERM) +- return r; ++ r = sd_event_add_io(f->event, &f->stdin_event_source, STDIN_FILENO, EPOLLIN|EPOLLET, on_stdin_event, f); ++ if (r < 0 && r != -EPERM) ++ return r; ++ } + + r = sd_event_add_io(f->event, &f->stdout_event_source, STDOUT_FILENO, EPOLLOUT|EPOLLET, on_stdout_event, f); + if (r == -EPERM) +@@ -372,6 +381,10 @@ int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward + else if (r < 0) + return r; + ++ r = sd_event_add_io(f->event, &f->master_event_source, master, EPOLLIN|EPOLLOUT|EPOLLET, on_master_event, f); ++ if (r < 0) ++ return r; ++ + r = sd_event_add_signal(f->event, &f->sigwinch_event_source, SIGWINCH, on_sigwinch_event, f); + if (r < 0) + return r; +diff --git a/src/shared/ptyfwd.h b/src/shared/ptyfwd.h +index d3e229b..6208a54 100644 +--- a/src/shared/ptyfwd.h ++++ b/src/shared/ptyfwd.h +@@ -30,7 +30,7 @@ + + typedef struct PTYForward PTYForward; + +-int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, PTYForward **f); ++int pty_forward_new(sd_event *event, int master, bool ignore_vhangup, bool read_only, PTYForward **f); + PTYForward *pty_forward_free(PTYForward *f); + + int pty_forward_get_last_char(PTYForward *f, char *ch); +-- +2.3.2 + diff --git a/core/systemd/0001-tmpfiles-Fix-handling-of-duplicate-lines.patch b/core/systemd/0001-tmpfiles-Fix-handling-of-duplicate-lines.patch new file mode 100644 index 000000000..fdf73f755 --- /dev/null +++ b/core/systemd/0001-tmpfiles-Fix-handling-of-duplicate-lines.patch @@ -0,0 +1,34 @@ +From 6487ada88d63e4998113f4c57fa10b7c865f8026 Mon Sep 17 00:00:00 2001 +From: Martin Pitt +Date: Thu, 5 Mar 2015 14:58:56 +0100 +Subject: [PATCH] tmpfiles: Fix handling of duplicate lines + +Commit 3f93da987 accidentally dropped the "return 0" after detection of a +duplicate line. Put it back, to get back the documented and intended "first +match wins" behaviour. + +https://launchpad.net/bugs/1428540 +--- + src/tmpfiles/tmpfiles.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c +index 917bb3c..652fe5f 100644 +--- a/src/tmpfiles/tmpfiles.c ++++ b/src/tmpfiles/tmpfiles.c +@@ -1746,9 +1746,11 @@ static int parse_line(const char *fname, unsigned line, const char *buffer) { + unsigned n; + + for (n = 0; n < existing->count; n++) { +- if (!item_compatible(existing->items + n, &i)) ++ if (!item_compatible(existing->items + n, &i)) { + log_warning("[%s:%u] Duplicate line for path \"%s\", ignoring.", + fname, line, i.path); ++ return 0; ++ } + } + } else { + existing = new0(ItemArray, 1); +-- +2.3.2 + diff --git a/core/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch b/core/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch new file mode 100644 index 000000000..b9af3e7ce --- /dev/null +++ b/core/systemd/0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch @@ -0,0 +1,129 @@ +From 1c73f3bc29111a00738569c9d40a989b161a0624 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Mon, 23 Feb 2015 23:19:54 -0500 +Subject: [PATCH] tmpfiles: avoid creating duplicate acl entries + +https://bugs.freedesktop.org/show_bug.cgi?id=89202 +https://bugs.debian.org/778656 + +Status quo ante can be restored with: + getfacl -p /var/log/journal/`cat /etc/machine-id`|grep -v '^#'|sort -u|sudo setfacl --set-file=- /var/log/journal/`cat /etc/machine-id` +--- + src/shared/acl-util.c | 79 +++++++++++++++++++++++++++++++++++++++++++++++++-- + src/shared/acl-util.h | 4 +++ + 2 files changed, 81 insertions(+), 2 deletions(-) + +diff --git a/src/shared/acl-util.c b/src/shared/acl-util.c +index 34707e6..36dc824 100644 +--- a/src/shared/acl-util.c ++++ b/src/shared/acl-util.c +@@ -281,6 +281,77 @@ int parse_acl(char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask) + return 0; + } + ++static int acl_entry_equal(acl_entry_t a, acl_entry_t b) { ++ acl_tag_t tag_a, tag_b; ++ ++ if (acl_get_tag_type(a, &tag_a) < 0) ++ return -errno; ++ ++ if (acl_get_tag_type(b, &tag_b) < 0) ++ return -errno; ++ ++ if (tag_a != tag_b) ++ return false; ++ ++ switch (tag_a) { ++ case ACL_USER_OBJ: ++ case ACL_GROUP_OBJ: ++ case ACL_MASK: ++ case ACL_OTHER: ++ /* can have only one of those */ ++ return true; ++ case ACL_USER: { ++ _cleanup_(acl_free_uid_tpp) uid_t *uid_a, *uid_b; ++ ++ uid_a = acl_get_qualifier(a); ++ if (!uid_a) ++ return -errno; ++ ++ uid_b = acl_get_qualifier(b); ++ if (!uid_b) ++ return -errno; ++ ++ return *uid_a == *uid_b; ++ } ++ case ACL_GROUP: { ++ _cleanup_(acl_free_gid_tpp) gid_t *gid_a, *gid_b; ++ ++ gid_a = acl_get_qualifier(a); ++ if (!gid_a) ++ return -errno; ++ ++ gid_b = acl_get_qualifier(b); ++ if (!gid_b) ++ return -errno; ++ ++ return *gid_a == *gid_b; ++ } ++ default: ++ assert_not_reached("Unknown acl tag type"); ++ } ++} ++ ++static int find_acl_entry(acl_t acl, acl_entry_t entry, acl_entry_t *out) { ++ acl_entry_t i; ++ int r; ++ ++ for (r = acl_get_entry(acl, ACL_FIRST_ENTRY, &i); ++ r > 0; ++ r = acl_get_entry(acl, ACL_NEXT_ENTRY, &i)) { ++ ++ r = acl_entry_equal(i, entry); ++ if (r < 0) ++ return r; ++ if (r > 0) { ++ *out = i; ++ return 1; ++ } ++ } ++ if (r < 0) ++ return -errno; ++ return 0; ++} ++ + int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) { + _cleanup_(acl_freep) acl_t old; + acl_entry_t i; +@@ -296,8 +367,12 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl) { + + acl_entry_t j; + +- if (acl_create_entry(&old, &j) < 0) +- return -errno; ++ r = find_acl_entry(old, i, &j); ++ if (r < 0) ++ return r; ++ if (r == 0) ++ if (acl_create_entry(&old, &j) < 0) ++ return -errno; + + if (acl_copy_entry(j, i) < 0) + return -errno; +diff --git a/src/shared/acl-util.h b/src/shared/acl-util.h +index 90e88ff..fdb9006 100644 +--- a/src/shared/acl-util.h ++++ b/src/shared/acl-util.h +@@ -41,5 +41,9 @@ int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl); + DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free); + #define acl_free_charp acl_free + DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp); ++#define acl_free_uid_tp acl_free ++DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp); ++#define acl_free_gid_tp acl_free ++DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp); + + #endif +-- +2.3.2 + diff --git a/core/systemd/0001-use-x-machine-unix-prefix-for-the-container-bus-on-dbus1.patch b/core/systemd/0001-use-x-machine-unix-prefix-for-the-container-bus-on-dbus1.patch new file mode 100644 index 000000000..0c685f6e0 --- /dev/null +++ b/core/systemd/0001-use-x-machine-unix-prefix-for-the-container-bus-on-dbus1.patch @@ -0,0 +1,28 @@ +From f2273101c21bc59a390379e182e53cd4f07a7e71 Mon Sep 17 00:00:00 2001 +From: Benjamin Franzke +Date: Thu, 19 Feb 2015 20:47:28 +0100 +Subject: machined: use x-machine-unix prefix for the container bus on dbus1 + +This fixes "machinectl login" on systems configured with --disable-kdbus. + +The error was: +machinectl login foo +Failed to get machine PTY: Input/output error + +diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c +index 15c9159..9e78a67 100644 +--- a/src/machine/machine-dbus.c ++++ b/src/machine/machine-dbus.c +@@ -511,7 +511,7 @@ int bus_machine_method_open_login(sd_bus *bus, sd_bus_message *message, void *us + #ifdef ENABLE_KDBUS + asprintf(&container_bus->address, "x-machine-kernel:pid=" PID_FMT ";x-machine-unix:pid=" PID_FMT, m->leader, m->leader); + #else +- asprintf(&container_bus->address, "x-machine-kernel:pid=" PID_FMT, m->leader); ++ asprintf(&container_bus->address, "x-machine-unix:pid=" PID_FMT, m->leader); + #endif + if (!container_bus->address) + return log_oom(); +-- +cgit v0.10.2 + + diff --git a/core/systemd/0002-nspawn-properly-validate-machine-names.patch b/core/systemd/0002-nspawn-properly-validate-machine-names.patch deleted file mode 100644 index ae404bd24..000000000 --- a/core/systemd/0002-nspawn-properly-validate-machine-names.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 0c3c42847da2f614f1a3f93c7cc96cd241e17e3a Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Fri, 12 Dec 2014 02:49:40 +0100 -Subject: [PATCH] nspawn: properly validate machine names - ---- - src/nspawn/nspawn.c | 8 +++----- - 1 file changed, 3 insertions(+), 5 deletions(-) - -diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c -index 0466ddb..e1e1c36 100644 ---- a/src/nspawn/nspawn.c -+++ b/src/nspawn/nspawn.c -@@ -369,15 +369,13 @@ static int parse_argv(int argc, char *argv[]) { - free(arg_machine); - arg_machine = NULL; - } else { -- -- if (!hostname_is_valid(optarg)) { -+ if (!machine_name_is_valid(optarg)) { - log_error("Invalid machine name: %s", optarg); - return -EINVAL; - } - -- free(arg_machine); -- arg_machine = strdup(optarg); -- if (!arg_machine) -+ r = free_and_strdup(&arg_machine, optarg); -+ if (r < 0) - return log_oom(); - - break; --- -2.3.0 - diff --git a/core/systemd/0003-systemctl-fix-argument-handling-when-invoked-as-shut.patch b/core/systemd/0003-systemctl-fix-argument-handling-when-invoked-as-shut.patch deleted file mode 100644 index d961b1699..000000000 --- a/core/systemd/0003-systemctl-fix-argument-handling-when-invoked-as-shut.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 75836b9d2071aab978ee78d7d797126a18a32052 Mon Sep 17 00:00:00 2001 -From: Jan Synacek -Date: Mon, 15 Dec 2014 10:39:00 +0100 -Subject: [PATCH] systemctl: fix argument handling when invoked as "shutdown" - ---- - src/systemctl/systemctl.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c -index 649fb5c..4c4648f 100644 ---- a/src/systemctl/systemctl.c -+++ b/src/systemctl/systemctl.c -@@ -6926,7 +6926,7 @@ static int shutdown_parse_argv(int argc, char *argv[]) { - assert(argc >= 0); - assert(argv); - -- while ((c = getopt_long(argc, argv, "HPrhkt:afFc", options, NULL)) >= 0) -+ while ((c = getopt_long(argc, argv, "HPrhkKt:afFc", options, NULL)) >= 0) - switch (c) { - - case ARG_HELP: -@@ -6967,6 +6967,8 @@ static int shutdown_parse_argv(int argc, char *argv[]) { - - case 't': - case 'a': -+ case 'f': -+ case 'F': - /* Compatibility nops */ - break; - --- -2.3.0 - diff --git a/core/systemd/0004-systemctl-properly-iterate-through-service-array-whe.patch b/core/systemd/0004-systemctl-properly-iterate-through-service-array-whe.patch deleted file mode 100644 index c04fb75b1..000000000 --- a/core/systemd/0004-systemctl-properly-iterate-through-service-array-whe.patch +++ /dev/null @@ -1,31 +0,0 @@ -From aba843317d8acc4634417becebaedcfe5805d49d Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Mon, 5 Jan 2015 01:56:47 +0100 -Subject: [PATCH] systemctl: properly iterate through service array when - dispatching to sysv - -https://bugzilla.redhat.com/show_bug.cgi?id=1175734 ---- - src/systemctl/systemctl.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c -index 9c4b9ed..3d939f0 100644 ---- a/src/systemctl/systemctl.c -+++ b/src/systemctl/systemctl.c -@@ -5188,8 +5188,10 @@ static int enable_sysv_units(const char *verb, char **args) { - return -EPROTO; - - /* Remove this entry, so that we don't try enabling it as native unit */ -- assert(f > 0 && streq(args[f-1], name)); -- assert_se(strv_remove(args + f - 1, name)); -+ assert(f > 0); -+ f--; -+ assert(args[f] == name); -+ strv_remove(args, name); - } - - #endif --- -2.3.0 - diff --git a/core/systemd/0005-nss-myhostname-always-will-in-canonical-hostname-fie.patch b/core/systemd/0005-nss-myhostname-always-will-in-canonical-hostname-fie.patch deleted file mode 100644 index acb1ed828..000000000 --- a/core/systemd/0005-nss-myhostname-always-will-in-canonical-hostname-fie.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 3fdcecc87eb381ef300719e419d5863dd8a64a97 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Mon, 5 Jan 2015 16:23:21 +0100 -Subject: [PATCH] nss-myhostname: always will in canonical hostname field when - resolving addresses to hostnames - -https://bugs.freedesktop.org/show_bug.cgi?id=87634 ---- - src/nss-myhostname/nss-myhostname.c | 36 +++++++++++++++++++----------------- - 1 file changed, 19 insertions(+), 17 deletions(-) - -diff --git a/src/nss-myhostname/nss-myhostname.c b/src/nss-myhostname/nss-myhostname.c -index dcf7c1f..a939bb2 100644 ---- a/src/nss-myhostname/nss-myhostname.c -+++ b/src/nss-myhostname/nss-myhostname.c -@@ -38,7 +38,7 @@ - /* We use 127.0.0.2 as IPv4 address. This has the advantage over - * 127.0.0.1 that it can be translated back to the local hostname. For - * IPv6 we use ::1 which unfortunately will not translate back to the -- * hostname but instead something like "localhost6" or so. */ -+ * hostname but instead something like "localhost" or so. */ - - #define LOCALADDRESS_IPV4 (htonl(0x7F000002)) - #define LOCALADDRESS_IPV6 &in6addr_loopback -@@ -415,6 +415,7 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - _cleanup_free_ char *hn = NULL; - int n_addresses = 0; - struct local_address *a; -+ bool additional_from_hostname = false; - unsigned n; - - assert(addr); -@@ -436,7 +437,6 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - } - - if (af == AF_INET) { -- - if ((*(uint32_t*) addr) == LOCALADDRESS_IPV4) - goto found; - -@@ -450,10 +450,10 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - assert(af == AF_INET6); - - if (memcmp(addr, LOCALADDRESS_IPV6, 16) == 0) { -- additional = "localhost"; -+ canonical = "localhost"; -+ additional_from_hostname = true; - goto found; - } -- - } - - n_addresses = local_addresses(NULL, 0, AF_UNSPEC, &addresses); -@@ -462,18 +462,8 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - if (af != a->family) - continue; - -- if (memcmp(addr, &a->address, FAMILY_ADDRESS_SIZE(af)) == 0) { -- -- hn = gethostname_malloc(); -- if (!hn) { -- *errnop = ENOMEM; -- *h_errnop = NO_RECOVERY; -- return NSS_STATUS_TRYAGAIN; -- } -- -- canonical = hn; -+ if (memcmp(addr, &a->address, FAMILY_ADDRESS_SIZE(af)) == 0) - goto found; -- } - } - } - -@@ -487,7 +477,6 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - continue; - - if (memcmp(addr, &a->address, FAMILY_ADDRESS_SIZE(af)) == 0) { -- - canonical = "gateway"; - goto found; - } -@@ -500,6 +489,20 @@ enum nss_status _nss_myhostname_gethostbyaddr2_r( - return NSS_STATUS_NOTFOUND; - - found: -+ if (!canonical || (!additional && additional_from_hostname)) { -+ hn = gethostname_malloc(); -+ if (!hn) { -+ *errnop = ENOMEM; -+ *h_errnop = NO_RECOVERY; -+ return NSS_STATUS_TRYAGAIN; -+ } -+ -+ if (!canonical) -+ canonical = hn; -+ -+ if (!additional && additional_from_hostname) -+ additional = hn; -+ } - - return fill_in_hostent( - canonical, additional, -@@ -511,7 +514,6 @@ found: - errnop, h_errnop, - ttlp, - NULL); -- - } - - NSS_GETHOSTBYNAME_FALLBACKS(myhostname); --- -2.3.0 - diff --git a/core/systemd/0010-log-fix-log_full_errno-with-custom-facilities.patch b/core/systemd/0010-log-fix-log_full_errno-with-custom-facilities.patch deleted file mode 100644 index 4bbf937b6..000000000 --- a/core/systemd/0010-log-fix-log_full_errno-with-custom-facilities.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 24b759c5d79c1a4993c05c1ef7f44f9ff6d7f463 Mon Sep 17 00:00:00 2001 -From: David Herrmann -Date: Sun, 11 Jan 2015 03:13:46 +0100 -Subject: [PATCH] log: fix log_full_errno() with custom facilities - -Make sure to extract the log-priority when comparing against -max-log-level, otherwise, we will always drop those messages. - -This fixes bus-proxyd to properly send warnings on policy blocks. ---- - src/shared/log.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/shared/log.h b/src/shared/log.h -index 2b6971f..d15d7c8 100644 ---- a/src/shared/log.h -+++ b/src/shared/log.h -@@ -158,7 +158,7 @@ void log_assert_failed_return( - #define log_full_errno(level, error, ...) \ - ({ \ - int _l = (level), _e = (error); \ -- (log_get_max_level() >= _l) \ -+ (log_get_max_level() >= LOG_PRI(_l)) \ - ? log_internal(_l, _e, __FILE__, __LINE__, __func__, __VA_ARGS__) \ - : -abs(_e); \ - }) --- -2.3.0 - diff --git a/core/systemd/0014-timesyncd-consider-too-long-packets-as-invalid.patch b/core/systemd/0014-timesyncd-consider-too-long-packets-as-invalid.patch deleted file mode 100644 index b940d2d2e..000000000 --- a/core/systemd/0014-timesyncd-consider-too-long-packets-as-invalid.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 43fcd650e5cb0836cfc9f667ed74b3bc0283a81c Mon Sep 17 00:00:00 2001 -From: Topi Miettinen -Date: Sun, 18 Jan 2015 16:01:25 +0200 -Subject: [PATCH] timesyncd: consider too long packets as invalid - -If the received NTP message from server didn't fit to our buffer, either -it is doing something nasty or we don't know the protocol. Consider the -packet as invalid. - -(David: add parantheses around conditional) ---- - src/timesync/timesyncd-manager.c | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c -index 117ea8c..bc35662 100644 ---- a/src/timesync/timesyncd-manager.c -+++ b/src/timesync/timesyncd-manager.c -@@ -525,7 +525,8 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re - return manager_connect(m); - } - -- if (iov.iov_len < sizeof(struct ntp_msg)) { -+ /* Too short or too long packet? */ -+ if (iov.iov_len < sizeof(struct ntp_msg) || (msghdr.msg_flags & MSG_TRUNC)) { - log_warning("Invalid response from server. Disconnecting."); - return manager_connect(m); - } --- -2.3.0 - diff --git a/core/systemd/0016-logind-fix-sd_eviocrevoke-ioctl-call.patch b/core/systemd/0016-logind-fix-sd_eviocrevoke-ioctl-call.patch deleted file mode 100644 index f32ba0660..000000000 --- a/core/systemd/0016-logind-fix-sd_eviocrevoke-ioctl-call.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 8dbce34b0373923c7aa7d795024bbedb0a85c7ea Mon Sep 17 00:00:00 2001 -From: Peter Hutterer -Date: Thu, 22 Jan 2015 11:36:02 +1000 -Subject: [PATCH] logind: fix sd_eviocrevoke ioctl call - -If the third argument is non-null, the kernel will always error out with -EINVAL and devices won't get revoked. - -Reported-by: Benjamin Tissoires -Signed-off-by: Peter Hutterer ---- - src/login/logind-session-device.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/login/logind-session-device.c b/src/login/logind-session-device.c -index 932abb8..c2de862 100644 ---- a/src/login/logind-session-device.c -+++ b/src/login/logind-session-device.c -@@ -107,7 +107,7 @@ static int sd_eviocrevoke(int fd) { - - assert(fd >= 0); - -- r = ioctl(fd, EVIOCREVOKE, 1); -+ r = ioctl(fd, EVIOCREVOKE, NULL); - if (r < 0) { - r = -errno; - if (r == -EINVAL && !warned) { --- -2.3.0 - diff --git a/core/systemd/0019-sd-bus-fix-handling-of-double-parameters-in-sd_bus_m.patch b/core/systemd/0019-sd-bus-fix-handling-of-double-parameters-in-sd_bus_m.patch deleted file mode 100644 index 35fd52ec1..000000000 --- a/core/systemd/0019-sd-bus-fix-handling-of-double-parameters-in-sd_bus_m.patch +++ /dev/null @@ -1,91 +0,0 @@ -From 6cd37a5e59e01f4a2b3f02d9746b3e7417d424e6 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Fri, 23 Jan 2015 01:13:09 +0100 -Subject: [PATCH] sd-bus: fix handling of double parameters in - sd_bus_message_append() - -We really need to use va_arg() with the right type here as uint64_t and -double might have the same size, but are passed differently as -arguments. ---- - src/libsystemd/sd-bus/bus-message.c | 11 +++++++++-- - src/libsystemd/sd-bus/test-bus-marshal.c | 13 +++++++++++++ - 2 files changed, 22 insertions(+), 2 deletions(-) - -diff --git a/src/libsystemd/sd-bus/bus-message.c b/src/libsystemd/sd-bus/bus-message.c -index 23076d2..9ae65be 100644 ---- a/src/libsystemd/sd-bus/bus-message.c -+++ b/src/libsystemd/sd-bus/bus-message.c -@@ -2350,8 +2350,7 @@ int bus_message_append_ap( - } - - case SD_BUS_TYPE_INT64: -- case SD_BUS_TYPE_UINT64: -- case SD_BUS_TYPE_DOUBLE: { -+ case SD_BUS_TYPE_UINT64: { - uint64_t x; - - x = va_arg(ap, uint64_t); -@@ -2359,6 +2358,14 @@ int bus_message_append_ap( - break; - } - -+ case SD_BUS_TYPE_DOUBLE: { -+ double x; -+ -+ x = va_arg(ap, double); -+ r = sd_bus_message_append_basic(m, *t, &x); -+ break; -+ } -+ - case SD_BUS_TYPE_STRING: - case SD_BUS_TYPE_OBJECT_PATH: - case SD_BUS_TYPE_SIGNATURE: { -diff --git a/src/libsystemd/sd-bus/test-bus-marshal.c b/src/libsystemd/sd-bus/test-bus-marshal.c -index 8cefc7a..d95a03c 100644 ---- a/src/libsystemd/sd-bus/test-bus-marshal.c -+++ b/src/libsystemd/sd-bus/test-bus-marshal.c -@@ -22,6 +22,7 @@ - #include - #include - #include -+#include - - #ifdef HAVE_GLIB - #include -@@ -94,6 +95,8 @@ int main(int argc, char *argv[]) { - _cleanup_fclose_ FILE *ms = NULL; - size_t first_size = 0, second_size = 0, third_size = 0; - _cleanup_bus_unref_ sd_bus *bus = NULL; -+ double dbl; -+ uint64_t u64; - - r = sd_bus_default_system(&bus); - if (r < 0) -@@ -145,6 +148,9 @@ int main(int argc, char *argv[]) { - r = sd_bus_message_append_array(m, 'u', NULL, 0); - assert_se(r >= 0); - -+ r = sd_bus_message_append(m, "a(stdo)", 1, "foo", 815ULL, 47.0, "/"); -+ assert_se(r >= 0); -+ - r = bus_message_seal(m, 4711, 0); - assert_se(r >= 0); - -@@ -268,6 +274,13 @@ int main(int argc, char *argv[]) { - assert_se(r > 0); - assert_se(sz == 0); - -+ r = sd_bus_message_read(m, "a(stdo)", 1, &x, &u64, &dbl, &y); -+ assert_se(r > 0); -+ assert_se(streq(x, "foo")); -+ assert_se(u64 == 815ULL); -+ assert_se(fabs(dbl - 47.0) < 0.1); -+ assert_se(streq(y, "/")); -+ - r = sd_bus_message_peek_type(m, NULL, NULL); - assert_se(r == 0); - --- -2.3.0 - diff --git a/core/systemd/0021-units-fix-all-TTY-paths-for-container-gettys.patch b/core/systemd/0021-units-fix-all-TTY-paths-for-container-gettys.patch deleted file mode 100644 index aefc34311..000000000 --- a/core/systemd/0021-units-fix-all-TTY-paths-for-container-gettys.patch +++ /dev/null @@ -1,30 +0,0 @@ -From e87bc3ef67a892e2b3dba753190675e5f9b592b5 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Tue, 27 Jan 2015 14:28:45 +0100 -Subject: [PATCH] units: fix all TTY paths for container gettys - -Spotted by Christian Seiler: - -http://lists.freedesktop.org/archives/systemd-devel/2015-January/027441.html ---- - units/container-getty@.service.m4.in | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/units/container-getty@.service.m4.in b/units/container-getty@.service.m4.in -index 5120466..e126f3a 100644 ---- a/units/container-getty@.service.m4.in -+++ b/units/container-getty@.service.m4.in -@@ -21,8 +21,8 @@ ExecStart=-/sbin/agetty --noclear --keep-baud pts/%I 115200,38400,9600 $TERM - Type=idle - Restart=always - RestartSec=0 --UtmpIdentifier=%I --TTYPath=/dev/%I -+UtmpIdentifier=pts/%I -+TTYPath=/dev/pts/%I - TTYReset=yes - TTYVHangup=yes - KillMode=process --- -2.3.0 - diff --git a/core/systemd/0024-sd-dhcp-chop-of-trailing-dot-of-DHCP-supplied-host-a.patch b/core/systemd/0024-sd-dhcp-chop-of-trailing-dot-of-DHCP-supplied-host-a.patch deleted file mode 100644 index 113d20ef4..000000000 --- a/core/systemd/0024-sd-dhcp-chop-of-trailing-dot-of-DHCP-supplied-host-a.patch +++ /dev/null @@ -1,55 +0,0 @@ -From f50f01f4b738f2f00b30d0e02e8cf54ab99a9f27 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Wed, 28 Jan 2015 17:47:37 +0100 -Subject: [PATCH] sd-dhcp: chop of trailing dot of DHCP supplied host and - domain nams - ---- - src/libsystemd-network/sd-dhcp-lease.c | 14 ++++++++++++++ - 1 file changed, 14 insertions(+) - -diff --git a/src/libsystemd-network/sd-dhcp-lease.c b/src/libsystemd-network/sd-dhcp-lease.c -index 00fef16..34aa36c 100644 ---- a/src/libsystemd-network/sd-dhcp-lease.c -+++ b/src/libsystemd-network/sd-dhcp-lease.c -@@ -497,11 +497,20 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option, - case DHCP_OPTION_DOMAIN_NAME: - { - _cleanup_free_ char *domainname = NULL; -+ char *e; - - r = lease_parse_string(option, len, &domainname); - if (r < 0) - return r; - -+ /* Chop off trailing dot of domain name that some DHCP -+ * servers send us back. Internally we want to store -+ * host names without trailing dots and -+ * host_name_is_valid() doesn't accept them. */ -+ e = endswith(domainname, "."); -+ if (e) -+ *e = 0; -+ - if (!hostname_is_valid(domainname) || is_localhost(domainname)) - break; - -@@ -514,11 +523,16 @@ int dhcp_lease_parse_options(uint8_t code, uint8_t len, const uint8_t *option, - case DHCP_OPTION_HOST_NAME: - { - _cleanup_free_ char *hostname = NULL; -+ char *e; - - r = lease_parse_string(option, len, &hostname); - if (r < 0) - return r; - -+ e = endswith(hostname, "."); -+ if (e) -+ *e = 0; -+ - if (!hostname_is_valid(hostname) || is_localhost(hostname)) - break; - --- -2.3.0 - diff --git a/core/systemd/0025-logind-handle-closing-sessions-over-daemon-restarts.patch b/core/systemd/0025-logind-handle-closing-sessions-over-daemon-restarts.patch deleted file mode 100644 index 01d8507f2..000000000 --- a/core/systemd/0025-logind-handle-closing-sessions-over-daemon-restarts.patch +++ /dev/null @@ -1,103 +0,0 @@ -From be94d95499bf9c63fe9331e9b9ecc64f32fe9d79 Mon Sep 17 00:00:00 2001 -From: Martin Pitt -Date: Wed, 28 Jan 2015 18:14:01 +0100 -Subject: [PATCH] logind: handle closing sessions over daemon restarts - -It may happen that you have several sessions with the same VT: - - - Open a session c1 which leaves some processes around, and log out. The - session will stay in State=closing and become Active=no. - - Log back in on the same VT, get a new session "c2" which is State=active and - Active=yes. - -When restarting logind after that, the first session that matches the current -VT becomes Active=yes, which will be c1; c2 thus is Active=no and does not get -the usual polkit/device ACL privileges. - -Restore the "closing" state in session_load(), to avoid treating all restored -sessions as State=active. In seat_active_vt_changed(), prefer active sessions -over closing ones if more than one session matches the current VT. - -Finally, fix the confusing comment in session_load() and explain it a bit -better. - -https://launchpad.net/bugs/1415104 ---- - src/login/logind-seat.c | 14 +++++++++++++- - src/login/logind-session.c | 11 +++++++++-- - 2 files changed, 22 insertions(+), 3 deletions(-) - -diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c -index 197138c..126c5b8 100644 ---- a/src/login/logind-seat.c -+++ b/src/login/logind-seat.c -@@ -340,12 +340,24 @@ int seat_active_vt_changed(Seat *s, unsigned int vtnr) { - - log_debug("VT changed to %u", vtnr); - -+ /* we might have earlier closing sessions on the same VT, so try to -+ * find a running one first */ - LIST_FOREACH(sessions_by_seat, i, s->sessions) -- if (i->vtnr == vtnr) { -+ if (i->vtnr == vtnr && !i->stopping) { - new_active = i; - break; - } - -+ if (!new_active) { -+ /* no running one? then we can't decide which one is the -+ * active one, let the first one win */ -+ LIST_FOREACH(sessions_by_seat, i, s->sessions) -+ if (i->vtnr == vtnr) { -+ new_active = i; -+ break; -+ } -+ } -+ - r = seat_set_active(s, new_active); - manager_spawn_autovt(s->manager, vtnr); - -diff --git a/src/login/logind-session.c b/src/login/logind-session.c -index a51f9f3..a02a537 100644 ---- a/src/login/logind-session.c -+++ b/src/login/logind-session.c -@@ -301,6 +301,7 @@ int session_load(Session *s) { - _cleanup_free_ char *remote = NULL, - *seat = NULL, - *vtnr = NULL, -+ *state = NULL, - *pos = NULL, - *leader = NULL, - *type = NULL, -@@ -327,6 +328,7 @@ int session_load(Session *s) { - "SERVICE", &s->service, - "DESKTOP", &s->desktop, - "VTNR", &vtnr, -+ "STATE", &state, - "POS", &pos, - "LEADER", &leader, - "TYPE", &type, -@@ -415,13 +417,18 @@ int session_load(Session *s) { - s->class = c; - } - -+ if (state && streq(state, "closing")) -+ s->stopping = true; -+ - if (s->fifo_path) { - int fd; - - /* If we open an unopened pipe for reading we will not - get an EOF. to trigger an EOF we hence open it for -- reading, but close it right-away which then will -- trigger the EOF. */ -+ writing, but close it right away which then will -+ trigger the EOF. This will happen immediately if no -+ other process has the FIFO open for writing, i. e. -+ when the session died before logind (re)started. */ - - fd = session_create_fifo(s); - safe_close(fd); --- -2.3.0 - diff --git a/core/systemd/0026-core-make-setting-the-shutdown-watchdog-configuratio.patch b/core/systemd/0026-core-make-setting-the-shutdown-watchdog-configuratio.patch deleted file mode 100644 index 2f3758b1e..000000000 --- a/core/systemd/0026-core-make-setting-the-shutdown-watchdog-configuratio.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 81f5fc2d43800c23a4440ed94cfe38d579e896fe Mon Sep 17 00:00:00 2001 -From: Maxim Mikityanskiy -Date: Thu, 29 Jan 2015 01:23:07 +0100 -Subject: [PATCH] core: make setting the shutdown watchdog configuration via - dbus work - -https://bugs.freedesktop.org/show_bug.cgi?id=88284 ---- - src/core/main.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/src/core/main.c b/src/core/main.c -index ce37c59..0df1f64 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -1829,6 +1829,8 @@ int main(int argc, char *argv[]) { - finish: - pager_close(); - -+ if (m) -+ arg_shutdown_watchdog = m->shutdown_watchdog; - m = manager_free(m); - - for (j = 0; j < ELEMENTSOF(arg_default_rlimit); j++) { --- -2.3.0 - diff --git a/core/systemd/0027-sd-rtnl-don-t-fail-event-handler-when-callback-fails.patch b/core/systemd/0027-sd-rtnl-don-t-fail-event-handler-when-callback-fails.patch deleted file mode 100644 index a03367d08..000000000 --- a/core/systemd/0027-sd-rtnl-don-t-fail-event-handler-when-callback-fails.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 233ba5c3a0f73e01fe6149fd8c377826a83c2a0a Mon Sep 17 00:00:00 2001 -From: Tom Gundersen -Date: Thu, 29 Jan 2015 07:26:58 +0100 -Subject: [PATCH] sd-rtnl: don't fail event handler when callback fails - -As in sd-bus, simply log at debug level when a callback fails, but don't fail the event handler. -Otherwise any error returned by any callback will disable the rtnl event handler. We should -only do that on serious internal errors in sd-rtnl that we know cannot be recovered from. ---- - src/libsystemd/sd-rtnl/sd-rtnl.c | 20 +++++++++++++++----- - 1 file changed, 15 insertions(+), 5 deletions(-) - -diff --git a/src/libsystemd/sd-rtnl/sd-rtnl.c b/src/libsystemd/sd-rtnl/sd-rtnl.c -index 5778ea5..7f1ec30 100644 ---- a/src/libsystemd/sd-rtnl/sd-rtnl.c -+++ b/src/libsystemd/sd-rtnl/sd-rtnl.c -@@ -379,9 +379,12 @@ static int process_timeout(sd_rtnl *rtnl) { - hashmap_remove(rtnl->reply_callbacks, &c->serial); - - r = c->callback(rtnl, m, c->userdata); -+ if (r < 0) -+ log_debug_errno(r, "sd-rtnl: timedout callback failed: %m"); -+ - free(c); - -- return r < 0 ? r : 1; -+ return 1; - } - - static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) { -@@ -404,9 +407,12 @@ static int process_reply(sd_rtnl *rtnl, sd_rtnl_message *m) { - prioq_remove(rtnl->reply_callbacks_prioq, c, &c->prioq_idx); - - r = c->callback(rtnl, m, c->userdata); -+ if (r < 0) -+ log_debug_errno(r, "sd-rtnl: callback failed: %m"); -+ - free(c); - -- return r; -+ return 1; - } - - static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) { -@@ -424,12 +430,16 @@ static int process_match(sd_rtnl *rtnl, sd_rtnl_message *m) { - LIST_FOREACH(match_callbacks, c, rtnl->match_callbacks) { - if (type == c->type) { - r = c->callback(rtnl, m, c->userdata); -- if (r != 0) -- return r; -+ if (r != 0) { -+ if (r < 0) -+ log_debug_errno(r, "sd-rtnl: match callback failed: %m"); -+ -+ break; -+ } - } - } - -- return 0; -+ return 1; - } - - static int process_running(sd_rtnl *rtnl, sd_rtnl_message **ret) { --- -2.3.0 - diff --git a/core/systemd/0029-config_parse_set_status-put-signals-in-the-correct-s.patch b/core/systemd/0029-config_parse_set_status-put-signals-in-the-correct-s.patch deleted file mode 100644 index a05534699..000000000 --- a/core/systemd/0029-config_parse_set_status-put-signals-in-the-correct-s.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 615938651d3a4fd9253b08da00db22d451a8cef8 Mon Sep 17 00:00:00 2001 -From: Michael Olbrich -Date: Fri, 30 Jan 2015 09:49:55 +0100 -Subject: [PATCH] config_parse_set_status: put signals in the correct set - -This was broken when the code was rearranged in "1e2fd62d70ff -core/load-fragment.c: correct argument sign and split up long lines" ---- - src/core/load-fragment.c | 9 ++++++--- - 1 file changed, 6 insertions(+), 3 deletions(-) - -diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c -index 98794bf..90bf563 100644 ---- a/src/core/load-fragment.c -+++ b/src/core/load-fragment.c -@@ -3150,6 +3150,7 @@ int config_parse_set_status( - FOREACH_WORD(word, l, rvalue, state) { - _cleanup_free_ char *temp; - int val; -+ Set **set; - - temp = strndup(word, l); - if (!temp) -@@ -3162,21 +3163,23 @@ int config_parse_set_status( - if (val <= 0) { - log_syntax(unit, LOG_ERR, filename, line, -val, - "Failed to parse value, ignoring: %s", word); -- return 0; -+ continue; - } -+ set = &status_set->signal; - } else { - if (val < 0 || val > 255) { - log_syntax(unit, LOG_ERR, filename, line, ERANGE, - "Value %d is outside range 0-255, ignoring", val); - continue; - } -+ set = &status_set->status; - } - -- r = set_ensure_allocated(&status_set->status, NULL); -+ r = set_ensure_allocated(set, NULL); - if (r < 0) - return log_oom(); - -- r = set_put(status_set->status, INT_TO_PTR(val)); -+ r = set_put(*set, INT_TO_PTR(val)); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, -r, - "Unable to store: %s", word); --- -2.3.0 - diff --git a/core/systemd/0030-network-address-test-network-avoid-undefined-behavio.patch b/core/systemd/0030-network-address-test-network-avoid-undefined-behavio.patch deleted file mode 100644 index 640fa5a17..000000000 --- a/core/systemd/0030-network-address-test-network-avoid-undefined-behavio.patch +++ /dev/null @@ -1,44 +0,0 @@ -From 6cb8e687f038424ef54b5c5c3c433be974fbe371 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= -Date: Mon, 2 Feb 2015 21:32:28 -0500 -Subject: [PATCH] network-address,test-network: avoid undefined behaviour - ---- - src/network/networkd-address.c | 4 ++++ - src/network/test-network.c | 3 +-- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/src/network/networkd-address.c b/src/network/networkd-address.c -index ce0e923..47033ac 100644 ---- a/src/network/networkd-address.c -+++ b/src/network/networkd-address.c -@@ -592,6 +592,10 @@ bool address_equal(Address *a1, Address *a2) { - case AF_INET: - if (a1->prefixlen != a2->prefixlen) - return false; -+ else if (a1->prefixlen == 0) -+ /* make sure we don't try to shift by 32. -+ * See ISO/IEC 9899:TC3 § 6.5.7.3. */ -+ return true; - else { - uint32_t b1, b2; - -diff --git a/src/network/test-network.c b/src/network/test-network.c -index ea9f938..b4a7be0 100644 ---- a/src/network/test-network.c -+++ b/src/network/test-network.c -@@ -158,10 +158,9 @@ static void test_address_equality(void) { - assert_se(address_equal(a1, a2)); - - assert_se(inet_pton(AF_INET, "192.168.3.9", &a1->in_addr.in)); -- assert_se(!address_equal(a1, a2)); -+ assert_se(address_equal(a1, a2)); - assert_se(inet_pton(AF_INET, "192.168.3.9", &a2->in_addr.in)); - assert_se(address_equal(a1, a2)); -- - a1->prefixlen = 10; - assert_se(!address_equal(a1, a2)); - a2->prefixlen = 10; --- -2.3.0 - diff --git a/core/systemd/0033-core-disarm-shutdown-watchdog-if-we-fail-to-set-time.patch b/core/systemd/0033-core-disarm-shutdown-watchdog-if-we-fail-to-set-time.patch deleted file mode 100644 index a10627aab..000000000 --- a/core/systemd/0033-core-disarm-shutdown-watchdog-if-we-fail-to-set-time.patch +++ /dev/null @@ -1,31 +0,0 @@ -From c2cc6b9aefb6f2085d3ca7eb9743093a17f751da Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Thu, 12 Feb 2015 12:28:48 +0100 -Subject: [PATCH] core: disarm shutdown watchdog if we fail to set timeout - -Better safe than sorry, if drivers are stupid, and reset immediately on -device closing if the timeout could not be initialized. - -https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777735 ---- - src/core/main.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/core/main.c b/src/core/main.c -index 0749f04..ba2de85 100644 ---- a/src/core/main.c -+++ b/src/core/main.c -@@ -2021,8 +2021,8 @@ finish: - /* If we reboot let's set the shutdown - * watchdog and tell the shutdown binary to - * repeatedly ping it */ -- watchdog_set_timeout(&arg_shutdown_watchdog); -- watchdog_close(false); -+ r = watchdog_set_timeout(&arg_shutdown_watchdog); -+ watchdog_close(r < 0); - - /* Tell the binary how often to ping, ignore failure */ - if (asprintf(&e, "WATCHDOG_USEC="USEC_FMT, arg_shutdown_watchdog) > 0) --- -2.3.0 - diff --git a/core/systemd/0034-exit-on-idle-only-exit-if-actually-idle.patch b/core/systemd/0034-exit-on-idle-only-exit-if-actually-idle.patch deleted file mode 100644 index 3a22433ce..000000000 --- a/core/systemd/0034-exit-on-idle-only-exit-if-actually-idle.patch +++ /dev/null @@ -1,29 +0,0 @@ -From a8ba6cd15d3a5edf1f9fbb4fd08dc428c3939072 Mon Sep 17 00:00:00 2001 -From: Tom Gundersen -Date: Fri, 13 Feb 2015 16:20:45 +0100 -Subject: [PATCH] exit-on-idle: only exit if actually idle - -sd_event_wait() returning 0 usually means that it timed out, which means it must -have been idle. However, sd_event_wait() may return 0 in case an event was triggered -but it turned out there was nothing to do. Make the check for idle explicit to avoid -this edge-case. ---- - src/libsystemd/sd-bus/bus-util.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c -index c9d8713..52d4ebe 100644 ---- a/src/libsystemd/sd-bus/bus-util.c -+++ b/src/libsystemd/sd-bus/bus-util.c -@@ -123,7 +123,7 @@ int bus_event_loop_with_idle( - if (r < 0) - return r; - -- if (r == 0 && !exiting) { -+ if (r == 0 && !exiting && idle) { - - r = sd_bus_try_close(bus); - if (r == -EBUSY) --- -2.3.0 - diff --git a/core/systemd/PKGBUILD b/core/systemd/PKGBUILD index 13111938d..ddc768994 100644 --- a/core/systemd/PKGBUILD +++ b/core/systemd/PKGBUILD @@ -6,67 +6,45 @@ pkgbase=systemd pkgname=('systemd' 'libsystemd' 'systemd-sysvcompat') -pkgver=218 -pkgrel=2 +pkgver=219 +pkgrel=5 arch=('i686' 'x86_64') url="http://www.freedesktop.org/wiki/Software/systemd" makedepends=('acl' 'cryptsetup' 'docbook-xsl' 'gobject-introspection' 'gperf' - 'gtk-doc' 'intltool' 'kmod' 'libcap' 'libidn' 'libgcrypt' 'libmicrohttpd' - 'libxslt' 'util-linux' 'linux-api-headers' 'lz4' 'pam' 'python' - 'python-lxml' 'quota-tools' 'shadow' 'xz') + 'gtk-doc' 'intltool' 'iptables' 'kmod' 'libcap' 'libidn' 'libgcrypt' + 'libmicrohttpd' 'libxslt' 'util-linux' 'linux-api-headers' 'lz4' 'pam' + 'python' 'python-lxml' 'quota-tools' 'shadow' 'xz') options=('strip' 'debug') source=("http://www.freedesktop.org/software/$pkgname/$pkgname-$pkgver.tar.xz" 'initcpio-hook-udev' 'initcpio-install-systemd' 'initcpio-install-udev' - 0001-journal-fix-dangling-else-ambiguity.patch - 0002-nspawn-properly-validate-machine-names.patch - 0003-systemctl-fix-argument-handling-when-invoked-as-shut.patch - 0004-systemctl-properly-iterate-through-service-array-whe.patch - 0005-nss-myhostname-always-will-in-canonical-hostname-fie.patch - 0010-log-fix-log_full_errno-with-custom-facilities.patch - 0014-timesyncd-consider-too-long-packets-as-invalid.patch - 0016-logind-fix-sd_eviocrevoke-ioctl-call.patch - 0019-sd-bus-fix-handling-of-double-parameters-in-sd_bus_m.patch - 0021-units-fix-all-TTY-paths-for-container-gettys.patch - 0024-sd-dhcp-chop-of-trailing-dot-of-DHCP-supplied-host-a.patch - 0025-logind-handle-closing-sessions-over-daemon-restarts.patch - 0026-core-make-setting-the-shutdown-watchdog-configuratio.patch - 0027-sd-rtnl-don-t-fail-event-handler-when-callback-fails.patch - 0029-config_parse_set_status-put-signals-in-the-correct-s.patch - 0030-network-address-test-network-avoid-undefined-behavio.patch - 0033-core-disarm-shutdown-watchdog-if-we-fail-to-set-time.patch - 0034-exit-on-idle-only-exit-if-actually-idle.patch) -md5sums=('4e2c511b0a7932d7fc9d79822273aac6' + '0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch' + '0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch' + '0001-core-shared-in-deserializing-match-same-files-reache.patch' + '0001-tmpfiles-Fix-handling-of-duplicate-lines.patch' + '0001-core-do-not-spawn-jobs-or-touch-other-units-during-c.patch' + '0001-use-x-machine-unix-prefix-for-the-container-bus-on-dbus1.patch') +md5sums=('e0d6c9a4b4f69f66932d2230298c9a34' '90ea67a7bb237502094914622a39e281' - 'c9db3010602913559295de3481019681' + '58af51bd4c0464f195b3433b4e17cf6c' 'bde43090d4ac0ef048e3eaee8202a407' - '22920ff32e345a26a9c05662ec274314' - '6960b43aaec4f899fdf0fe87d0457901' - '715cefd0e803d8b441811688fd4da1c3' - '3bb57f2812572ee999928ba33b489afe' - '5d42fda1f10c02861ee454277b516716' - 'a079c6e5c8d0184adf47794aaf338ac4' - 'c9b4e7bff3d1c073852c3d1b3bb8002e' - 'ae4d820582570ceb7b7c80b6810596f1' - '5b212435622f69c2a24b01ef7380bc94' - '0523c9ae27abdd30b847625b1c9c7a03' - 'c0d236b41dd4afad3f91dee72bb296a8' - '25e191463fb877fd5dabecb95f15ee8f' - '5911ef7d3ab5c5a06076fdea221ea27e' - 'ab7baf675e224cf19b9194fc1e4ea5ff' - '1d6cb563b3864fd8d724982bc2007f16' - '529c4fba7e0a709fda9e108e658e76c3' - '9d0d909507294afb879965e74fef79c8' - 'c0b68cefe7f00ea5ec856c64f799cca4') + '7cdefc73bf61934c353e4450e280e551' + 'cb8550749cd52b5902ed6fdf0eb465ec' + '9d46aebfc04cc849fd4295f449b239a2' + 'c4c9c0f0a06314450563ed571962881e' + '6b9d611dffd92c94641360c3ef2659c1' + '3a0fc672b34ced18ca1364edf8644165') prepare() { cd "$pkgname-$pkgver" - for p in "${source[@]}"; do - [[ $p = *.patch ]] || continue - patch -Np1 <"../$p" - done + patch -Np1 <../0001-tmpfiles-avoid-creating-duplicate-acl-entries.patch + patch -Np1 <../0001-nspawn-when-connected-to-pipes-for-stdin-stdout-pass.patch + patch -Np1 <../0001-core-shared-in-deserializing-match-same-files-reache.patch + patch -Np1 <../0001-tmpfiles-Fix-handling-of-duplicate-lines.patch + patch -Np1 <../0001-core-do-not-spawn-jobs-or-touch-other-units-during-c.patch + patch -Np1 <../0001-use-x-machine-unix-prefix-for-the-container-bus-on-dbus1.patch } build() { @@ -98,8 +76,9 @@ build() { package_systemd() { pkgdesc="system and service manager" license=('GPL2' 'LGPL2.1' 'MIT') - depends=('acl' 'bash' 'dbus' 'glib2' 'kbd' 'kmod' 'hwids' 'libcap' 'libgcrypt' - 'libsystemd' 'libidn' 'lz4' 'pam' 'libseccomp' 'util-linux' 'xz') + depends=('acl' 'bash' 'dbus' 'glib2' 'iptables' 'kbd' 'kmod' 'hwids' 'libcap' + 'libgcrypt' 'libsystemd' 'libidn' 'lz4' 'pam' 'libseccomp' 'util-linux' + 'xz') provides=('nss-myhostname' "systemd-tools=$pkgver" "udev=$pkgver") replaces=('nss-myhostname' 'systemd-tools' 'udev') conflicts=('nss-myhostname' 'systemd-tools' 'udev') @@ -115,10 +94,14 @@ package_systemd() { etc/dbus-1/system.d/org.freedesktop.locale1.conf etc/dbus-1/system.d/org.freedesktop.machine1.conf etc/dbus-1/system.d/org.freedesktop.timedate1.conf + etc/dbus-1/system.d/org.freedesktop.import1.conf + etc/dbus-1/system.d/org.freedesktop.network1.conf etc/pam.d/systemd-user etc/systemd/bootchart.conf etc/systemd/coredump.conf etc/systemd/journald.conf + etc/systemd/journal-remote.conf + etc/systemd/journal-upload.conf etc/systemd/logind.conf etc/systemd/system.conf etc/systemd/timesyncd.conf @@ -131,13 +114,7 @@ package_systemd() { # don't write units to /etc by default. some of these will be re-enabled on # post_install. - rm "$pkgdir/etc/systemd/system/getty.target.wants/getty@tty1.service" \ - "$pkgdir/etc/systemd/system/multi-user.target.wants/systemd-networkd.service" \ - "$pkgdir/etc/systemd/system/multi-user.target.wants/systemd-resolved.service" \ - "$pkgdir/etc/systemd/system/sysinit.target.wants/systemd-timesyncd.service" \ - "$pkgdir/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service" - rmdir "$pkgdir/etc/systemd/system/getty.target.wants" \ - "$pkgdir/etc/systemd/system/network-online.target.wants" + rm -r "$pkgdir/etc/systemd/system/"*.wants # get rid of RPM macros rm -r "$pkgdir/usr/lib/rpm" @@ -160,7 +137,10 @@ package_systemd() { # ensure proper permissions for /var/log/journal. This is only to placate chown root:systemd-journal "$pkgdir/var/log/journal" - chmod 2755 "$pkgdir/var/log/journal"{,/remote} + chmod 2755 "$pkgdir/var/log/journal" + + # we'll create this on installation + rmdir "$pkgdir/var/log/journal/remote" # fix pam file sed 's|system-auth|system-login|g' -i "$pkgdir/etc/pam.d/systemd-user" diff --git a/core/systemd/initcpio-install-systemd b/core/systemd/initcpio-install-systemd index 405acef5e..25e628305 100644 --- a/core/systemd/initcpio-install-systemd +++ b/core/systemd/initcpio-install-systemd @@ -131,6 +131,7 @@ build() { local-fs.target \ local-fs-pre.target \ paths.target \ + reboot.target \ slices.target \ sockets.target \ swap.target \ diff --git a/core/systemd/systemd.install b/core/systemd/systemd.install index 3e510c536..b0a3e1fa4 100644 --- a/core/systemd/systemd.install +++ b/core/systemd/systemd.install @@ -146,6 +146,18 @@ _216_2_changes() { echo ' tuned in /etc/systemd/coredump.conf.' } +_219_2_changes() { + if mkdir -m2755 var/log/journal/remote 2>/dev/null; then + chgrp systemd-journal-remote var/log/journal/remote + fi +} + +_219_4_changes() { + if ! systemctl is-enabled -q remote-fs.target; then + systemctl enable -q remote-fs.target + fi +} + post_install() { systemd-machine-id-setup @@ -153,11 +165,15 @@ post_install() { add_journal_acls - # enable getty@tty1 by default, but don't track the file - systemctl enable getty@tty1.service + # enable some services by default, but don't track them + systemctl enable getty@tty1.service remote-fs.target echo ":: Append 'init=/usr/lib/systemd/systemd' to your kernel command line in your" echo " bootloader to replace sysvinit with systemd, or install systemd-sysvcompat" + + # group 'systemd-journal-remote' is created by systemd-sysusers + mkdir -m2755 var/log/journal/remote + chgrp systemd-journal-remote var/log/journal/remote } post_upgrade() { @@ -175,7 +191,9 @@ post_upgrade() { 213-4 214-2 215-2 - 216-2) + 216-2 + 219-2 + 219-4) for v in "${upgrades[@]}"; do if [[ $(vercmp "$v" "$2") -eq 1 ]]; then