[systemd-commits] stable Branch 'v210-stable' - 9 commits - Makefile.am src/binfmt src/core src/getty-generator src/modules-load src/shared src/sysctl src/tmpfiles

Zbigniew Jędrzejewski-Szmek zbyszek at kemper.freedesktop.org
Mon Jun 23 05:42:51 PDT 2014


 Makefile.am                           |    2 +-
 src/binfmt/binfmt.c                   |    2 +-
 src/core/main.c                       |    8 ++++++++
 src/core/socket.c                     |    2 ++
 src/getty-generator/getty-generator.c |    4 ++--
 src/modules-load/modules-load.c       |    2 +-
 src/shared/conf-files.c               |   16 ++++++----------
 src/shared/install.c                  |    6 +++---
 src/shared/util.c                     |   18 +++++++++++-------
 src/shared/util.h                     |    4 ++--
 src/sysctl/sysctl.c                   |    2 +-
 src/tmpfiles/tmpfiles.c               |    2 +-
 12 files changed, 39 insertions(+), 29 deletions(-)

New commits:
commit e4798529d9ca623d360d6b012770bb0f9d8a5ea2
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Fri Jun 20 22:43:49 2014 -0400

    util: treat fuse.sshfs as a network filesystem
    
    https://bugs.freedesktop.org/show_bug.cgi?id=73727
    (cherry picked from commit da92ca5eb506d513033e0c7a85daf25a7e1c9d0e)

