Hello community, here is the log from the commit of package systemd for openSUSE:Factory checked in at 2017-09-17 22:36:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/systemd (Old) and /work/SRC/openSUSE:Factory/.systemd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "systemd" Sun Sep 17 22:36:37 2017 rev:261 rq:526196 version:234 Changes: -------- --- /work/SRC/openSUSE:Factory/systemd/systemd-mini.changes 2017-09-04 12:20:46.186712146 +0200 +++ /work/SRC/openSUSE:Factory/.systemd.new/systemd-mini.changes 2017-09-17 22:36:38.786846400 +0200 @@ -1,0 +2,59 @@ +Thu Sep 14 16:34:16 UTC 2017 - [email protected] + +- Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d + + 334945091 shutdown: fix incorrect fscanf() result check (#6806) + 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) + bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) + d9d293847 util: make get_block_device() available + 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) + ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) + +------------------------------------------------------------------- +Thu Sep 14 16:12:30 UTC 2017 - [email protected] + +- Make use of "%tmpfiles_create" in %post of the logger subpackage + +------------------------------------------------------------------- +Thu Sep 14 15:51:54 UTC 2017 - [email protected] + +- Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) + + This script takes care of converting /lib/udev into a symlink + pointing to /usr/lib/udev when upgrading a distro using an old + version of udev. + +------------------------------------------------------------------- +Thu Sep 14 12:23:26 UTC 2017 - [email protected] + +- Make use of "%make_build" rpm macro + +------------------------------------------------------------------- +Thu Sep 14 12:18:21 UTC 2017 - [email protected] + +- Renumber scripts to start at index 100 + +------------------------------------------------------------------- +Thu Sep 14 11:32:28 UTC 2017 - [email protected] + +- Introduce scripts-systemd-upgrade-from-pre-210.sh + + It collects all existing hacks done in %post to fix old/deprecated + settings in systemd older than 210. This includes hacks needed to + fix system that are migrating from SysV. + + There shouldn't be any functional changes. + +------------------------------------------------------------------- +Thu Sep 14 11:06:35 UTC 2017 - [email protected] + +- Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts + + It also renames fix-machines-subvol-for-rollbacks.sh into + scripts-systemd-fix-machines-btrfs-subvol.sh + + Note that the "scripts-systemd-" prefix is used for those scripts so + we can gather them. Why not using a directory instead ? because osc + doesn't allow that. + +------------------------------------------------------------------- systemd.changes: same change Old: ---- fix-machines-subvol-for-rollbacks.sh New: ---- scripts-systemd-fix-machines-btrfs-subvol.sh scripts-systemd-upgrade-from-pre-210.sh scripts-udev-convert-lib-udev-path.sh ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ systemd-mini.spec ++++++ --- /var/tmp/diff_new_pack.YuT3es/_old 2017-09-17 22:36:39.682720443 +0200 +++ /var/tmp/diff_new_pack.YuT3es/_new 2017-09-17 22:36:39.690719319 +0200 @@ -150,9 +150,12 @@ Source10: macros.systemd.upstream Source11: after-local.service Source12: systemd-sysv-install -Source13: fix-machines-subvol-for-rollbacks.sh Source14: kbd-model-map.legacy +Source100: scripts-systemd-fix-machines-btrfs-subvol.sh +Source101: scripts-systemd-upgrade-from-pre-210.sh +Source200: scripts-udev-convert-lib-udev-path.sh + Source1065: udev-remount-tmpfs # Patches listed in here are really special cases. Normally all @@ -460,7 +463,7 @@ %endif --disable-kdbus -make %{?_smp_mflags} V=e +%make_build V=e %install %make_install @@ -488,7 +491,16 @@ install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install -install -m0755 %{S:13} %{buildroot}/%{_prefix}/lib/systemd/ + +# Package the scripts used to fix all packaging issues. Also drop the +# "scripts-{systemd/udev}" prefix which is used because osc doesn't +# allow directory structure... +for s in %{S:100} %{S:101}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/systemd/scripts/${s#*/scripts-systemd-} +done +for s in %{S:200}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/udev/scripts/${s#*/scripts-udev-} +done ln -s ../usr/lib/systemd/systemd %{buildroot}/bin/systemd ln -s ../usr/lib/systemd/systemd %{buildroot}/sbin/init @@ -669,14 +681,6 @@ %journal_catalog_update %tmpfiles_create 2>/dev/null -# Try to read default runlevel from the old inittab if it exists -if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then - runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - if [ -n "$runlevel" ] ; then - ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target || : - fi -fi - # Create default config in /etc at first install. # Later package updates should not overwrite these settings. if [ $1 -eq 1 ]; then @@ -695,18 +699,6 @@ %endif fi >/dev/null -# since v207 /etc/sysctl.conf is no longer parsed, however -# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf -if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then - ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf || : -fi - -# migrate any symlink which may refer to the old path -for f in $(find /etc/systemd/system -type l -xtype l); do - new_target="/usr$(readlink $f)" - [ -f "$new_target" ] && ln -s -f $new_target $f || : -done - # Keep tmp.mount if it's been enabled explicitly by the user otherwise # make sure it wont be activated since it's the default for Suse # distros. This unit can be pulled (implicitely) in various ways @@ -729,6 +721,9 @@ chmod 0644 $username done +# This includes all hacks needed when upgrading from SysV. +%{_prefix}/lib/systemd/scripts/upgrade-from-pre-210.sh || : + # Convert /var/lib/machines subvolume to make it suitable for # rollbacks, if needed. See bsc#992573. The installer has been fixed # to create it at installation time. @@ -745,7 +740,7 @@ # tmpfiles_create macro previously however it's empty so there # shouldn't be any issues. if [ $1 -gt 1 ]; then - %{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh || : + %{_prefix}/lib/systemd/scripts/fix-machines-btrfs-subvol.sh || : fi %postun @@ -760,20 +755,7 @@ %systemd_postun_with_restart systemd-resolved.service %endif -%pretrans -n udev%{?mini} -p <lua> -if posix.stat("/lib/udev") and not posix.stat("/usr/lib/udev") then - posix.symlink("/lib/udev", "/usr/lib/udev") -end - %pre -n udev%{?mini} -if test -L /usr/lib/udev -a /lib/udev -ef /usr/lib/udev ; then - rm /usr/lib/udev - mv /lib/udev /usr/lib - ln -s /usr/lib/udev /lib/udev -elif [ ! -e /lib/udev ]; then - ln -s /usr/lib/udev /lib/udev -fi - # New installations uses the last compat symlink generation number # (currently at 2), which basically disables all compat symlinks. On # old systems, the file doesn't exist. This is equivalent to @@ -807,6 +789,7 @@ %posttrans -n udev%{?mini} %regenerate_initrd_posttrans +%{_prefix}/lib/udev/scripts/convert-lib-udev-path.sh || : %post -n libudev%{?mini}1 -p /sbin/ldconfig %post -n libsystemd0%{?mini} -p /sbin/ldconfig @@ -816,7 +799,7 @@ %if ! 0%{?bootstrap} %post logger -systemd-tmpfiles --create --prefix=%{_localstatedir}/log/journal/ || : +%tmpfiles_create -- --prefix=%{_localstatedir}/log/journal/ if [ "$1" -eq 1 ]; then # tell journal to start logging on disk if directory didn't exist before systemctl --no-block restart systemd-journal-flush.service >/dev/null || : @@ -947,7 +930,7 @@ %if %{with resolved} %{_prefix}/lib/systemd/resolv.conf %endif -%{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh +%{_prefix}/lib/systemd/scripts %dir %{_prefix}/lib/systemd/catalog %{_prefix}/lib/systemd/catalog/systemd.catalog %{_prefix}/lib/systemd/catalog/systemd.*.catalog @@ -1198,6 +1181,7 @@ %exclude %{_prefix}/lib/udev/rules.d/99-systemd.rules %{_prefix}/lib/udev/rules.d/*.rules %{_prefix}/lib/udev/hwdb.d/ +%{_prefix}/lib/udev/scripts/ %dir %{_sysconfdir}/udev/ %dir %{_sysconfdir}/udev/rules.d/ %ghost %{_sysconfdir}/udev/hwdb.bin ++++++ systemd.spec ++++++ --- /var/tmp/diff_new_pack.YuT3es/_old 2017-09-17 22:36:39.734713133 +0200 +++ /var/tmp/diff_new_pack.YuT3es/_new 2017-09-17 22:36:39.738712571 +0200 @@ -148,9 +148,12 @@ Source10: macros.systemd.upstream Source11: after-local.service Source12: systemd-sysv-install -Source13: fix-machines-subvol-for-rollbacks.sh Source14: kbd-model-map.legacy +Source100: scripts-systemd-fix-machines-btrfs-subvol.sh +Source101: scripts-systemd-upgrade-from-pre-210.sh +Source200: scripts-udev-convert-lib-udev-path.sh + Source1065: udev-remount-tmpfs # Patches listed in here are really special cases. Normally all @@ -458,7 +461,7 @@ %endif --disable-kdbus -make %{?_smp_mflags} V=e +%make_build V=e %install %make_install @@ -486,7 +489,16 @@ install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install -install -m0755 %{S:13} %{buildroot}/%{_prefix}/lib/systemd/ + +# Package the scripts used to fix all packaging issues. Also drop the +# "scripts-{systemd/udev}" prefix which is used because osc doesn't +# allow directory structure... +for s in %{S:100} %{S:101}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/systemd/scripts/${s#*/scripts-systemd-} +done +for s in %{S:200}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/udev/scripts/${s#*/scripts-udev-} +done ln -s ../usr/lib/systemd/systemd %{buildroot}/bin/systemd ln -s ../usr/lib/systemd/systemd %{buildroot}/sbin/init @@ -667,14 +679,6 @@ %journal_catalog_update %tmpfiles_create 2>/dev/null -# Try to read default runlevel from the old inittab if it exists -if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then - runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - if [ -n "$runlevel" ] ; then - ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target || : - fi -fi - # Create default config in /etc at first install. # Later package updates should not overwrite these settings. if [ $1 -eq 1 ]; then @@ -693,18 +697,6 @@ %endif fi >/dev/null -# since v207 /etc/sysctl.conf is no longer parsed, however -# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf -if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then - ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf || : -fi - -# migrate any symlink which may refer to the old path -for f in $(find /etc/systemd/system -type l -xtype l); do - new_target="/usr$(readlink $f)" - [ -f "$new_target" ] && ln -s -f $new_target $f || : -done - # Keep tmp.mount if it's been enabled explicitly by the user otherwise # make sure it wont be activated since it's the default for Suse # distros. This unit can be pulled (implicitely) in various ways @@ -727,6 +719,9 @@ chmod 0644 $username done +# This includes all hacks needed when upgrading from SysV. +%{_prefix}/lib/systemd/scripts/upgrade-from-pre-210.sh || : + # Convert /var/lib/machines subvolume to make it suitable for # rollbacks, if needed. See bsc#992573. The installer has been fixed # to create it at installation time. @@ -743,7 +738,7 @@ # tmpfiles_create macro previously however it's empty so there # shouldn't be any issues. if [ $1 -gt 1 ]; then - %{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh || : + %{_prefix}/lib/systemd/scripts/fix-machines-btrfs-subvol.sh || : fi %postun @@ -758,20 +753,7 @@ %systemd_postun_with_restart systemd-resolved.service %endif -%pretrans -n udev%{?mini} -p <lua> -if posix.stat("/lib/udev") and not posix.stat("/usr/lib/udev") then - posix.symlink("/lib/udev", "/usr/lib/udev") -end - %pre -n udev%{?mini} -if test -L /usr/lib/udev -a /lib/udev -ef /usr/lib/udev ; then - rm /usr/lib/udev - mv /lib/udev /usr/lib - ln -s /usr/lib/udev /lib/udev -elif [ ! -e /lib/udev ]; then - ln -s /usr/lib/udev /lib/udev -fi - # New installations uses the last compat symlink generation number # (currently at 2), which basically disables all compat symlinks. On # old systems, the file doesn't exist. This is equivalent to @@ -805,6 +787,7 @@ %posttrans -n udev%{?mini} %regenerate_initrd_posttrans +%{_prefix}/lib/udev/scripts/convert-lib-udev-path.sh || : %post -n libudev%{?mini}1 -p /sbin/ldconfig %post -n libsystemd0%{?mini} -p /sbin/ldconfig @@ -814,7 +797,7 @@ %if ! 0%{?bootstrap} %post logger -systemd-tmpfiles --create --prefix=%{_localstatedir}/log/journal/ || : +%tmpfiles_create -- --prefix=%{_localstatedir}/log/journal/ if [ "$1" -eq 1 ]; then # tell journal to start logging on disk if directory didn't exist before systemctl --no-block restart systemd-journal-flush.service >/dev/null || : @@ -945,7 +928,7 @@ %if %{with resolved} %{_prefix}/lib/systemd/resolv.conf %endif -%{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh +%{_prefix}/lib/systemd/scripts %dir %{_prefix}/lib/systemd/catalog %{_prefix}/lib/systemd/catalog/systemd.catalog %{_prefix}/lib/systemd/catalog/systemd.*.catalog @@ -1196,6 +1179,7 @@ %exclude %{_prefix}/lib/udev/rules.d/99-systemd.rules %{_prefix}/lib/udev/rules.d/*.rules %{_prefix}/lib/udev/hwdb.d/ +%{_prefix}/lib/udev/scripts/ %dir %{_sysconfdir}/udev/ %dir %{_sysconfdir}/udev/rules.d/ %ghost %{_sysconfdir}/udev/hwdb.bin ++++++ scripts-systemd-fix-machines-btrfs-subvol.sh ++++++ #! /bin/bash # # This is used to initially create /var/lib/machines subvolume in case # the system we're running on is using BTRFS with the specific layout # used by snapper to perform snapshots, rollbacks, etc... # # Unfortunately some distros (TW) already shipped versions with # systemd creating a plain subvolume which breaks snapper. # # If /var/lib/machines is already populated then it's going to be # pretty ugly to convert the old subvolume into a new one specially # since it can be in use. # # Hopefully not a lot of users are using machinectl to import # container/VM images. So in most of the cases this directory should # be empty and we can then simple delete the subvolume and create a # new one respecting the snapper layout. # # In the rare case where /var/lib/machines is populated, we will warn # the user and let him fix it manually. # # In order to avoid ugly dependencies added in systemd package, this # script should only be called during package updates when # mksubvolume(8) is available. During installation, /var/lib/machines # is supposed to be created by the installer now. # # See bsc#992573 # warn() { echo >&2 "warning: $@" } is_btrfs_subvolume() { # On btrfs subvolumes always have the inode 256 test $(stat --format=%i "$1") -eq 256 } # This assumes the directory/subvol is emptied by the caller. rm_subvolume_or_directory() { is_btrfs_subvolume "$1" && { btrfs subvolume delete "$1" return } rmdir "$1" } on_exit() { # Simply print a common error message in case something went # wrong. if test $? -ne 0; then warn "Please fix /var/lib/machines manually." # FIXME: point to a documentation explaining how to do # that. exit 1 fi } # # If there's already an entry in fstab for /var/lib/machines, it # means that: # # - the installer initialized /var/lib/machines correctly (default) # - we already fixed it # - the sysadmin added it manually # # In any cases we should exit. # # Note: we can't simply check if /var/lib/machines has been mounted # because an update through a chroot might be in progress (see # bsc#1030290). # if mount --fake /var/lib/machines 2>/dev/null; then exit fi # # If something is already mounted don't try to fix anything, it's been # done manually by the sysadmin. # if mountpoint -q /var/lib/machines; then exit fi # # Let's try to figure out if the current filesystem uses a Snapper # BTRFS specific layout. Note that TW uses a different layout than # SLE... # # FIXME: not sure if it's correct, reliable or optimal. # case $(findmnt -nr -t btrfs -o FSROOT / 2>/dev/null) in *.snapshots/*/snapshot*) ;; *) exit 0 esac trap on_exit EXIT if test -d /var/lib/machines; then # # Ok, we're on a system supporting rollbacks and # /var/lib/machines is not a subvolume remotely mounted so it # cannot be suitable for systems supporting rollback. Fix it. # echo "Making /var/lib/machines suitable for rollbacks..." type mksubvolume >/dev/null 2>&1 || { warn "mksubvolume(8) is not installed, aborting." exit 1 } test "$(ls -A /var/lib/machines/)" && { warn "/var/lib/machines is not empty, aborting." exit 1 } echo "Deleting empty /var/lib/machines directory/subvolume" rm_subvolume_or_directory /var/lib/machines || { warn "fail to delete /var/lib/machines" exit 1 } fi # At this point /var/lib/machines shouldn't exist. echo "Creating /var/lib/machines subvolume suitable for rollbacks." mksubvolume /var/lib/machines ++++++ scripts-systemd-upgrade-from-pre-210.sh ++++++ #! /bin/bash # # This script is supposed to be executed from the %post section. It # contains all hacks needed to update a system which was running # systemd < v210. This also includes systems migrating from SysV. # # All hacks can potentially break the admin settings since they work # in /etc... # Try to read default runlevel from the old inittab if it exists if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) if [ -n "$runlevel" ] ; then ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target fi fi # since v207 /etc/sysctl.conf is no longer parsed, however # backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf fi # migrate any symlink which may refer to the old path for f in $(find /etc/systemd/system -type l -xtype l); do new_target="/usr$(readlink $f)" [ -f "$new_target" ] && ln -s -f $new_target $f done ++++++ scripts-udev-convert-lib-udev-path.sh ++++++ #! /bin/bash # # When upgrading from systems predating systemd (SLE11, openSUSE # 12.x), udev libexec directory was changed from /lib/udev to # /usr/lib/udev. Some customer scripts might still rely on the old # path, therefore try to create a symlink that preserves the old path # (see bsc#1050152). # # This script is supposed to be called from the %posttrans scection of # the udev package. # convert_lib_udev_path () { local failed=/bin/false # Sanity check: /usr/lib/udev must exist at that point since # the new udev package should have been installed. if ! test -d /usr/lib/udev; then echo >&2 "/usr/lib/udev does not exist, refusing to create" echo >&2 "/lib/udev compat symlink." return 1 fi # If the symlink is missing it probably means that we're # upgrading and the old /lib/udev path was removed as it was # empty at the time the old version of udev was uninstalled. if ! test -e /lib/udev; then echo "Creating /lib/udev -> /usr/lib/udev symlink." ln -s /usr/lib/udev /lib/udev return fi # If a symlink already exists, simply assume that we already # did the job. IOW we're just doing a simple update of # systemd/udev (not upgrading). if test -L /lib/udev; then return fi # Sanity check: refuse to deal with anything but a directory. if ! test -d /lib/udev; then echo >&2 "/lib/udev is not either a directory nor a symlink !" echo >&2 "It won't be converted into a symlink to /usr/lib/udev." echo >&2 "Please create it manually." return 1 fi # /lib/udev exists and is still a directory (probably not # empty otherwise it would have been removed when the old # version of udev was uninstalled), we try to merge its # content with the new location and if it fails we warn the # user and let him sort this out. shopt -s globstar for f in /lib/udev/**; do if test -d "$f"; then continue fi if test -e /usr/"$f"; then echo >&2 "Failed to migrate '$f' to /usr/lib/udev because it already exists." failed=/bin/true continue fi echo "Migrating '$f' in /usr/lib/udev" if ! cp -a --parents "$f" /usr; then echo >&2 "Failed to move '$f' in /usr/lib/udev." failed=/bin/true continue fi rm "$f" done shopt -u globstar if ! $failed; then rm -fr /lib/udev && ln -s ../usr/lib/udev /lib/udev && echo "The content of /lib/udev has been moved in /usr/lib/udev successfully" && echo "and /lib/udev is now a symlink pointing to /usr/lib/udev." && echo "Please note /lib/udev is deprecated and shouldn't be used by" && echo "new scripts/applications anymore." || failed=/bin/true fi if $failed; then echo >&2 "Converting /lib/udev into a symlink pointing to /usr/lib/udev was not" echo >&2 "possible due to previous error(s)." echo >&2 "Please fix them and then create the symlink with:" echo >&2 " 'ln -s ../usr/lib/udev /lib/udev'." return 1 fi } convert_lib_udev_path ++++++ systemd-234.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/basic/fs-util.c new/systemd-234/src/basic/fs-util.c --- old/systemd-234/src/basic/fs-util.c 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/basic/fs-util.c 2017-09-14 18:32:58.000000000 +0200 @@ -23,6 +23,7 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> +#include <linux/magic.h> #include <time.h> #include <unistd.h> @@ -721,6 +722,9 @@ if (fstat(child, &st) < 0) return -errno; + if ((flags & CHASE_NO_AUTOFS) && + fd_check_fstype(child, AUTOFS_SUPER_MAGIC) > 0) + return -EREMOTE; if (S_ISLNK(st.st_mode)) { char *joined; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/basic/fs-util.h new/systemd-234/src/basic/fs-util.h --- old/systemd-234/src/basic/fs-util.h 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/basic/fs-util.h 2017-09-14 18:32:58.000000000 +0200 @@ -81,6 +81,7 @@ enum { CHASE_PREFIX_ROOT = 1, /* If set, the specified path will be prefixed by the specified root before beginning the iteration */ CHASE_NONEXISTENT = 2, /* If set, it's OK if the path doesn't actually exist. */ + CHASE_NO_AUTOFS = 4, /* If set, return -EREMOTE if autofs mount point found */ }; int chase_symlinks(const char *path_with_prefix, const char *root, unsigned flags, char **ret); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/basic/util.c new/systemd-234/src/basic/util.c --- old/systemd-234/src/basic/util.c 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/basic/util.c 2017-09-14 18:32:58.000000000 +0200 @@ -34,6 +34,7 @@ #include <unistd.h> #include "alloc-util.h" +#include "btrfs-util.h" #include "build.h" #include "cgroup-util.h" #include "def.h" @@ -719,3 +720,133 @@ SYSTEMD_FEATURES); return 0; } + +int get_block_device(const char *path, dev_t *dev) { + struct stat st; + struct statfs sfs; + + assert(path); + assert(dev); + + /* Get's the block device directly backing a file system. If + * the block device is encrypted, returns the device mapper + * block device. */ + + if (lstat(path, &st)) + return -errno; + + if (major(st.st_dev) != 0) { + *dev = st.st_dev; + return 1; + } + + if (statfs(path, &sfs) < 0) + return -errno; + + if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC)) + return btrfs_get_block_device(path, dev); + + return 0; +} + +int get_block_device_harder(const char *path, dev_t *dev) { + _cleanup_closedir_ DIR *d = NULL; + _cleanup_free_ char *p = NULL, *t = NULL; + struct dirent *de, *found = NULL; + const char *q; + unsigned maj, min; + dev_t dt; + int r; + + assert(path); + assert(dev); + + /* Gets the backing block device for a file system, and + * handles LUKS encrypted file systems, looking for its + * immediate parent, if there is one. */ + + r = get_block_device(path, &dt); + if (r <= 0) + return r; + + if (asprintf(&p, "/sys/dev/block/%u:%u/slaves", major(dt), minor(dt)) < 0) + return -ENOMEM; + + d = opendir(p); + if (!d) { + if (errno == ENOENT) + goto fallback; + + return -errno; + } + + FOREACH_DIRENT_ALL(de, d, return -errno) { + + if (dot_or_dot_dot(de->d_name)) + continue; + + if (!IN_SET(de->d_type, DT_LNK, DT_UNKNOWN)) + continue; + + if (found) { + _cleanup_free_ char *u = NULL, *v = NULL, *a = NULL, *b = NULL; + + /* We found a device backed by multiple other devices. We don't really support automatic + * discovery on such setups, with the exception of dm-verity partitions. In this case there are + * two backing devices: the data partition and the hash partition. We are fine with such + * setups, however, only if both partitions are on the same physical device. Hence, let's + * verify this. */ + + u = strjoin(p, "/", de->d_name, "/../dev"); + if (!u) + return -ENOMEM; + + v = strjoin(p, "/", found->d_name, "/../dev"); + if (!v) + return -ENOMEM; + + r = read_one_line_file(u, &a); + if (r < 0) { + log_debug_errno(r, "Failed to read %s: %m", u); + goto fallback; + } + + r = read_one_line_file(v, &b); + if (r < 0) { + log_debug_errno(r, "Failed to read %s: %m", v); + goto fallback; + } + + /* Check if the parent device is the same. If not, then the two backing devices are on + * different physical devices, and we don't support that. */ + if (!streq(a, b)) + goto fallback; + } + + found = de; + } + + if (!found) + goto fallback; + + q = strjoina(p, "/", found->d_name, "/dev"); + + r = read_one_line_file(q, &t); + if (r == -ENOENT) + goto fallback; + if (r < 0) + return r; + + if (sscanf(t, "%u:%u", &maj, &min) != 2) + return -EINVAL; + + if (maj == 0) + goto fallback; + + *dev = makedev(maj, min); + return 1; + +fallback: + *dev = dt; + return 1; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/basic/util.h new/systemd-234/src/basic/util.h --- old/systemd-234/src/basic/util.h 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/basic/util.h 2017-09-14 18:32:58.000000000 +0200 @@ -192,3 +192,6 @@ int update_reboot_parameter_and_warn(const char *param); int version(void); + +int get_block_device(const char *path, dev_t *dev); +int get_block_device_harder(const char *path, dev_t *dev); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/core/device.c new/systemd-234/src/core/device.c --- old/systemd-234/src/core/device.c 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/core/device.c 2017-09-14 18:32:58.000000000 +0200 @@ -514,7 +514,7 @@ } static int device_update_found_by_sysfs(Manager *m, const char *sysfs, bool add, DeviceFound found, bool now) { - Device *d, *l; + Device *d, *l, *n; assert(m); assert(sysfs); @@ -523,7 +523,7 @@ return 0; l = hashmap_get(m->devices_by_sysfs, sysfs); - LIST_FOREACH(same_sysfs, d, l) + LIST_FOREACH_SAFE(same_sysfs, d, n, l) device_update_found_one(d, add, found, now); return 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/core/umount.c new/systemd-234/src/core/umount.c --- old/systemd-234/src/core/umount.c 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/core/umount.c 2017-09-14 18:32:58.000000000 +0200 @@ -37,12 +37,14 @@ #include "string-util.h" #include "udev-util.h" #include "umount.h" +#include "mount-util.h" #include "util.h" #include "virt.h" typedef struct MountPoint { char *path; char *options; + char *type; dev_t devnum; LIST_FIELDS(struct MountPoint, mount_point); } MountPoint; @@ -76,7 +78,7 @@ return -errno; for (i = 1;; i++) { - _cleanup_free_ char *path = NULL, *options = NULL; + _cleanup_free_ char *path = NULL, *options = NULL, *type = NULL; char *p = NULL; MountPoint *m; int k; @@ -90,12 +92,12 @@ "%*s" /* (6) mount flags */ "%*[^-]" /* (7) optional fields */ "- " /* (8) separator */ - "%*s " /* (9) file system type */ + "%ms " /* (9) file system type */ "%*s" /* (10) mount source */ "%ms" /* (11) mount options */ "%*[^\n]", /* some rubbish at the end */ - &path, &options); - if (k != 2) { + &path, &type, &options); + if (k != 3) { if (k == EOF) break; @@ -132,6 +134,8 @@ m->path = p; m->options = options; options = NULL; + m->type = type; + type = NULL; LIST_PREPEND(mount_point, *head, m); } @@ -388,8 +392,12 @@ /* If we are in a container, don't attempt to read-only mount anything as that brings no real benefits, but might confuse the host, as we remount - the superblock here, not the bind mount. */ - if (detect_container() <= 0) { + the superblock here, not the bind mount. + If the filesystem is a network fs, also skip the + remount. It brings no value (we cannot leave + a "dirty fs") and could hang if the network is down. */ + if (detect_container() <= 0 && + !fstype_is_network(m->type)) { _cleanup_free_ char *options = NULL; /* MS_REMOUNT requires that the data parameter * should be the same from the original mount @@ -509,22 +517,22 @@ static int dm_points_list_detach(MountPoint **head, bool *changed) { MountPoint *m, *n; - int n_failed = 0, k; - struct stat root_st; + int n_failed = 0, r; + dev_t rootdev; assert(head); - k = lstat("/", &root_st); + r = get_block_device("/", &rootdev); + if (r <= 0) + rootdev = 0; LIST_FOREACH_SAFE(mount_point, m, n, *head) { - int r; - if (k >= 0 && - major(root_st.st_dev) != 0 && - root_st.st_dev == m->devnum) { - n_failed++; - continue; - } + if (major(rootdev) != 0) + if (rootdev == m->devnum) { + n_failed ++; + continue; + } log_info("Detaching DM %u:%u.", major(m->devnum), minor(m->devnum)); r = delete_dm(m->devnum); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/systemd-234/src/gpt-auto-generator/gpt-auto-generator.c new/systemd-234/src/gpt-auto-generator/gpt-auto-generator.c --- old/systemd-234/src/gpt-auto-generator/gpt-auto-generator.c 2017-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/gpt-auto-generator/gpt-auto-generator.c 2017-09-14 18:32:58.000000000 +0200 @@ -609,136 +609,6 @@ return r; } -static int get_block_device(const char *path, dev_t *dev) { - struct stat st; - struct statfs sfs; - - assert(path); - assert(dev); - - /* Get's the block device directly backing a file system. If - * the block device is encrypted, returns the device mapper - * block device. */ - - if (lstat(path, &st)) - return -errno; - - if (major(st.st_dev) != 0) { - *dev = st.st_dev; - return 1; - } - - if (statfs(path, &sfs) < 0) - return -errno; - - if (F_TYPE_EQUAL(sfs.f_type, BTRFS_SUPER_MAGIC)) - return btrfs_get_block_device(path, dev); - - return 0; -} - -static int get_block_device_harder(const char *path, dev_t *dev) { - _cleanup_closedir_ DIR *d = NULL; - _cleanup_free_ char *p = NULL, *t = NULL; - struct dirent *de, *found = NULL; - const char *q; - unsigned maj, min; - dev_t dt; - int r; - - assert(path); - assert(dev); - - /* Gets the backing block device for a file system, and - * handles LUKS encrypted file systems, looking for its - * immediate parent, if there is one. */ - - r = get_block_device(path, &dt); - if (r <= 0) - return r; - - if (asprintf(&p, "/sys/dev/block/%u:%u/slaves", major(dt), minor(dt)) < 0) - return -ENOMEM; - - d = opendir(p); - if (!d) { - if (errno == ENOENT) - goto fallback; - - return -errno; - } - - FOREACH_DIRENT_ALL(de, d, return -errno) { - - if (dot_or_dot_dot(de->d_name)) - continue; - - if (!IN_SET(de->d_type, DT_LNK, DT_UNKNOWN)) - continue; - - if (found) { - _cleanup_free_ char *u = NULL, *v = NULL, *a = NULL, *b = NULL; - - /* We found a device backed by multiple other devices. We don't really support automatic - * discovery on such setups, with the exception of dm-verity partitions. In this case there are - * two backing devices: the data partition and the hash partition. We are fine with such - * setups, however, only if both partitions are on the same physical device. Hence, let's - * verify this. */ - - u = strjoin(p, "/", de->d_name, "/../dev"); - if (!u) - return -ENOMEM; - - v = strjoin(p, "/", found->d_name, "/../dev"); - if (!v) - return -ENOMEM; - - r = read_one_line_file(u, &a); - if (r < 0) { - log_debug_errno(r, "Failed to read %s: %m", u); - goto fallback; - } - - r = read_one_line_file(v, &b); - if (r < 0) { - log_debug_errno(r, "Failed to read %s: %m", v); - goto fallback; - } - - /* Check if the parent device is the same. If not, then the two backing devices are on - * different physical devices, and we don't support that. */ - if (!streq(a, b)) - goto fallback; - } - - found = de; - } - - if (!found) - goto fallback; - - q = strjoina(p, "/", found->d_name, "/dev"); - - r = read_one_line_file(q, &t); - if (r == -ENOENT) - goto fallback; - if (r < 0) - return r; - - if (sscanf(t, "%u:%u", &maj, &min) != 2) - return -EINVAL; - - if (maj == 0) - goto fallback; - - *dev = makedev(maj, min); - return 1; - -fallback: - *dev = dt; - return 1; -} - static int parse_proc_cmdline_item(const char *key, const char *value, void *data) { int r; 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-08-29 12:17:45.000000000 +0200 +++ new/systemd-234/src/tmpfiles/tmpfiles.c 2017-09-14 18:32:58.000000000 +0200 @@ -1672,6 +1672,9 @@ } } + if (chase_symlinks(i->path, NULL, CHASE_NO_AUTOFS, NULL) == -EREMOTE) + return t; + r = arg_create ? create_item(i) : 0; q = arg_remove ? remove_item(i) : 0; p = arg_clean ? clean_item(i) : 0;
