[systemd-commits] stable Branch 'v208-stable' - 8 commits - 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:35 PDT 2014


 src/binfmt/binfmt.c                   |    2 +-
 src/core/main.c                       |    8 ++++++++
 src/core/socket.c                     |    2 ++
 src/getty-generator/getty-generator.c |    2 +-
 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 +-
 11 files changed, 37 insertions(+), 27 deletions(-)

New commits:
commit 722b7000a9973c9f3460fd5c41dfd613041a0976
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)
    (cherry picked from commit e4798529d9ca623d360d6b012770bb0f9d8a5ea2)

diff --git a/src/shared/util.c b/src/shared/util.c
index 7aa3d02..e78e4e4 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -1629,6 +1629,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 df2be2b86c8a1bd3e64bcdfb0e6a8160ec3e1bec
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)
    (cherry picked from commit 92254f72bbea94b8e640b829e2a0aef2a1aa4a36)

diff --git a/src/core/main.c b/src/core/main.c
index 2f45485..8c994a8 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1748,7 +1748,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
@@ -1834,8 +1834,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;
@@ -1855,8 +1857,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 (serialization)

commit 2c4d473560b29aa6a3ee48faa07c3fe9e90dae7e
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)
    (cherry picked from commit 3eb31d88fd664d55251102d8504d05426a97d0b3)

diff --git a/src/core/main.c b/src/core/main.c
index 2a294c6..2f45485 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1748,6 +1748,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
@@ -1831,6 +1832,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);
@@ -1849,6 +1855,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 (serialization)

commit ff96d0f2ca97d7e94cb6252714e3b4c46136a462
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)
    (cherry picked from commit 686e842aecfc9f89547f9d9021afb9e1a21067ec)

diff --git a/src/shared/util.c b/src/shared/util.c
index 65a09d9..7aa3d02 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5701,7 +5701,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 a2d2b499ee2f7cdca44b1ab5bf13010cd4228d3e
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)
    (cherry picked from commit 8d4847827db40b7148973558940f90495f5accba)
    
    Conflicts:
    	src/shared/util.h

diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
index 7ed1ae7..e3a3d4f 100644
--- a/src/binfmt/binfmt.c
+++ b/src/binfmt/binfmt.c
@@ -85,7 +85,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 ba7d417..bfb6e7e 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -181,7 +181,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 f034134..65a09d9 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -5687,14 +5687,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) {
@@ -5718,7 +5718,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);
@@ -5741,10 +5741,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)) {
@@ -5763,7 +5763,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);
 }
 
 int create_tmp_dir(char template[], char** dir_name) {
diff --git a/src/shared/util.h b/src/shared/util.h
index f358362..b00395c 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -629,8 +629,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);
 int create_tmp_dir(char template[], char** dir_name);
 
 #define FOREACH_LINE(line, f, on_error)                         \
diff --git a/src/sysctl/sysctl.c b/src/sysctl/sysctl.c
index 70c4d89..1b7b482 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 6b0dfaf..ca99bb4 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -1364,7 +1364,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 806e59a1e136764e1deb676eaa2666eee603af9f
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
    
    (cherry picked from commit 084c41bc148e0a7b0eeee614d9e0acc9aaae6b0d)

diff --git a/src/shared/conf-files.c b/src/shared/conf-files.c
index 4ec8bed..fc5f1fe 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 86a05a4..f40be79 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -1763,7 +1763,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);
@@ -1791,10 +1791,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 1376386fc63a246772c7c4ea04f76ce28b2306fe
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)
    (cherry picked from commit 98023e096875cde4662a62e862279f8685d166fd)
    
    Conflicts:
    	src/getty-generator/getty-generator.c

diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 625a87e..2f790b8 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -77,7 +77,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();
 

commit 220939a361041e707d29870f76621343e4eda67b
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)
    (cherry picked from commit ca5fd86c375e44194154c3204ae0f42fd49a2b2f)

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



More information about the systemd-commits mailing list