Hello community,

here is the log from the commit of package systemd for openSUSE:Factory checked 
in at 2017-11-30 12:38:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/systemd (Old)
 and      /work/SRC/openSUSE:Factory/.systemd.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "systemd"

Thu Nov 30 12:38:54 2017 rev:265 rq:546399 version:234

Changes:
--------
--- /work/SRC/openSUSE:Factory/systemd/systemd-mini.changes     2017-10-28 
14:19:46.111754726 +0200
+++ /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.changes        
2017-11-30 12:38:55.812013529 +0100
@@ -1,0 +2,55 @@
+Wed Nov 29 10:11:54 UTC 2017 - [email protected]
+
+- Import commit e30f1b10e276fb18db10ea2463fbd7146ae778f6
+
+  63481b24b firstboot: do not write vconsole.conf when arg_keymap is empty 
(bsc#1070124)
+
+-------------------------------------------------------------------
+Wed Nov 29 09:58:08 UTC 2017 - [email protected]
+
+- Add 0001-compat-rules-get-rid-of-scsi_id-when-generating-comp.patch 
(bsc#1051465)
+
+  This patch is not yet merged in the 'compats/udev-compat-symlinks'
+  branch: we asked to upstream if it would be possible to introduce a
+  new specifier that wouldn't strip trailing whitespaces , see
+  https://github.com/systemd/systemd/issues/7462
+
+  Also this allows to give the patch more testing before merging it in
+  the git repo.
+
+-------------------------------------------------------------------
+Thu Nov 23 17:33:19 UTC 2017 - [email protected]
+
+- Drop a useless rm(1) from the specfile
+
+-------------------------------------------------------------------
+Thu Nov 23 09:59:46 CET 2017 - [email protected]
+
+- Remove requires for pwdutils, we don't need the shadow tools
+  anymore [bsc#1069150]
+
+-------------------------------------------------------------------
+Fri Nov 17 08:59:50 UTC 2017 - [email protected]
+
+- Import commit 4b9afa11f918796184e1264d618b4ff5d18e481b
+
+  22dcb1d04 tmpfiles: when /etc is not fully initialized, some specifiers are 
expected to be unresolvable (#6860) (bsc#1055664)
+  216beb768 tmpfiles: Allow create symlink on directories (#6039)
+  baf85eb79 udev: net_setup_link: don't error out when we couldn't apply link 
config (#7328)
+
+- Remove stderr redirection to /dev/null when calling %tmpfiles_create
+  since it's not needed anymore due to commit 22dcb1d04. Indeed the
+  messages are no more emitted at LOG_WARN but LOG_NOTICE.
+
+-------------------------------------------------------------------
+Mon Nov 13 11:06:09 UTC 2017 - [email protected]
+
+- Import commit b9a41367b6c1164318443491cc3dae0e8208e15c
+
+  86804326f systemd-firstboot: add vconsole keymap support (#7035) 
(bsc#1046436)
+  9b64225e9 resolved: fix loop on packets with pseudo dns types (bsc#1065276 
CVE-2017-15908)
+
+- Drop 0001-systemd-firstboot-add-vconsole-keymap-support.patch since
+  it's been merged upstream and backported to SUSE/v234 (see above).
+
+-------------------------------------------------------------------
systemd.changes: same change

Old:
----
  0001-systemd-firstboot-add-vconsole-keymap-support.patch

New:
----
  0001-compat-rules-get-rid-of-scsi_id-when-generating-comp.patch

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

Other differences:
------------------
++++++ systemd-mini.spec ++++++
--- /var/tmp/diff_new_pack.iLdYwj/_old  2017-11-30 12:38:57.307959134 +0100
+++ /var/tmp/diff_new_pack.iLdYwj/_new  2017-11-30 12:38:57.311958988 +0100
@@ -116,7 +116,6 @@
 Requires:       kbd
 Requires:       kmod >= 15
 Requires:       netcfg >= 11.5
-Requires:       pwdutils
 Requires:       systemd-presets-branding
 Requires:       sysvinit-tools
 Requires:       udev = %{version}-%{release}
@@ -156,14 +155,14 @@
 
 Source1065:     udev-remount-tmpfs
 
-# Patches listed in here are really special cases. Normally all
+# Patches listed in here are put in quarantine. Normally all
 # changes must go to upstream first and then are cherry-picked in the
 # SUSE git repository. But in very few cases, some stuff might be
 # broken in upstream and need an urgent fix. Even in this case, the
 # patches are temporary and should be removed as soon as a fix is
 # merged by upstream.
 Patch1:         0001-core-disable-session-keyring-per-system-sevice-entir.patch
-Patch2:         0001-systemd-firstboot-add-vconsole-keymap-support.patch
+Patch2:         0001-compat-rules-get-rid-of-scsi_id-when-generating-comp.patch
 
 %description
 Systemd is a system and service manager, compatible with SysV and LSB
@@ -482,7 +481,6 @@
 ln -sf %{_prefix}/lib/systemd/systemd-udevd %{buildroot}/sbin/udevd
 
 install -m755 -D %{S:1065} %{buildroot}/%{_prefix}/lib/udev/remount-tmpfs
-rm -rf %{buildroot}%{_sysconfdir}/rpm
 
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/sysv-convert
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated
@@ -677,7 +675,7 @@
 /usr/lib/systemd/systemd-random-seed save || :
 systemctl daemon-reexec  || :
 %journal_catalog_update
-%tmpfiles_create 2>/dev/null
+%tmpfiles_create
 
 # Create default config in /etc at first install.
 # Later package updates should not overwrite these settings.

++++++ systemd.spec ++++++
--- /var/tmp/diff_new_pack.iLdYwj/_old  2017-11-30 12:38:57.335958116 +0100
+++ /var/tmp/diff_new_pack.iLdYwj/_new  2017-11-30 12:38:57.339957970 +0100
@@ -114,7 +114,6 @@
 Requires:       kbd
 Requires:       kmod >= 15
 Requires:       netcfg >= 11.5
-Requires:       pwdutils
 Requires:       systemd-presets-branding
 Requires:       sysvinit-tools
 Requires:       udev = %{version}-%{release}
@@ -154,14 +153,14 @@
 
 Source1065:     udev-remount-tmpfs
 
-# Patches listed in here are really special cases. Normally all
+# Patches listed in here are put in quarantine. Normally all
 # changes must go to upstream first and then are cherry-picked in the
 # SUSE git repository. But in very few cases, some stuff might be
 # broken in upstream and need an urgent fix. Even in this case, the
 # patches are temporary and should be removed as soon as a fix is
 # merged by upstream.
 Patch1:         0001-core-disable-session-keyring-per-system-sevice-entir.patch
-Patch2:         0001-systemd-firstboot-add-vconsole-keymap-support.patch
+Patch2:         0001-compat-rules-get-rid-of-scsi_id-when-generating-comp.patch
 
 %description
 Systemd is a system and service manager, compatible with SysV and LSB
@@ -480,7 +479,6 @@
 ln -sf %{_prefix}/lib/systemd/systemd-udevd %{buildroot}/sbin/udevd
 
 install -m755 -D %{S:1065} %{buildroot}/%{_prefix}/lib/udev/remount-tmpfs
-rm -rf %{buildroot}%{_sysconfdir}/rpm
 
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/sysv-convert
 mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated
@@ -675,7 +673,7 @@
 /usr/lib/systemd/systemd-random-seed save || :
 systemctl daemon-reexec  || :
 %journal_catalog_update
-%tmpfiles_create 2>/dev/null
+%tmpfiles_create
 
 # Create default config in /etc at first install.
 # Later package updates should not overwrite these settings.

++++++ 0001-compat-rules-get-rid-of-scsi_id-when-generating-comp.patch ++++++
>From 17be35b017aa39fad8aec98c81d4fade917096ec Mon Sep 17 00:00:00 2001
From: Franck Bui <[email protected]>
Date: Mon, 27 Nov 2017 11:46:40 +0100
Subject: [PATCH 1/1] compat-rules: get rid of scsi_id when generating compat
 symlinks for NVMe devices

The SCSI translation layer for NVMe devices has been removed from the
kernel since 4.13 (commit 3f7f25a910ed8988b2a87c1ca2bfee6b4fb83ac7),
so drop scsi_id in favor of the sysfs interface to generate the
name of the compat symlinks.

Unfortunately we have to retrieve manually the model attribute
because %s{} strips trailing whitespaces otherwise. Indeed scsi_id
replaced them with a single '_' char due to the use of the
'--replace-whitespace' option.

[tblume: fixes bsc#1051465]
---
 rules/61-persistent-storage-compat.rules | 34 ++++++++++++++++++++++++++++----
 1 file changed, 30 insertions(+), 4 deletions(-)

diff --git a/rules/61-persistent-storage-compat.rules 
b/rules/61-persistent-storage-compat.rules
index 82a38fac7..639dc1ee1 100644
--- a/rules/61-persistent-storage-compat.rules
+++ b/rules/61-persistent-storage-compat.rules
@@ -16,6 +16,10 @@
 # doesn't rely on them and they could be disabled permanently.
 #
 # Thanks !
+#
+# Note: this rules file can rely on all ID_* variables (set by
+# 60-persistent-storage.rule) but should not overwrite them, see
+# bsc#1048679 for details.
 
 ACTION=="remove", GOTO="persistent_storage_end"
 
@@ -49,11 +53,33 @@ ENV{COMPAT_SYMLINK_GENERATION}!="?*", 
ENV{COMPAT_SYMLINK_GENERATION}="1"
 #
 ENV{COMPAT_SYMLINK_GENERATION}!="1", GOTO="generation_2"
 
-# NVMe links were introduced first via a SUSE specific commit
+# NVMe symlinks were introduced first via a SUSE specific commit
 # (bsc#944132) and upstream gained support later but of course using a
-# different scheme. Also note that ID_SERIAL is already used by the
-# contemporary rules, see bsc#1048679 for details.
-KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}!="?*", 
PROGRAM="scsi_id --whitelisted --replace-whitespace -d $devnode", RESULT=="?*", 
ENV{ID_NVME_SERIAL_COMPAT}="$result"
+# different scheme.
+
+# The SCSI translation layer for NVMe devices has been removed from
+# the kernel since 4.13, therefore we switched from scsi_id to the
+# sysfs interface to generate the name of the compat symlinks.
+# Unfortunately we can't use %s{model} to retrieve the model string
+# because udev strips any trailing whitespaces and some plateforms
+# (QEMU does that) might append such chars. In those cases scsi_id was
+# replacing them with a single trailing '_'. Therefore the currently
+# code retrieves the model string manually making sure to preserve all
+# characters so trailing whitespaces are still converted when the
+# symlink is created.
+
+# KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}!="?*", 
ATTRS{model}=="?*", ATTRS{serial}=="?*" \
+#   PROGRAM=="/bin/sh -c 'MODEL=\"%s{model}\"; echo \"${MODEL:0:16}\"'", 
ENV{ID_NVME_SERIAL_COMPAT}="SNVMe_%c%s{serial}"
+
+KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}!="?*", 
ATTRS{model}=="?*", ATTRS{serial}=="?*" \
+  PROGRAM=="/bin/sh -c ' \
+    cd /sys/%p; \
+    while ! [ -f model ]; do \
+      cd ..; \
+      [ $(pwd) = %S ] && exit 1; \
+   done; \
+   cut -c 1-16 model'", ENV{ID_NVME_SERIAL_COMPAT}="SNVMe_%c%s{serial}"
+
 KERNEL=="nvme*", ENV{DEVTYPE}=="disk", ENV{ID_NVME_SERIAL_COMPAT}=="?*", 
SYMLINK+="disk/by-id/nvme-$env{ID_NVME_SERIAL_COMPAT}"
 KERNEL=="nvme*", ENV{DEVTYPE}=="partition", ENV{ID_NVME_SERIAL_COMPAT}=="?*", 
SYMLINK+="disk/by-id/nvme-$env{ID_NVME_SERIAL_COMPAT}-part%n"
 
-- 
2.14.2

++++++ systemd-234.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/man/systemd-firstboot.xml 
new/systemd-234/man/systemd-firstboot.xml
--- old/systemd-234/man/systemd-firstboot.xml   2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/man/systemd-firstboot.xml   2017-11-29 11:11:42.000000000 
+0100
@@ -77,6 +77,8 @@
       locale variables <varname>LANG=</varname> and
       <varname>LC_MESSAGES</varname></para></listitem>
 
+      <listitem><para>The system keyboard map</para></listitem>
+
       <listitem><para>The system time zone</para></listitem>
 
       <listitem><para>The system host name</para></listitem>
@@ -136,6 +138,15 @@
       </varlistentry>
 
       <varlistentry>
+        
<term><option>--keymap=<replaceable>KEYMAP</replaceable></option></term>
+
+        <listitem><para>Sets the system keyboard layout. The argument should 
be a valid keyboard map,
+        such as <literal>de-latin1</literal>. This controls the 
<literal>KEYMAP</literal> entry in the
+        <citerefentry 
project='man-pages'><refentrytitle>vconsole.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
+        configuration file.</para></listitem>
+      </varlistentry>
+
+      <varlistentry>
         
<term><option>--timezone=<replaceable>TIMEZONE</replaceable></option></term>
 
         <listitem><para>Sets the system time zone. The argument should
@@ -182,6 +193,7 @@
 
       <varlistentry>
         <term><option>--prompt-locale</option></term>
+        <term><option>--prompt-keymap</option></term>
         <term><option>--prompt-timezone</option></term>
         <term><option>--prompt-hostname</option></term>
         <term><option>--prompt-root-password</option></term>
@@ -195,9 +207,10 @@
       <varlistentry>
         <term><option>--prompt</option></term>
 
-        <listitem><para>Query the user for locale, timezone, hostname
+        <listitem><para>Query the user for locale, keymap, timezone, hostname
         and root password. This is equivalent to specifying
         <option>--prompt-locale</option>,
+        <option>--prompt-keymap</option>,
         <option>--prompt-timezone</option>,
         <option>--prompt-hostname</option>,
         <option>--prompt-root-password</option> in combination.</para>
@@ -206,6 +219,7 @@
 
       <varlistentry>
         <term><option>--copy-locale</option></term>
+        <term><option>--copy-keymap</option></term>
         <term><option>--copy-timezone</option></term>
         <term><option>--copy-root-password</option></term>
 
@@ -217,9 +231,10 @@
       <varlistentry>
         <term><option>--copy</option></term>
 
-        <listitem><para>Copy locale, time zone and root password from
+        <listitem><para>Copy locale, keymap, time zone and root password from
         the host. This is equivalent to specifying
         <option>--copy-locale</option>,
+        <option>--copy-keymap</option>,
         <option>--copy-timezone</option>,
         <option>--copy-root-password</option> in combination.</para>
         </listitem>
@@ -265,6 +280,7 @@
     <para>
       
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
       <citerefentry 
project='man-pages'><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
+      <citerefentry 
project='man-pages'><refentrytitle>vconsole.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
       
<citerefentry><refentrytitle>localtime</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
       
<citerefentry><refentrytitle>hostname</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
       
<citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/man/tmpfiles.d.xml 
new/systemd-234/man/tmpfiles.d.xml
--- old/systemd-234/man/tmpfiles.d.xml  2017-10-26 14:29:18.000000000 +0200
+++ new/systemd-234/man/tmpfiles.d.xml  2017-11-29 11:11:42.000000000 +0100
@@ -273,13 +273,14 @@
           <term><varname>L</varname></term>
           <term><varname>L+</varname></term>
           <listitem><para>Create a symlink if it does not exist
-          yet. If suffixed with <varname>+</varname> and a file
-          already exists where the symlink is to be created, it will
-          be removed and be replaced by the symlink. If the argument
-          is omitted, symlinks to files with the same name residing in
-          the directory <filename>/usr/share/factory/</filename> are
-          created. Note that permissions and ownership on symlinks
-          are ignored.</para></listitem>
+          yet. If suffixed with <varname>+</varname> and a file or
+          directory already exists where the symlink is to be created,
+          it will be removed and be replaced by the symlink. If the
+          argument is omitted, symlinks to files with the same name
+          residing in the directory
+          <filename>/usr/share/factory/</filename> are created. Note
+          that permissions and ownership on symlinks are ignored.
+          </para></listitem>
         </varlistentry>
 
         <varlistentry>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/basic/locale-util.c 
new/systemd-234/src/basic/locale-util.c
--- old/systemd-234/src/basic/locale-util.c     2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/basic/locale-util.c     2017-11-29 11:11:42.000000000 
+0100
@@ -20,6 +20,7 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <ftw.h>
 #include <langinfo.h>
 #include <libintl.h>
 #include <locale.h>
@@ -30,6 +31,7 @@
 #include <sys/mman.h>
 #include <sys/stat.h>
 
+#include "def.h"
 #include "dirent-util.h"
 #include "fd-util.h"
 #include "hashmap.h"
@@ -270,6 +272,99 @@
         return (bool) cached_answer;
 }
 
+static thread_local Set *keymaps = NULL;
+
+static int nftw_cb(
+                const char *fpath,
+                const struct stat *sb,
+                int tflag,
+                struct FTW *ftwbuf) {
+
+        char *p, *e;
+        int r;
+
+        if (tflag != FTW_F)
+                return 0;
+
+        if (!endswith(fpath, ".map") &&
+            !endswith(fpath, ".map.gz"))
+                return 0;
+
+        p = strdup(basename(fpath));
+        if (!p)
+                return FTW_STOP;
+
+        e = endswith(p, ".map");
+        if (e)
+                *e = 0;
+
+        e = endswith(p, ".map.gz");
+        if (e)
+                *e = 0;
+
+        r = set_consume(keymaps, p);
+        if (r < 0 && r != -EEXIST)
+                return r;
+
+        return 0;
+}
+
+int get_keymaps(char ***ret) {
+        _cleanup_strv_free_ char **l = NULL;
+        const char *dir;
+        int r;
+
+        keymaps = set_new(&string_hash_ops);
+        if (!keymaps)
+                return -ENOMEM;
+
+        NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS) {
+                r = nftw(dir, nftw_cb, 20, 
FTW_MOUNT|FTW_PHYS|FTW_ACTIONRETVAL);
+
+                if (r == FTW_STOP)
+                        log_debug("Directory not found %s", dir);
+                else if (r < 0)
+                        log_debug_errno(r, "Can't add keymap: %m");
+        }
+
+        l = set_get_strv(keymaps);
+        if (!l) {
+                set_free_free(keymaps);
+                return -ENOMEM;
+        }
+
+        set_free(keymaps);
+
+        if (strv_isempty(l))
+                return -ENOENT;
+
+        strv_sort(l);
+
+        *ret = l;
+        l = NULL;
+
+        return 0;
+}
+
+bool keymap_is_valid(const char *name) {
+
+        if (isempty(name))
+                return false;
+
+        if (strlen(name) >= 128)
+                return false;
+
+        if (!utf8_is_valid(name))
+                return false;
+
+        if (!filename_is_valid(name))
+                return false;
+
+        if (!string_is_safe(name))
+                return false;
+
+        return true;
+}
 
 const char *special_glyph(SpecialGlyph code) {
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/basic/locale-util.h 
new/systemd-234/src/basic/locale-util.h
--- old/systemd-234/src/basic/locale-util.h     2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/basic/locale-util.h     2017-11-29 11:11:42.000000000 
+0100
@@ -71,3 +71,6 @@
 
 const char* locale_variable_to_string(LocaleVariable i) _const_;
 LocaleVariable locale_variable_from_string(const char *s) _pure_;
+
+int get_keymaps(char ***l);
+bool keymap_is_valid(const char *name);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/firstboot/firstboot.c 
new/systemd-234/src/firstboot/firstboot.c
--- old/systemd-234/src/firstboot/firstboot.c   2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/firstboot/firstboot.c   2017-11-29 11:11:42.000000000 
+0100
@@ -44,16 +44,19 @@
 
 static char *arg_root = NULL;
 static char *arg_locale = NULL;  /* $LANG */
+static char *arg_keymap = NULL;
 static char *arg_locale_messages = NULL; /* $LC_MESSAGES */
 static char *arg_timezone = NULL;
 static char *arg_hostname = NULL;
 static sd_id128_t arg_machine_id = {};
 static char *arg_root_password = NULL;
 static bool arg_prompt_locale = false;
+static bool arg_prompt_keymap = false;
 static bool arg_prompt_timezone = false;
 static bool arg_prompt_hostname = false;
 static bool arg_prompt_root_password = false;
 static bool arg_copy_locale = false;
+static bool arg_copy_keymap = false;
 static bool arg_copy_timezone = false;
 static bool arg_copy_root_password = false;
 
@@ -285,6 +288,86 @@
         return 0;
 }
 
+static int prompt_keymap(void) {
+        _cleanup_strv_free_ char **kmaps = NULL;
+        int r;
+
+        if (arg_keymap)
+                return 0;
+
+        if (!arg_prompt_keymap)
+                return 0;
+
+        r = get_keymaps(&kmaps);
+        if (r == -ENOENT) /* no keymaps installed */
+                return r;
+        if (r < 0)
+                return log_error_errno(r, "Failed to read keymaps: %m");
+
+        print_welcome();
+
+        printf("\nAvailable keymaps:\n\n");
+        r = show_menu(kmaps, 3, 22, 60);
+        if (r < 0)
+                return r;
+
+        putchar('\n');
+
+        r = prompt_loop("Please enter system keymap name or number", kmaps, 
keymap_is_valid, &arg_keymap);
+        if (r < 0)
+                return r;
+
+        if (isempty(arg_keymap))
+                return 0;
+
+        return 0;
+}
+
+static int process_keymap(void) {
+        const char *etc_vconsoleconf;
+        char **keymap;
+        int r;
+
+        etc_vconsoleconf = prefix_roota(arg_root, "/etc/vconsole.conf");
+        if (laccess(etc_vconsoleconf, F_OK) >= 0)
+                return 0;
+
+        if (arg_copy_keymap && arg_root) {
+
+                mkdir_parents(etc_vconsoleconf, 0755);
+                r = copy_file("/etc/vconsole.conf", etc_vconsoleconf, 0, 0644, 
0, COPY_REFLINK);
+                if (r != -ENOENT) {
+                        if (r < 0)
+                                return log_error_errno(r, "Failed to copy %s: 
%m", etc_vconsoleconf);
+
+                        log_info("%s copied.", etc_vconsoleconf);
+                        return 0;
+                }
+        }
+
+        r = prompt_keymap();
+        if (r == -ENOENT)
+                return 0; /* don't fail if no keymaps are installed */
+        if (r < 0)
+                return r;
+
+        if (isempty(arg_keymap))
+                return 0;
+
+        keymap = STRV_MAKE(strjoina("KEYMAP=", arg_keymap));
+
+        r = mkdir_parents(etc_vconsoleconf, 0755);
+        if (r < 0)
+                return log_error_errno(r, "Failed to create the parent 
directory of %s: %m", etc_vconsoleconf);
+
+        r = write_env_file(etc_vconsoleconf, keymap);
+        if (r < 0)
+                return log_error_errno(r, "Failed to write %s: %m", 
etc_vconsoleconf);
+
+        log_info("%s written.", etc_vconsoleconf);
+        return 0;
+}
+
 static int prompt_timezone(void) {
         _cleanup_strv_free_ char **zones = NULL;
         int r;
@@ -611,20 +694,23 @@
                "     --root=PATH               Operate on an alternate 
filesystem root\n"
                "     --locale=LOCALE           Set primary locale (LANG=)\n"
                "     --locale-messages=LOCALE  Set message locale 
(LC_MESSAGES=)\n"
+               "     --keymap=KEYMAP           Set keymap\n"
                "     --timezone=TIMEZONE       Set timezone\n"
                "     --hostname=NAME           Set host name\n"
                "     --machine-ID=ID           Set machine ID\n"
                "     --root-password=PASSWORD  Set root password\n"
                "     --root-password-file=FILE Set root password from file\n"
                "     --prompt-locale           Prompt the user for locale 
settings\n"
+               "     --prompt-keymap           Prompt the user for keymap 
settings\n"
                "     --prompt-timezone         Prompt the user for timezone\n"
                "     --prompt-hostname         Prompt the user for hostname\n"
                "     --prompt-root-password    Prompt the user for root 
password\n"
                "     --prompt                  Prompt for all of the above\n"
                "     --copy-locale             Copy locale from host\n"
+               "     --copy-keymap             Copy keymap from host\n"
                "     --copy-timezone           Copy timezone from host\n"
                "     --copy-root-password      Copy root password from host\n"
-               "     --copy                    Copy locale, timezone, root 
password\n"
+               "     --copy                    Copy locale, keymap, timezone, 
root password\n"
                "     --setup-machine-id        Generate a new random machine 
ID\n"
                , program_invocation_short_name);
 }
@@ -636,6 +722,7 @@
                 ARG_ROOT,
                 ARG_LOCALE,
                 ARG_LOCALE_MESSAGES,
+                ARG_KEYMAP,
                 ARG_TIMEZONE,
                 ARG_HOSTNAME,
                 ARG_MACHINE_ID,
@@ -643,11 +730,13 @@
                 ARG_ROOT_PASSWORD_FILE,
                 ARG_PROMPT,
                 ARG_PROMPT_LOCALE,
+                ARG_PROMPT_KEYMAP,
                 ARG_PROMPT_TIMEZONE,
                 ARG_PROMPT_HOSTNAME,
                 ARG_PROMPT_ROOT_PASSWORD,
                 ARG_COPY,
                 ARG_COPY_LOCALE,
+                ARG_COPY_KEYMAP,
                 ARG_COPY_TIMEZONE,
                 ARG_COPY_ROOT_PASSWORD,
                 ARG_SETUP_MACHINE_ID,
@@ -659,6 +748,7 @@
                 { "root",                 required_argument, NULL, ARG_ROOT    
             },
                 { "locale",               required_argument, NULL, ARG_LOCALE  
             },
                 { "locale-messages",      required_argument, NULL, 
ARG_LOCALE_MESSAGES      },
+                { "keymap",               required_argument, NULL, ARG_KEYMAP  
             },
                 { "timezone",             required_argument, NULL, 
ARG_TIMEZONE             },
                 { "hostname",             required_argument, NULL, 
ARG_HOSTNAME             },
                 { "machine-id",           required_argument, NULL, 
ARG_MACHINE_ID           },
@@ -666,11 +756,13 @@
                 { "root-password-file",   required_argument, NULL, 
ARG_ROOT_PASSWORD_FILE   },
                 { "prompt",               no_argument,       NULL, ARG_PROMPT  
             },
                 { "prompt-locale",        no_argument,       NULL, 
ARG_PROMPT_LOCALE        },
+                { "prompt-keymap",        no_argument,       NULL, 
ARG_PROMPT_KEYMAP        },
                 { "prompt-timezone",      no_argument,       NULL, 
ARG_PROMPT_TIMEZONE      },
                 { "prompt-hostname",      no_argument,       NULL, 
ARG_PROMPT_HOSTNAME      },
                 { "prompt-root-password", no_argument,       NULL, 
ARG_PROMPT_ROOT_PASSWORD },
                 { "copy",                 no_argument,       NULL, ARG_COPY    
             },
                 { "copy-locale",          no_argument,       NULL, 
ARG_COPY_LOCALE          },
+                { "copy-keymap",          no_argument,       NULL, 
ARG_COPY_KEYMAP          },
                 { "copy-timezone",        no_argument,       NULL, 
ARG_COPY_TIMEZONE        },
                 { "copy-root-password",   no_argument,       NULL, 
ARG_COPY_ROOT_PASSWORD   },
                 { "setup-machine-id",     no_argument,       NULL, 
ARG_SETUP_MACHINE_ID     },
@@ -723,6 +815,18 @@
 
                         break;
 
+                case ARG_KEYMAP:
+                        if (!keymap_is_valid(optarg)) {
+                                log_error("Keymap %s is not valid.", optarg);
+                                return -EINVAL;
+                        }
+
+                        r = free_and_strdup(&arg_keymap, optarg);
+                        if (r < 0)
+                                return log_oom();
+
+                        break;
+
                 case ARG_TIMEZONE:
                         if (!timezone_is_valid(optarg)) {
                                 log_error("Timezone %s is not valid.", optarg);
@@ -772,13 +876,17 @@
                         break;
 
                 case ARG_PROMPT:
-                        arg_prompt_locale = arg_prompt_timezone = 
arg_prompt_hostname = arg_prompt_root_password = true;
+                        arg_prompt_locale = arg_prompt_keymap = 
arg_prompt_timezone = arg_prompt_hostname = arg_prompt_root_password = true;
                         break;
 
                 case ARG_PROMPT_LOCALE:
                         arg_prompt_locale = true;
                         break;
 
+                case ARG_PROMPT_KEYMAP:
+                        arg_prompt_keymap = true;
+                        break;
+
                 case ARG_PROMPT_TIMEZONE:
                         arg_prompt_timezone = true;
                         break;
@@ -792,13 +900,17 @@
                         break;
 
                 case ARG_COPY:
-                        arg_copy_locale = arg_copy_timezone = 
arg_copy_root_password = true;
+                        arg_copy_locale = arg_copy_keymap = arg_copy_timezone 
= arg_copy_root_password = true;
                         break;
 
                 case ARG_COPY_LOCALE:
                         arg_copy_locale = true;
                         break;
 
+                case ARG_COPY_KEYMAP:
+                        arg_copy_keymap = true;
+                        break;
+
                 case ARG_COPY_TIMEZONE:
                         arg_copy_timezone = true;
                         break;
@@ -853,6 +965,10 @@
         if (r < 0)
                 goto finish;
 
+        r = process_keymap();
+        if (r < 0)
+                goto finish;
+
         r = process_timezone();
         if (r < 0)
                 goto finish;
@@ -873,6 +989,7 @@
         free(arg_root);
         free(arg_locale);
         free(arg_locale_messages);
+        free(arg_keymap);
         free(arg_timezone);
         free(arg_hostname);
         string_erase(arg_root_password);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/locale/localectl.c 
new/systemd-234/src/locale/localectl.c
--- old/systemd-234/src/locale/localectl.c      2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/locale/localectl.c      2017-11-29 11:11:42.000000000 
+0100
@@ -273,68 +273,15 @@
         return r;
 }
 
-static Set *keymaps = NULL;
-
-static int nftw_cb(
-                const char *fpath,
-                const struct stat *sb,
-                int tflag,
-                struct FTW *ftwbuf) {
-
-        char *p, *e;
-        int r;
-
-        if (tflag != FTW_F)
-                return 0;
-
-        if (!endswith(fpath, ".map") &&
-            !endswith(fpath, ".map.gz"))
-                return 0;
-
-        p = strdup(basename(fpath));
-        if (!p)
-                return log_oom();
-
-        e = endswith(p, ".map");
-        if (e)
-                *e = 0;
-
-        e = endswith(p, ".map.gz");
-        if (e)
-                *e = 0;
-
-        r = set_consume(keymaps, p);
-        if (r < 0 && r != -EEXIST)
-                return log_error_errno(r, "Can't add keymap: %m");
-
-        return 0;
-}
-
 static int list_vconsole_keymaps(sd_bus *bus, char **args, unsigned n) {
-        _cleanup_strv_free_ char **l = NULL;
-        const char *dir;
-
-        keymaps = set_new(&string_hash_ops);
-        if (!keymaps)
-                return log_oom();
-
-        NULSTR_FOREACH(dir, KBD_KEYMAP_DIRS)
-                nftw(dir, nftw_cb, 20, FTW_MOUNT|FTW_PHYS);
-
-        l = set_get_strv(keymaps);
-        if (!l) {
-                set_free_free(keymaps);
-                return log_oom();
-        }
-
-        set_free(keymaps);
+       _cleanup_strv_free_ char **l = NULL;
+        int r;
 
-        if (strv_isempty(l)) {
-                log_error("Couldn't find any console keymaps.");
-                return -ENOENT;
-        }
+        assert(args);
 
-        strv_sort(l);
+        r = get_keymaps(&l);
+        if (r < 0)
+                return log_error_errno(r, "Failed to read list of keymaps: 
%m");
 
         pager_open(arg_no_pager, false);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/resolve/resolved-dns-packet.c 
new/systemd-234/src/resolve/resolved-dns-packet.c
--- old/systemd-234/src/resolve/resolved-dns-packet.c   2017-10-26 
14:29:18.000000000 +0200
+++ new/systemd-234/src/resolve/resolved-dns-packet.c   2017-11-29 
11:11:42.000000000 +0100
@@ -1503,7 +1503,7 @@
 
                 found = true;
 
-                while (bitmask) {
+                for (; bitmask; bit++, bitmask >>= 1)
                         if (bitmap[i] & bitmask) {
                                 uint16_t n;
 
@@ -1517,10 +1517,6 @@
                                 if (r < 0)
                                         return r;
                         }
-
-                        bit++;
-                        bitmask >>= 1;
-                }
         }
 
         if (!found)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/test/test-locale-util.c 
new/systemd-234/src/test/test-locale-util.c
--- old/systemd-234/src/test/test-locale-util.c 2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/test/test-locale-util.c 2017-11-29 11:11:42.000000000 
+0100
@@ -50,9 +50,38 @@
         assert_se(!locale_is_valid("\x01gar\x02 bage\x03"));
 }
 
+static void test_keymaps(void) {
+        _cleanup_strv_free_ char **kmaps = NULL;
+        char **p;
+        int r;
+
+        assert_se(!keymap_is_valid(""));
+        assert_se(!keymap_is_valid("/usr/bin/foo"));
+        assert_se(!keymap_is_valid("\x01gar\x02 bage\x03"));
+
+        r = get_keymaps(&kmaps);
+        if (r == -ENOENT)
+                return; /* skip test if no keymaps are installed */
+
+        assert_se(r >= 0);
+        assert_se(kmaps);
+
+        STRV_FOREACH(p, kmaps) {
+                puts(*p);
+                assert_se(keymap_is_valid(*p));
+        }
+
+        assert_se(keymap_is_valid("uk"));
+        assert_se(keymap_is_valid("de-nodeadkeys"));
+        assert_se(keymap_is_valid("ANSI-dvorak"));
+        assert_se(keymap_is_valid("unicode"));
+}
+
 int main(int argc, char *argv[]) {
         test_get_locales();
         test_locale_is_valid();
 
+        test_keymaps();
+
         return 0;
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/tmpfiles/tmpfiles.c 
new/systemd-234/src/tmpfiles/tmpfiles.c
--- old/systemd-234/src/tmpfiles/tmpfiles.c     2017-10-26 14:29:18.000000000 
+0200
+++ new/systemd-234/src/tmpfiles/tmpfiles.c     2017-11-29 11:11:42.000000000 
+0100
@@ -167,14 +167,49 @@
 static OrderedHashmap *items = NULL, *globs = NULL;
 static Set *unix_sockets = NULL;
 
+static int specifier_machine_id_safe(char specifier, void *data, void 
*userdata, char **ret);
+
 static const Specifier specifier_table[] = {
-        { 'm', specifier_machine_id, NULL },
+        { 'm', specifier_machine_id_safe, NULL },
         { 'b', specifier_boot_id, NULL },
         { 'H', specifier_host_name, NULL },
         { 'v', specifier_kernel_release, NULL },
         {}
 };
 
+static int specifier_machine_id_safe(char specifier, void *data, void 
*userdata, char **ret) {
+        int r;
+
+        /* If /etc/machine_id is missing (e.g. in a chroot environment), 
returns
+         * a recognizable error so that the caller can skip the rule
+         * gracefully. */
+
+        r = specifier_machine_id(specifier, data, userdata, ret);
+        if (r == -ENOENT)
+                return -ENOKEY;
+
+        return r;
+}
+
+static int log_unresolvable_specifier(const char *filename, unsigned line) {
+        static bool notified = false;
+
+        /* This is called when /etc is not fully initialized (e.g. in a chroot
+         * environment) where some specifiers are unresolvable. These cases are
+         * not considered as an error so log at LOG_NOTICE only for the first
+         * time and then downgrade this to LOG_DEBUG for the rest. */
+
+        log_full(notified ? LOG_DEBUG : LOG_NOTICE,
+                 "[%s:%u] Failed to resolve specifier: uninitialized /etc 
detected, skipping",
+                 filename, line);
+
+        if (!notified)
+                log_notice("All rules containing unresolvable specifiers will 
be skipped.");
+
+        notified = true;
+        return 0;
+}
+
 static bool needs_glob(ItemType t) {
         return IN_SET(t,
                       WRITE_FILE,
@@ -710,7 +745,7 @@
         p = i->argument;
 
         for (;;) {
-                _cleanup_free_ char *name = NULL, *value = NULL, *xattr = 
NULL, *xattr_replaced = NULL;
+                _cleanup_free_ char *name = NULL, *value = NULL, *xattr = NULL;
 
                 r = extract_first_word(&p, &xattr, NULL, 
EXTRACT_QUOTES|EXTRACT_CUNESCAPE);
                 if (r < 0)
@@ -718,11 +753,7 @@
                 if (r <= 0)
                         break;
 
-                r = specifier_printf(xattr, specifier_table, NULL, 
&xattr_replaced);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to replace 
specifiers in extended attribute '%s': %m", xattr);
-
-                r = split_pair(xattr_replaced, "=", &name, &value);
+                r = split_pair(xattr, "=", &name, &value);
                 if (r < 0) {
                         log_warning_errno(r, "Failed to parse extended 
attribute, ignoring: %s", xattr);
                         continue;
@@ -1041,19 +1072,9 @@
         }
 
         if (i->argument) {
-                _cleanup_free_ char *unescaped = NULL, *replaced = NULL;
-
                 log_debug("%s to \"%s\".", i->type == CREATE_FILE ? 
"Appending" : "Writing", path);
 
-                r = cunescape(i->argument, 0, &unescaped);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to unescape 
parameter to write: %s", i->argument);
-
-                r = specifier_printf(unescaped, specifier_table, NULL, 
&replaced);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to replace 
specifiers in parameter to write '%s': %m", unescaped);
-
-                r = loop_write(fd, replaced, strlen(replaced), false);
+                r = loop_write(fd, i->argument, strlen(i->argument), false);
                 if (r < 0)
                         return log_error_errno(r, "Failed to write file 
\"%s\": %m", path);
         } else
@@ -1162,7 +1183,6 @@
 DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(creation_mode_verb, CreationMode);
 
 static int create_item(Item *i) {
-        _cleanup_free_ char *resolved = NULL;
         struct stat st;
         int r = 0;
         int q = 0;
@@ -1188,12 +1208,8 @@
                 break;
 
         case COPY_FILES: {
-                r = specifier_printf(i->argument, specifier_table, NULL, 
&resolved);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to substitute 
specifiers in copy source %s: %m", i->argument);
-
-                log_debug("Copying tree \"%s\" to \"%s\".", resolved, i->path);
-                r = copy_tree(resolved, i->path, i->uid_set ? i->uid : 
UID_INVALID, i->gid_set ? i->gid : GID_INVALID, COPY_REFLINK);
+                log_debug("Copying tree \"%s\" to \"%s\".", i->argument, 
i->path);
+                r = copy_tree(i->argument, i->path, i->uid_set ? i->uid : 
UID_INVALID, i->gid_set ? i->gid : GID_INVALID, COPY_REFLINK);
 
                 if (r == -EROFS && stat(i->path, &st) == 0)
                         r = -EEXIST;
@@ -1204,8 +1220,8 @@
                         if (r != -EEXIST)
                                 return log_error_errno(r, "Failed to copy 
files to %s: %m", i->path);
 
-                        if (stat(resolved, &a) < 0)
-                                return log_error_errno(errno, "stat(%s) 
failed: %m", resolved);
+                        if (stat(i->argument, &a) < 0)
+                                return log_error_errno(errno, "stat(%s) 
failed: %m", i->argument);
 
                         if (stat(i->path, &b) < 0)
                                 return log_error_errno(errno, "stat(%s) 
failed: %m", i->path);
@@ -1360,30 +1376,35 @@
         }
 
         case CREATE_SYMLINK: {
-                r = specifier_printf(i->argument, specifier_table, NULL, 
&resolved);
-                if (r < 0)
-                        return log_error_errno(r, "Failed to substitute 
specifiers in symlink target %s: %m", i->argument);
-
                 mac_selinux_create_file_prepare(i->path, S_IFLNK);
-                r = symlink(resolved, i->path);
+                r = symlink(i->argument, i->path);
                 mac_selinux_create_file_clear();
 
                 if (r < 0) {
                         _cleanup_free_ char *x = NULL;
 
                         if (errno != EEXIST)
-                                return log_error_errno(errno, "symlink(%s, %s) 
failed: %m", resolved, i->path);
+                                return log_error_errno(errno, "symlink(%s, %s) 
failed: %m", i->argument, i->path);
 
                         r = readlink_malloc(i->path, &x);
-                        if (r < 0 || !streq(resolved, x)) {
+                        if (r < 0 || !streq(i->argument, x)) {
 
                                 if (i->force) {
                                         
mac_selinux_create_file_prepare(i->path, S_IFLNK);
-                                        r = symlink_atomic(resolved, i->path);
+                                        r = symlink_atomic(i->argument, 
i->path);
                                         mac_selinux_create_file_clear();
 
+                                        if (IN_SET(r, -EEXIST, -ENOTEMPTY)) {
+                                                r = rm_rf(i->path, 
REMOVE_ROOT|REMOVE_PHYSICAL);
+                                                if (r < 0)
+                                                        return 
log_error_errno(r, "rm -fr %s failed: %m", i->path);
+
+                                                
mac_selinux_create_file_prepare(i->path, S_IFLNK);
+                                                r = symlink(i->argument, 
i->path) < 0 ? -errno : 0;
+                                                
mac_selinux_create_file_clear();
+                                        }
                                         if (r < 0)
-                                                return log_error_errno(r, 
"symlink(%s, %s) failed: %m", resolved, i->path);
+                                                return log_error_errno(r, 
"symlink(%s, %s) failed: %m", i->argument, i->path);
 
                                         creation = CREATION_FORCE;
                                 } else {
@@ -1793,6 +1814,52 @@
         return false;
 }
 
+static int specifier_expansion_from_arg(Item *i) {
+        _cleanup_free_ char *unescaped = NULL, *resolved = NULL;
+        char **xattr;
+        int r;
+
+        assert(i);
+
+        if (i->argument == NULL)
+                return 0;
+
+        switch (i->type) {
+        case COPY_FILES:
+        case CREATE_SYMLINK:
+        case CREATE_FILE:
+        case TRUNCATE_FILE:
+        case WRITE_FILE:
+                r = cunescape(i->argument, 0, &unescaped);
+                if (r < 0)
+                        return log_error_errno(r, "Failed to unescape 
parameter to write: %s", i->argument);
+
+                r = specifier_printf(unescaped, specifier_table, NULL, 
&resolved);
+                if (r < 0)
+                        return r;
+
+                free_and_replace(i->argument, resolved);
+                break;
+
+        case SET_XATTR:
+        case RECURSIVE_SET_XATTR:
+                assert(i->xattrs);
+
+                STRV_FOREACH (xattr, i->xattrs) {
+                        r = specifier_printf(*xattr, specifier_table, NULL, 
&resolved);
+                        if (r < 0)
+                                return r;
+
+                        free_and_replace(*xattr, resolved);
+                }
+                break;
+
+        default:
+                break;
+        }
+        return 0;
+}
+
 static int parse_line(const char *fname, unsigned line, const char *buffer) {
 
         _cleanup_free_ char *action = NULL, *mode = NULL, *user = NULL, *group 
= NULL, *age = NULL, *path = NULL;
@@ -1857,10 +1924,10 @@
         i.force = force;
 
         r = specifier_printf(path, specifier_table, NULL, &i.path);
-        if (r < 0) {
-                log_error("[%s:%u] Failed to replace specifiers: %s", fname, 
line, path);
-                return r;
-        }
+        if (r == -ENOKEY)
+                return log_unresolvable_specifier(fname, line);
+        if (r < 0)
+                return log_error_errno(r, "[%s:%u] Failed to replace 
specifiers: %s", fname, line, path);
 
         switch (i.type) {
 
@@ -1981,6 +2048,13 @@
         if (!should_include_path(i.path))
                 return 0;
 
+        r = specifier_expansion_from_arg(&i);
+        if (r == -ENOKEY)
+                return log_unresolvable_specifier(fname, line);
+        if (r < 0)
+                return log_error_errno(r, "[%s:%u] Failed to substitute 
specifiers in argument: %m",
+                                       fname, line);
+
         if (arg_root) {
                 char *p;
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/systemd-234/src/udev/udev-builtin-net_setup_link.c 
new/systemd-234/src/udev/udev-builtin-net_setup_link.c
--- old/systemd-234/src/udev/udev-builtin-net_setup_link.c      2017-10-26 
14:29:18.000000000 +0200
+++ new/systemd-234/src/udev/udev-builtin-net_setup_link.c      2017-11-29 
11:11:42.000000000 +0100
@@ -51,10 +51,8 @@
         }
 
         r = link_config_apply(ctx, link, dev, &name);
-        if (r < 0) {
-                log_error_errno(r, "Could not apply link config to %s: %m", 
udev_device_get_sysname(dev));
-                return EXIT_FAILURE;
-        }
+        if (r < 0)
+                log_warning_errno(r, "Could not apply link config to %s, 
ignoring: %m", udev_device_get_sysname(dev));
 
         udev_builtin_add_property(dev, test, "ID_NET_LINK_FILE", 
link->filename);
 


Reply via email to