Hello community,

here is the log from the commit of package systemd for openSUSE:Factory checked 
in at 2018-12-10 12:22:20
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/systemd (Old)
 and      /work/SRC/openSUSE:Factory/.systemd.new.19453 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "systemd"

Mon Dec 10 12:22:20 2018 rev:290 rq:653865 version:239

Changes:
--------
--- /work/SRC/openSUSE:Factory/systemd/systemd-mini.changes     2018-11-20 
22:24:26.878879640 +0100
+++ /work/SRC/openSUSE:Factory/.systemd.new.19453/systemd-mini.changes  
2018-12-10 12:22:24.218882281 +0100
@@ -1,0 +2,34 @@
+Tue Dec  4 13:20:48 UTC 2018 - Franck Bui <[email protected]>
+
+- Import commit 8ae56af7802ef8f91fac64fa244d62a4468fbbd5
+
+  4474878178 udev-builtin-kmod: adjust logging
+  805534aff5 core: use the generic module_load() function
+  ac7e902530 shared/module-util: fix preexisting mixup with errno sign
+  415aa40793 udev-builtin-kmod: use the generic module_load() function
+  8a36b4bac6 Move module-util.h to src/shared/ and load_module() to libshared
+  999b910752 core/kmod-setup: restore comments
+  1f2b822a21 logind: stop managing VT switches if no sessions are registered 
on that VT
+  5ad8d374c5 terminal-util: introduce vt_release() helper
+  145d492490 logind: become the controlling terminal process before restoring 
VT (bsc#1101591)
+  d4b5dbc033 terminal-util: introduce vt_restore() helper
+  2e8af185f0 logind: make session_restore_vt() static
+  ff3048364f udev: downgrade message when we fail to set inotify watch up 
(bsc#1005023)
+
+-------------------------------------------------------------------
+Fri Nov 23 13:30:03 UTC 2018 - Franck Bui <[email protected]>
+
+- Fix the test for figuring out if /etc/machine-id is writable in %post 
(bsc#1117063)
+
+  "test -w" always returns true for root user even if the writable
+  mode bits are not set. Fix this by testing the file mode bit value
+  instead.
+
+-------------------------------------------------------------------
+Fri Nov 23 11:50:19 UTC 2018 - Franck Bui <[email protected]>
+
+- Move systemd-sysv-convert from /usr/sbin to /usr/lib/systemd
+
+  This tool is not supposed to be run by users.
+
+-------------------------------------------------------------------
systemd.changes: same change

Old:
----
  systemd-v239+suse.125.g69f9f79e1.tar.xz

New:
----
  systemd-v239+suse.138.g8ae56af78.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ systemd-mini.spec ++++++
--- /var/tmp/diff_new_pack.6zm9iD/_old  2018-12-10 12:22:31.634874892 +0100
+++ /var/tmp/diff_new_pack.6zm9iD/_new  2018-12-10 12:22:31.638874888 +0100
@@ -26,7 +26,7 @@
 ##### WARNING: please do not edit this auto generated spec file. Use the 
systemd.spec! #####
 %define mini -mini
 %define min_kernel_version 4.5
-%define suse_version +suse.125.g69f9f79e1
+%define suse_version +suse.138.g8ae56af78
 
 %bcond_with     gnuefi
 %if 0%{?bootstrap}
@@ -510,7 +510,7 @@
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/sysv-convert
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated
 
-install -m0755 -D %{S:3}  %{buildroot}/%{_sbindir}/systemd-sysv-convert
+install -m0755 -D %{S:3}  
%{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-convert
 install -m0755 -D %{S:4}  
%{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install
 %endif
 
@@ -699,9 +699,9 @@
 
 # /etc/machine-id might have been created writeable incorrectly
 # (boo#1092269).
-if [ -w %{_sysconfdir}/machine-id ]; then
-        echo "/etc/machine-id shouldn't be writable, fixing..."
-        chmod 444 %{_sysconfdir}/machine-id || :
+if [ "$(stat -c%a %{_sysconfdir}/machine-id)" != 444 ]; then
+        echo "Incorrect file mode bits for /etc/machine-id which should be 
0444, fixing..."
+        chmod 444 %{_sysconfdir}/machine-id
 fi
 
 %if ! 0%{?bootstrap}
@@ -921,9 +921,6 @@
 %{_bindir}/systemd-stdio-bridge
 %{_bindir}/systemd-detect-virt
 %{_bindir}/timedatectl
-%if %{with sysvcompat}
-%{_sbindir}/systemd-sysv-convert
-%endif
 %{_bindir}/systemd-cgls
 %{_bindir}/systemd-cgtop
 %{_bindir}/systemd-cat

++++++ systemd.spec ++++++
--- /var/tmp/diff_new_pack.6zm9iD/_old  2018-12-10 12:22:31.666874860 +0100
+++ /var/tmp/diff_new_pack.6zm9iD/_new  2018-12-10 12:22:31.666874860 +0100
@@ -24,7 +24,7 @@
 %define bootstrap 0
 %define mini %nil
 %define min_kernel_version 4.5
-%define suse_version +suse.125.g69f9f79e1
+%define suse_version +suse.138.g8ae56af78
 
 %bcond_with     gnuefi
 %if 0%{?bootstrap}
@@ -508,7 +508,7 @@
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/sysv-convert
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated
 
-install -m0755 -D %{S:3}  %{buildroot}/%{_sbindir}/systemd-sysv-convert
+install -m0755 -D %{S:3}  
%{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-convert
 install -m0755 -D %{S:4}  
%{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install
 %endif
 
@@ -697,9 +697,9 @@
 
 # /etc/machine-id might have been created writeable incorrectly
 # (boo#1092269).
-if [ -w %{_sysconfdir}/machine-id ]; then
-        echo "/etc/machine-id shouldn't be writable, fixing..."
-        chmod 444 %{_sysconfdir}/machine-id || :
+if [ "$(stat -c%a %{_sysconfdir}/machine-id)" != 444 ]; then
+        echo "Incorrect file mode bits for /etc/machine-id which should be 
0444, fixing..."
+        chmod 444 %{_sysconfdir}/machine-id
 fi
 
 %if ! 0%{?bootstrap}
@@ -919,9 +919,6 @@
 %{_bindir}/systemd-stdio-bridge
 %{_bindir}/systemd-detect-virt
 %{_bindir}/timedatectl
-%if %{with sysvcompat}
-%{_sbindir}/systemd-sysv-convert
-%endif
 %{_bindir}/systemd-cgls
 %{_bindir}/systemd-cgtop
 %{_bindir}/systemd-cat

++++++ systemd-v239+suse.125.g69f9f79e1.tar.xz -> 
systemd-v239+suse.138.g8ae56af78.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/basic/meson.build 
new/systemd-v239+suse.138.g8ae56af78/src/basic/meson.build
--- old/systemd-v239+suse.125.g69f9f79e1/src/basic/meson.build  2018-11-16 
11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/basic/meson.build  2018-12-04 
14:20:30.000000000 +0100
@@ -121,7 +121,6 @@
         mkdir-label.c
         mkdir.c
         mkdir.h
-        module-util.h
         mount-util.c
         mount-util.h
         nss-util.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/basic/module-util.h 
new/systemd-v239+suse.138.g8ae56af78/src/basic/module-util.h
--- old/systemd-v239+suse.125.g69f9f79e1/src/basic/module-util.h        
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/basic/module-util.h        
1970-01-01 01:00:00.000000000 +0100
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: LGPL-2.1+ */
-#pragma once
-
-#include <libkmod.h>
-
-#include "macro.h"
-
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, kmod_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, kmod_module_unref);
-DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_list*, kmod_module_unref_list);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/basic/terminal-util.c 
new/systemd-v239+suse.138.g8ae56af78/src/basic/terminal-util.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/basic/terminal-util.c      
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/basic/terminal-util.c      
2018-12-04 14:20:30.000000000 +0100
@@ -1462,3 +1462,53 @@
         } else
                 fputs("\n\n", stdout);
 }
+
+int vt_restore(int fd) {
+        static const struct vt_mode mode = {
+                .mode = VT_AUTO,
+        };
+        int r, q = 0;
+
+        r = ioctl(fd, KDSETMODE, KD_TEXT);
+        if (r < 0)
+                q = log_debug_errno(errno, "Failed to set VT in text mode, 
ignoring: %m");
+
+        r = vt_reset_keyboard(fd);
+        if (r < 0) {
+                log_debug_errno(r, "Failed to reset keyboard mode, ignoring: 
%m");
+                if (q >= 0)
+                        q = r;
+        }
+
+        r = ioctl(fd, VT_SETMODE, &mode);
+        if (r < 0) {
+                log_debug_errno(errno, "Failed to set VT_AUTO mode, ignoring: 
%m");
+                if (q >= 0)
+                        q = -errno;
+        }
+
+        r = fchown(fd, 0, (gid_t) -1);
+        if (r < 0) {
+                log_debug_errno(errno, "Failed to chown VT, ignoring: %m");
+                if (q >= 0)
+                        q = -errno;
+        }
+
+        return q;
+}
+
+int vt_release(int fd, bool restore) {
+        assert(fd >= 0);
+
+        /* This function releases the VT by acknowledging the VT-switch signal
+         * sent by the kernel and optionally reset the VT in text and auto
+         * VT-switching modes. */
+
+        if (ioctl(fd, VT_RELDISP, 1) < 0)
+                return -errno;
+
+        if (restore)
+                return vt_restore(fd);
+
+        return 0;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/basic/terminal-util.h 
new/systemd-v239+suse.138.g8ae56af78/src/basic/terminal-util.h
--- old/systemd-v239+suse.125.g69f9f79e1/src/basic/terminal-util.h      
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/basic/terminal-util.h      
2018-12-04 14:20:30.000000000 +0100
@@ -151,6 +151,8 @@
 
 int vt_default_utf8(void);
 int vt_reset_keyboard(int fd);
+int vt_restore(int fd);
+int vt_release(int fd, bool restore_vt);
 
 int terminal_urlify(const char *url, const char *text, char **ret);
 int terminal_urlify_path(const char *path, const char *text, char **ret);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/core/kmod-setup.c 
new/systemd-v239+suse.138.g8ae56af78/src/core/kmod-setup.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/core/kmod-setup.c  2018-11-16 
11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/core/kmod-setup.c  2018-12-04 
14:20:30.000000000 +0100
@@ -76,13 +76,15 @@
                 bool warn_if_module:1;
                 bool (*condition_fn)(void);
         } kmod_table[] = {
-                /* auto-loading on use doesn't work before udev is up */
+                /* This one we need to load explicitly, since auto-loading on 
use doesn't work
+                 * before udev created the ghost device nodes, and we need it 
earlier than that. */
                 { "autofs4",   "/sys/class/misc/autofs",    true,   false,   
NULL      },
 
-                /* early configure of ::1 on the loopback device */
+                /* This one we need to load explicitly, since auto-loading of 
IPv6 is not done when
+                 * we try to configure ::1 on the loopback device. */
                 { "ipv6",      "/sys/module/ipv6",          false,  true,    
NULL      },
 
-                /* this should never be a module */
+                /* This should never be a module */
                 { "unix",      "/proc/net/unix",            true,   true,    
NULL      },
 
 #if HAVE_LIBIPTC
@@ -94,14 +96,11 @@
         };
         _cleanup_(kmod_unrefp) struct kmod_ctx *ctx = NULL;
         unsigned int i;
-        int r;
 
         if (have_effective_cap(CAP_SYS_MODULE) == 0)
                 return 0;
 
         for (i = 0; i < ELEMENTSOF(kmod_table); i++) {
-                _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
-
                 if (kmod_table[i].path && access(kmod_table[i].path, F_OK) >= 
0)
                         continue;
 
@@ -122,23 +121,7 @@
                         kmod_load_resources(ctx);
                 }
 
-                r = kmod_module_new_from_name(ctx, kmod_table[i].module, &mod);
-                if (r < 0) {
-                        log_error("Failed to lookup module '%s'", 
kmod_table[i].module);
-                        continue;
-                }
-
-                r = kmod_module_probe_insert_module(mod, 
KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
-                if (r == 0)
-                        log_debug("Inserted module '%s'", 
kmod_module_get_name(mod));
-                else if (r == KMOD_PROBE_APPLY_BLACKLIST)
-                        log_info("Module '%s' is blacklisted", 
kmod_module_get_name(mod));
-                else {
-                        bool print_warning = kmod_table[i].warn_if_unavailable 
|| (r < 0 && r != -ENOENT);
-
-                        log_full_errno(print_warning ? LOG_WARNING : 
LOG_DEBUG, r,
-                                       "Failed to insert module '%s': %m", 
kmod_module_get_name(mod));
-                }
+                (void) module_load_and_warn(ctx, kmod_table[i].module, 
kmod_table[i].warn_if_unavailable);
         }
 
 #endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/login/logind-session.c 
new/systemd-v239+suse.138.g8ae56af78/src/login/logind-session.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/login/logind-session.c     
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/login/logind-session.c     
2018-12-04 14:20:30.000000000 +0100
@@ -33,6 +33,7 @@
 #define RELEASE_USEC (20*USEC_PER_SEC)
 
 static void session_remove_fifo(Session *s);
+static void session_restore_vt(Session *s);
 
 Session* session_new(Manager *m, const char *id) {
         Session *s;
@@ -1120,35 +1121,55 @@
         return r;
 }
 
-void session_restore_vt(Session *s) {
-
-        static const struct vt_mode mode = {
-                .mode = VT_AUTO,
-        };
-
-        int vt, old_fd;
-
-        /* We need to get a fresh handle to the virtual terminal,
-         * since the old file-descriptor is potentially in a hung-up
-         * state after the controlling process exited; we do a
-         * little dance to avoid having the terminal be available
-         * for reuse before we've cleaned it up.
-         */
-        old_fd = TAKE_FD(s->vtfd);
+static void session_restore_vt(Session *s) {
+        pid_t pid;
+        int r;
 
-        vt = session_open_vt(s);
-        safe_close(old_fd);
+        if (s->vtnr < 1)
+                return;
 
-        if (vt < 0)
+        if (s->vtfd < 0)
                 return;
 
-        (void) ioctl(vt, KDSETMODE, KD_TEXT);
+        /* The virtual terminal can potentially be entering in hung-up state 
at any time
+         * depending on when the controlling process exits.
+         *
+         * If the controlling process exits while we're restoring the virtual 
terminal,
+         * the VT will enter in hung-up state and we'll fail at restoring it. 
To prevent
+         * this case, we kick off the current controlling process (if any) in 
a child
+         * process so logind doesn't play around with tty ownership.
+         *
+         * If the controlling process already exited, getting a fresh handle 
to the
+         * virtual terminal reset the hung-up state. */
+        r = safe_fork("(logind)", 
FORK_REOPEN_LOG|FORK_CLOSE_ALL_FDS|FORK_RESET_SIGNALS|FORK_WAIT|FORK_LOG, &pid);
+        if (r == 0) {
+                char path[sizeof("/dev/tty") + DECIMAL_STR_MAX(s->vtnr)];
+                int vt;
+
+                /* We must be a session leader in order to become the 
controlling process. */
+                pid = setsid();
+                if (pid < 0) {
+                        log_error_errno(errno, "Failed to become session 
leader: %m");
+                        _exit(EXIT_FAILURE);
+                }
+
+                sprintf(path, "/dev/tty%u", s->vtnr);
+                vt = acquire_terminal(path, ACQUIRE_TERMINAL_FORCE, 
USEC_INFINITY);
+                if (vt < 0) {
+                        log_error_errno(vt, "Cannot acquire VT %s of session 
%s: %m", path, s->id);
+                        _exit(EXIT_FAILURE);
+                }
 
-        (void) vt_reset_keyboard(vt);
+                r = vt_restore(vt);
+                if (r < 0)
+                        log_warning_errno(r, "Failed to restore VT, ignoring: 
%m");
 
-        (void) ioctl(vt, VT_SETMODE, &mode);
-        (void) fchown(vt, 0, (gid_t) -1);
+                /* Give up and release the controlling terminal. */
+                safe_close(vt);
+                _exit(EXIT_SUCCESS);
+        }
 
+        /* Close the fd in any cases.  */
         s->vtfd = safe_close(s->vtfd);
 }
 
@@ -1172,9 +1193,9 @@
                 return;
 
         session_device_pause_all(s);
-        r = ioctl(s->vtfd, VT_RELDISP, 1);
+        r = vt_release(s->vtfd, false);
         if (r < 0)
-                log_debug_errno(errno, "Cannot release VT of session %s: %m", 
s->id);
+                log_debug_errno(r, "Cannot release VT of session %s: %m", 
s->id);
 }
 
 bool session_is_controller(Session *s, const char *sender) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/login/logind-session.h 
new/systemd-v239+suse.138.g8ae56af78/src/login/logind-session.h
--- old/systemd-v239+suse.125.g69f9f79e1/src/login/logind-session.h     
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/login/logind-session.h     
2018-12-04 14:20:30.000000000 +0100
@@ -156,7 +156,6 @@
 KillWho kill_who_from_string(const char *s) _pure_;
 
 int session_prepare_vt(Session *s);
-void session_restore_vt(Session *s);
 void session_leave_vt(Session *s);
 
 bool session_is_controller(Session *s, const char *sender);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-v239+suse.125.g69f9f79e1/src/login/logind.c 
new/systemd-v239+suse.138.g8ae56af78/src/login/logind.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/login/logind.c     2018-11-16 
11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/login/logind.c     2018-12-04 
14:20:30.000000000 +0100
@@ -23,6 +23,7 @@
 #include "selinux-util.h"
 #include "signal-util.h"
 #include "strv.h"
+#include "terminal-util.h"
 #include "udev-util.h"
 
 static Manager* manager_unref(Manager *m);
@@ -791,7 +792,29 @@
 
         active = m->seat0->active;
         if (!active || active->vtnr < 1) {
-                log_warning("Received VT_PROCESS signal without a registered 
session on that VT.");
+                _cleanup_close_ int fd = -1;
+                int r;
+
+                /* We are requested to acknowledge the VT-switch signal by the 
kernel but
+                 * there's no registered sessions for the current VT. Normally 
this
+                 * shouldn't happen but something wrong might have happened 
when we tried
+                 * to release the VT. Better be safe than sorry, and try to 
release the VT
+                 * one more time otherwise the user will be locked with the 
current VT. */
+
+                log_warning("Received VT_PROCESS signal without a registered 
session, restoring VT.");
+
+                /* At this point we only have the kernel mapping for referring 
to the
+                 * current VT. */
+                fd = open_terminal("/dev/tty0", 
O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK);
+                if (fd < 0) {
+                        log_warning_errno(fd, "Failed to open, ignoring: %m");
+                        return 0;
+                }
+
+                r = vt_release(fd, true);
+                if (r < 0)
+                        log_warning_errno(r, "Failed to release VT, ignoring: 
%m");
+
                 return 0;
         }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/modules-load/modules-load.c 
new/systemd-v239+suse.138.g8ae56af78/src/modules-load/modules-load.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/modules-load/modules-load.c        
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/modules-load/modules-load.c        
2018-12-04 14:20:30.000000000 +0100
@@ -59,65 +59,6 @@
         return 0;
 }
 
-static int load_module(struct kmod_ctx *ctx, const char *m) {
-        const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
-        struct kmod_list *itr;
-        _cleanup_(kmod_module_unref_listp) struct kmod_list *modlist = NULL;
-        int r = 0;
-
-        log_debug("load: %s", m);
-
-        r = kmod_module_new_from_lookup(ctx, m, &modlist);
-        if (r < 0)
-                return log_error_errno(r, "Failed to lookup alias '%s': %m", 
m);
-
-        if (!modlist) {
-                log_error("Failed to find module '%s'", m);
-                return -ENOENT;
-        }
-
-        kmod_list_foreach(itr, modlist) {
-                _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
-                int state, err;
-
-                mod = kmod_module_get_module(itr);
-                state = kmod_module_get_initstate(mod);
-
-                switch (state) {
-                case KMOD_MODULE_BUILTIN:
-                        log_info("Module '%s' is builtin", 
kmod_module_get_name(mod));
-                        break;
-
-                case KMOD_MODULE_LIVE:
-                        log_debug("Module '%s' is already loaded", 
kmod_module_get_name(mod));
-                        break;
-
-                default:
-                        err = kmod_module_probe_insert_module(mod, probe_flags,
-                                                              NULL, NULL, 
NULL, NULL);
-
-                        if (err == 0)
-                                log_info("Inserted module '%s'", 
kmod_module_get_name(mod));
-                        else if (err == KMOD_PROBE_APPLY_BLACKLIST)
-                                log_info("Module '%s' is blacklisted", 
kmod_module_get_name(mod));
-                        else {
-                                assert(err < 0);
-
-                                log_full_errno(err == ENODEV ? LOG_NOTICE :
-                                               err == ENOENT ? LOG_WARNING :
-                                                               LOG_ERR,
-                                               err,
-                                               "Failed to insert '%s': %m",
-                                               kmod_module_get_name(mod));
-                                if (!IN_SET(err, ENODEV, ENOENT))
-                                        r = err;
-                        }
-                }
-        }
-
-        return r;
-}
-
 static int apply_file(struct kmod_ctx *ctx, const char *path, bool 
ignore_enoent) {
         _cleanup_fclose_ FILE *f = NULL;
         int r;
@@ -151,7 +92,7 @@
                 if (strchr(COMMENTS "\n", *l))
                         continue;
 
-                k = load_module(ctx, l);
+                k = module_load_and_warn(ctx, l, true);
                 if (k < 0 && r == 0)
                         r = k;
         }
@@ -248,7 +189,7 @@
                 char **fn, **i;
 
                 STRV_FOREACH(i, arg_proc_cmdline_modules) {
-                        k = load_module(ctx, *i);
+                        k = module_load_and_warn(ctx, *i, true);
                         if (k < 0 && r == 0)
                                 r = k;
                 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/shared/meson.build 
new/systemd-v239+suse.138.g8ae56af78/src/shared/meson.build
--- old/systemd-v239+suse.125.g69f9f79e1/src/shared/meson.build 2018-11-16 
11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/shared/meson.build 2018-12-04 
14:20:30.000000000 +0100
@@ -63,6 +63,8 @@
         machine-image.h
         machine-pool.c
         machine-pool.h
+        module-util.h
+        module-util.c
         nsflags.c
         nsflags.h
         output-mode.c
@@ -132,6 +134,7 @@
                   libcryptsetup,
                   libgcrypt,
                   libiptc,
+                  libkmod,
                   libseccomp,
                   libselinux,
                   libidn,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/shared/module-util.c 
new/systemd-v239+suse.138.g8ae56af78/src/shared/module-util.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/shared/module-util.c       
1970-01-01 01:00:00.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/shared/module-util.c       
2018-12-04 14:20:30.000000000 +0100
@@ -0,0 +1,72 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+
+#include <errno.h>
+
+#include "module-util.h"
+
+int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool 
verbose) {
+        const int probe_flags = KMOD_PROBE_APPLY_BLACKLIST;
+        struct kmod_list *itr;
+        _cleanup_(kmod_module_unref_listp) struct kmod_list *modlist = NULL;
+        int r = 0;
+
+        /* verbose==true means we should log at non-debug level if we
+         * fail to find or load the module. */
+
+        log_debug("Loading module: %s", module);
+
+        r = kmod_module_new_from_lookup(ctx, module, &modlist);
+        if (r < 0)
+                return log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r,
+                                      "Failed to lookup module alias '%s': 
%m", module);
+
+        if (!modlist) {
+                log_full_errno(verbose ? LOG_ERR : LOG_DEBUG, r,
+                               "Failed to find module '%s'", module);
+                return -ENOENT;
+        }
+
+        kmod_list_foreach(itr, modlist) {
+                _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
+                int state, err;
+
+                mod = kmod_module_get_module(itr);
+                state = kmod_module_get_initstate(mod);
+
+                switch (state) {
+                case KMOD_MODULE_BUILTIN:
+                        log_full(verbose ? LOG_INFO : LOG_DEBUG,
+                                 "Module '%s' is builtin", 
kmod_module_get_name(mod));
+                        break;
+
+                case KMOD_MODULE_LIVE:
+                        log_debug("Module '%s' is already loaded", 
kmod_module_get_name(mod));
+                        break;
+
+                default:
+                        err = kmod_module_probe_insert_module(mod, probe_flags,
+                                                              NULL, NULL, 
NULL, NULL);
+                        if (err == 0)
+                                log_full(verbose ? LOG_INFO : LOG_DEBUG,
+                                         "Inserted module '%s'", 
kmod_module_get_name(mod));
+                        else if (err == KMOD_PROBE_APPLY_BLACKLIST)
+                                log_full(verbose ? LOG_INFO : LOG_DEBUG,
+                                         "Module '%s' is blacklisted", 
kmod_module_get_name(mod));
+                        else {
+                                assert(err < 0);
+
+                                log_full_errno(!verbose ? LOG_DEBUG :
+                                               err == -ENODEV ? LOG_NOTICE :
+                                               err == -ENOENT ? LOG_WARNING :
+                                                                LOG_ERR,
+                                               err,
+                                               "Failed to insert module '%s': 
%m",
+                                               kmod_module_get_name(mod));
+                                if (!IN_SET(err, -ENODEV, -ENOENT))
+                                        r = err;
+                        }
+                }
+        }
+
+        return r;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/shared/module-util.h 
new/systemd-v239+suse.138.g8ae56af78/src/shared/module-util.h
--- old/systemd-v239+suse.125.g69f9f79e1/src/shared/module-util.h       
1970-01-01 01:00:00.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/shared/module-util.h       
2018-12-04 14:20:30.000000000 +0100
@@ -0,0 +1,12 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <libkmod.h>
+
+#include "macro.h"
+
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_ctx*, kmod_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_module*, kmod_module_unref);
+DEFINE_TRIVIAL_CLEANUP_FUNC(struct kmod_list*, kmod_module_unref_list);
+
+int module_load_and_warn(struct kmod_ctx *ctx, const char *module, bool 
verbose);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/udev/udev-builtin-kmod.c 
new/systemd-v239+suse.138.g8ae56af78/src/udev/udev-builtin-kmod.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/udev/udev-builtin-kmod.c   
2018-11-16 11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/udev/udev-builtin-kmod.c   
2018-12-04 14:20:30.000000000 +0100
@@ -18,55 +18,23 @@
 
 static struct kmod_ctx *ctx = NULL;
 
-static int load_module(struct udev *udev, const char *alias) {
-        _cleanup_(kmod_module_unref_listp) struct kmod_list *list = NULL;
-        struct kmod_list *l;
-        int err;
-
-        err = kmod_module_new_from_lookup(ctx, alias, &list);
-        if (err < 0)
-                return err;
-
-        if (list == NULL)
-                log_debug("No module matches '%s'", alias);
-
-        kmod_list_foreach(l, list) {
-                _cleanup_(kmod_module_unrefp) struct kmod_module *mod = NULL;
-
-                mod = kmod_module_get_module(l);
-
-                err = kmod_module_probe_insert_module(mod, 
KMOD_PROBE_APPLY_BLACKLIST, NULL, NULL, NULL, NULL);
-                if (err == KMOD_PROBE_APPLY_BLACKLIST)
-                        log_debug("Module '%s' is blacklisted", 
kmod_module_get_name(mod));
-                else if (err == 0)
-                        log_debug("Inserted '%s'", kmod_module_get_name(mod));
-                else
-                        log_debug("Failed to insert '%s'", 
kmod_module_get_name(mod));
-        }
-
-        return err;
-}
-
 _printf_(6,0) static void udev_kmod_log(void *data, int priority, const char 
*file, int line, const char *fn, const char *format, va_list args) {
         log_internalv(priority, 0, file, line, fn, format, args);
 }
 
 static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool 
test) {
-        struct udev *udev = udev_device_get_udev(dev);
         int i;
 
         if (!ctx)
                 return 0;
 
         if (argc < 3 || !streq(argv[1], "load")) {
-                log_error("expect: %s load <module>", argv[0]);
+                log_error("%s: expected: load <module>", argv[0]);
                 return EXIT_FAILURE;
         }
 
-        for (i = 2; argv[i]; i++) {
-                log_debug("Execute '%s' '%s'", argv[1], argv[i]);
-                load_module(udev, argv[i]);
-        }
+        for (i = 2; argv[i]; i++)
+                (void) module_load_and_warn(ctx, argv[i], false);
 
         return EXIT_SUCCESS;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/systemd-v239+suse.125.g69f9f79e1/src/udev/udev-watch.c 
new/systemd-v239+suse.138.g8ae56af78/src/udev/udev-watch.c
--- old/systemd-v239+suse.125.g69f9f79e1/src/udev/udev-watch.c  2018-11-16 
11:27:47.000000000 +0100
+++ new/systemd-v239+suse.138.g8ae56af78/src/udev/udev-watch.c  2018-12-04 
14:20:30.000000000 +0100
@@ -87,8 +87,10 @@
         log_debug("adding watch on '%s'", udev_device_get_devnode(dev));
         wd = inotify_add_watch(inotify_fd, udev_device_get_devnode(dev), 
IN_CLOSE_WRITE);
         if (wd < 0) {
-                log_error_errno(errno, "inotify_add_watch(%d, %s, %o) failed: 
%m",
-                                inotify_fd, udev_device_get_devnode(dev), 
IN_CLOSE_WRITE);
+                log_full_errno(errno == ENOENT ? LOG_DEBUG : LOG_ERR,
+                               errno,
+                               "inotify_add_watch(%d, %s, %o) failed: %m",
+                               inotify_fd, udev_device_get_devnode(dev), 
IN_CLOSE_WRITE);
                 return;
         }
 


Reply via email to