diff --git a/src/shared/util.c b/src/shared/util.c
index d13f25e..b8b080a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1507,6 +1507,7 @@ bool fstype_is_network(const char *fstype) {
         static const char table[] =
                 "cifs\0"
                 "smbfs\0"
+                "sshfs\0"
                 "ncpfs\0"
                 "ncp\0"
                 "nfs\0"

commit 92254f72bbea94b8e640b829e2a0aef2a1aa4a36
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Jun 20 16:58:21 2014 +0200

    core: clean-up signal reset logic when reexec
    
    There's no need to save the old sigmask, if we are going to die. Let's
    simplify this. Also, reset all the signal handlers, so that we don't
    leave SIG_IGN set for some of them across reexec.
    
    (cherry picked from commit 9bfcda9528636914aef3e0ab91191bb81654c83d)

diff --git a/src/core/main.c b/src/core/main.c
index 62f8140..b6795a0 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1780,7 +1780,7 @@ finish:
         if (reexecute) {
                 const char **args;
                 unsigned i, args_size;
-                sigset_t ss, o_ss;
+                sigset_t ss;
 
                 /* Close and disarm the watchdog, so that the new
                  * instance can reinitialize it, but doesn't get
@@ -1866,8 +1866,10 @@ finish:
 
                 /* reenable any blocked signals, especially important
                  * if we switch from initial ramdisk to init=... */
-                sigemptyset(&ss);
-                sigprocmask(SIG_SETMASK, &ss, &o_ss);
+                reset_all_signal_handlers();
+
+                assert_se(sigemptyset(&ss) == 0);
+                assert_se(sigprocmask(SIG_SETMASK, &ss, NULL) == 0);
 
                 if (switch_root_init) {
                         args[0] = switch_root_init;
@@ -1887,8 +1889,6 @@ finish:
                         log_error("Failed to execute /bin/sh, giving up: %m");
                 } else
                         log_warning("Failed to execute /sbin/init, giving up: %m");
-
-                sigprocmask(SIG_SETMASK, &o_ss, NULL);
         }
 
         if (arg_serialization) {

commit 3eb31d88fd664d55251102d8504d05426a97d0b3
Author: Ruediger Oertel <ro at suse.de>
Date:   Fri Jun 13 16:41:06 2014 +0200

    Reset signal-mask on re-exec to init=..
    
    Process 1 (aka init) needs to be started with an empty signal mask.
    That includes the process 1 that's started after the initrd is finished.
    When the initrd is using systemd (as it does with dracut based initrds)
    then it is systemd that calls the real init.  Normally this is systemd
    again, except when the user uses for instance "init=/bin/bash" on the
    kernel command line.
    
    (cherry picked from commit 5a85ca1cb622fda4a39c8a6f00dccea7f8a1e82a)

diff --git a/src/core/main.c b/src/core/main.c
index 8417e7a..62f8140 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1780,6 +1780,7 @@ finish:
         if (reexecute) {
                 const char **args;
                 unsigned i, args_size;
+                sigset_t ss, o_ss;
 
                 /* Close and disarm the watchdog, so that the new
                  * instance can reinitialize it, but doesn't get
@@ -1863,6 +1864,11 @@ finish:
                 args[i++] = NULL;
                 assert(i <= args_size);
 
+                /* reenable any blocked signals, especially important
+                 * if we switch from initial ramdisk to init=... */
+                sigemptyset(&ss);
+                sigprocmask(SIG_SETMASK, &ss, &o_ss);
+
                 if (switch_root_init) {
                         args[0] = switch_root_init;
                         execv(args[0], (char* const*) args);
@@ -1881,6 +1887,8 @@ finish:
                         log_error("Failed to execute /bin/sh, giving up: %m");
                 } else
                         log_warning("Failed to execute /sbin/init, giving up: %m");
+
+                sigprocmask(SIG_SETMASK, &o_ss, NULL);
         }
 
         if (arg_serialization) {

commit 686e842aecfc9f89547f9d9021afb9e1a21067ec
Author: Michael Marineau <michael.marineau at coreos.com>
Date:   Thu Jun 19 19:07:06 2014 -0700

    shared: fix search_and_fopen with alternate roots
    
    Update for the current behavior of path_strv_resolve which now returns
    paths relative to the given root, not the full absolute paths.
    
    (cherry picked from commit 375eadd911a9f83f89f1e7de5e05f44cc81e3642)

diff --git a/src/shared/util.c b/src/shared/util.c
index c82860e..d13f25e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5685,7 +5685,10 @@ static int search_and_fopen_internal(const char *path, const char *mode, const c
                 _cleanup_free_ char *p = NULL;
                 FILE *f;
 
-                p = strjoin(*i, "/", path, NULL);
+                if (root)
+                        p = strjoin(root, *i, "/", path, NULL);
+                else
+                        p = strjoin(*i, "/", path, NULL);
                 if (!p)
                         return -ENOMEM;
 

commit 8d4847827db40b7148973558940f90495f5accba
Author: Michael Marineau <michael.marineau at coreos.com>
Date:   Thu Mar 13 21:32:12 2014 -0700

    shared: add root argument to search_and_fopen
    
    This adds the same root argument to search_and_fopen that
    conf_files_list already has. Tools that use those two functions as a
    pair can now be easily modified to load configuration files from an
    alternate root filesystem tree.
    
    (cherry picked from commit 4cf7ea556aa1e74f9b34d4467f36d46a1bb25da3)

diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index a1877c4..9fc5d4e 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -86,7 +86,7 @@ static int apply_file(const char *path, bool ignore_enoent) {
 
         assert(path);
 
-        r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index 37d7a77..40dd02b 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -152,7 +152,7 @@ static int apply_file(struct kmod_ctx *ctx, const char *path, bool ignore_enoent
         assert(ctx);
         assert(path);
 
-        r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
diff --git a/src/shared/util.c b/src/shared/util.c
index fa57e24..c82860e 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5671,14 +5671,14 @@ int on_ac_power(void) {
         return found_online || !found_offline;
 }
 
-static int search_and_fopen_internal(const char *path, const char *mode, char **search, FILE **_f) {
+static int search_and_fopen_internal(const char *path, const char *mode, const char *root, char **search, FILE **_f) {
         char **i;
 
         assert(path);
         assert(mode);
         assert(_f);
 
-        if (!path_strv_canonicalize_absolute_uniq(search, NULL))
+        if (!path_strv_canonicalize_absolute_uniq(search, root))
                 return -ENOMEM;
 
         STRV_FOREACH(i, search) {
@@ -5702,7 +5702,7 @@ static int search_and_fopen_internal(const char *path, const char *mode, char **
         return -ENOENT;
 }
 
-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f) {
+int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f) {
         _cleanup_strv_free_ char **copy = NULL;
 
         assert(path);
@@ -5725,10 +5725,10 @@ int search_and_fopen(const char *path, const char *mode, const char **search, FI
         if (!copy)
                 return -ENOMEM;
 
-        return search_and_fopen_internal(path, mode, copy, _f);
+        return search_and_fopen_internal(path, mode, root, copy, _f);
 }
 
-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f) {
+int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f) {
         _cleanup_strv_free_ char **s = NULL;
 
         if (path_is_absolute(path)) {
@@ -5747,7 +5747,7 @@ int search_and_fopen_nulstr(const char *path, const char *mode, const char *sear
         if (!s)
                 return -ENOMEM;
 
-        return search_and_fopen_internal(path, mode, s, _f);
+        return search_and_fopen_internal(path, mode, root, s, _f);
 }
 
 char *strextend(char **x, ...) {
diff --git a/src/shared/util.h b/src/shared/util.h
index 696bf4c..c87217a 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -684,8 +684,8 @@ char *strip_tab_ansi(char **p, size_t *l);
 
 int on_ac_power(void);
 
-int search_and_fopen(const char *path, const char *mode, const char **search, FILE **_f);
-int search_and_fopen_nulstr(const char *path, const char *mode, const char *search, FILE **_f);
+int search_and_fopen(const char *path, const char *mode, const char *root, const char **search, FILE **_f);
+int search_and_fopen_nulstr(const char *path, const char *mode, const char *root, const char *search, FILE **_f);
 
 #define FOREACH_LINE(line, f, on_error)                         \
         for (;;)                                                \
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index 8f940c3..6912b11 100644
--- a/src/sysctl/sysctl.c
+++ b/src/sysctl/sysctl.c
@@ -137,7 +137,7 @@ static int parse_file(Hashmap *sysctl_options, const char *path, bool ignore_eno
 
         assert(path);
 
-        r = search_and_fopen_nulstr(path, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(path, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index d9e3edd..6f90ede 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1371,7 +1371,7 @@ static int read_config_file(const char *fn, bool ignore_enoent) {
 
         assert(fn);
 
-        r = search_and_fopen_nulstr(fn, "re", conf_file_dirs, &f);
+        r = search_and_fopen_nulstr(fn, "re", NULL, conf_file_dirs, &f);
         if (r < 0) {
                 if (ignore_enoent && r == -ENOENT)
                         return 0;

commit 084c41bc148e0a7b0eeee614d9e0acc9aaae6b0d
Author: Michael Marineau <michael.marineau at coreos.com>
Date:   Thu Jun 19 19:07:04 2014 -0700

    conf-files: include root in returned file paths
    
    This restores the original root handling logic that was present prior to
    112cfb18 when path expansion moved to path_strv_canonicalize_absolute.
    That behavior partially went away in 12ed81d9.
    
    Alternatively all users of conf_files_list* could be updated to
    concatenate the paths themselves as unit_file_query_preset did but since
    no user needs the un-concatenated form that is pointless duplication.
    
    (cherry picked from commit cba2ef02722114da2b730d57f1e3bb43013d8921)
    
    Conflicts:
    	src/shared/install.c

diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 59bc8ce..780ce1a 100644
--- a/src/shared/conf-files.c
+++ b/src/shared/conf-files.c
@@ -37,20 +37,16 @@
 #include "hashmap.h"
 #include "conf-files.h"
 
-static int files_add(Hashmap *h, const char *dirpath, const char *suffix, const char *root) {
+static int files_add(Hashmap *h, const char *root, const char *path, const char *suffix) {
         _cleanup_closedir_ DIR *dir = NULL;
+        char *dirpath;
 
-        assert(dirpath);
+        assert(path);
         assert(suffix);
 
-        if (isempty(root))
-                dir = opendir(dirpath);
-        else {
-                const char *p;
+        dirpath = strappenda(root ? root : "", path);
 
-                p = strappenda3(root, "/", dirpath);
-                dir = opendir(p);
-        }
+        dir = opendir(dirpath);
         if (!dir) {
                 if (errno == ENOENT)
                         return 0;
@@ -118,7 +114,7 @@ static int conf_files_list_strv_internal(char ***strv, const char *suffix, const
                 return -ENOMEM;
 
         STRV_FOREACH(p, dirs) {
-                r = files_add(fh, *p, suffix, root);
+                r = files_add(fh, root, *p, suffix);
                 if (r == -ENOMEM) {
                         hashmap_free_free(fh);
                         return r;
diff --git a/src/shared/install.c b/src/shared/install.c
index bce9067..2f83429 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1772,7 +1772,7 @@ UnitFileState unit_file_get_state(
 
 int unit_file_query_preset(UnitFileScope scope, const char *name) {
         _cleanup_strv_free_ char **files = NULL;
-        char **i;
+        char **p;
         int r;
 
         assert(scope >= 0);
@@ -1800,10 +1800,10 @@ int unit_file_query_preset(UnitFileScope scope, const char *name) {
         if (r < 0)
                 return r;
 
-        STRV_FOREACH(i, files) {
+        STRV_FOREACH(p, files) {
                 _cleanup_fclose_ FILE *f;
 
-                f = fopen(*i, "re");
+                f = fopen(*p, "re");
                 if (!f) {
                         if (errno == ENOENT)
                                 continue;

commit 98023e096875cde4662a62e862279f8685d166fd
Author: Zbigniew Jędrzejewski-Szmek <zbyszek at in.waw.pl>
Date:   Thu Jun 19 22:02:55 2014 -0400

    getty-generator: properly escape instance names
    
    Otherwise the add_symlink() function tries to make directories for
    each slash even for the slash after the @ symbol in the final link
    name, failing for /dev/3270/tty1.
    
    Based on a patch by Werner Fink <werner at suse.de>.
    
    (cherry picked from commit a2ae516a25dafe41e0cd296ab7b5d022fa62b95f)

diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 6a4aa2c..700e90a 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -72,7 +72,7 @@ static int add_serial_getty(const char *tty) {
 
         log_debug("Automatically adding serial getty for /dev/%s.", tty);
 
-        n = unit_name_replace_instance("serial-getty at .service", tty);
+        n = unit_name_from_path_instance("serial-getty", tty, ".service");
         if (!n)
                 return log_oom();
 
@@ -86,7 +86,7 @@ static int add_container_getty(const char *tty) {
 
         log_debug("Automatically adding container getty for /dev/pts/%s.", tty);
 
-        n = unit_name_replace_instance("container-getty at .service", tty);
+        n = unit_name_from_path_instance("container-getty", tty, ".service");
         if (!n)
                 return log_oom();
 

commit ca5fd86c375e44194154c3204ae0f42fd49a2b2f
Author: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
Date:   Wed Jun 18 20:34:52 2014 +0200

    socket: check return from exec_spawn
    
    (cherry picked from commit cee288adf88844acd880e4c0da5ed550c85cdd1a)

diff --git a/src/core/socket.c b/src/core/socket.c
index cc384b2..8df64ee 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1249,6 +1249,8 @@ static int socket_spawn(Socket *s, ExecCommand *c, pid_t *_pid) {
                        NULL,
                        s->exec_runtime,
                        &pid);
+        if (r < 0)
+                goto fail;
 
         strv_free(argv);
         if (r < 0)

commit 266eaa6b59a645c787f984675e8ddb70c650b498
Author: Ronny Chevalier <chevalier.ronny at gmail.com>
Date:   Tue Jun 17 19:26:14 2014 +0200

    build-sys: add missing backslash
    
    (cherry picked from commit fe582db94bac3743b87d67d880497fe40b06dd2f)

diff --git a/Makefile.am b/Makefile.am
index d6729e5..919cac7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3274,7 +3274,7 @@ libsystemd_journal_internal_la_SOURCES = \
 	src/journal/mmap-cache.h
 
 # using _CFLAGS = in the conditional below would suppress AM_CFLAGS
-libsystemd_journal_internal_la_CFLAGS =
+libsystemd_journal_internal_la_CFLAGS = \
 	$(AM_CFLAGS)
 
 libsystemd_journal_internal_la_LIBADD =



More information about the systemd-commits mailing list