From 0d8c506be727baf86785c66f03da19d281f34dbf Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 16 Aug 2012 15:22:02 +0200 Subject: [PATCH 1/5] 2.22-0.1: upgrade to new upstream release Signed-off-by: Karel Zak --- .gitignore | 1 + sources | 2 +- util-linux.spec | 155 +++++++++++++++++++++++++++--------------------- uuidd.init | 117 ------------------------------------ 4 files changed, 89 insertions(+), 186 deletions(-) delete mode 100755 uuidd.init diff --git a/.gitignore b/.gitignore index 2402478..31636e5 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ /util-linux-2.21.tar.xz /util-linux-2.21.1.tar.xz /util-linux-2.21.2.tar.xz +/util-linux-2.22-rc2.tar.xz diff --git a/sources b/sources index dee478b..34364af 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -10d940dec87902bff7e6f9f2adcd0236 util-linux-2.21.2.tar.xz +505d71aaade14033d060373d87e4f41d util-linux-2.22-rc2.tar.xz a02aac97c74259ca1b24972c89147ca4 floppy-0.18.tar.bz2 diff --git a/util-linux.spec b/util-linux.spec index a9314cc..1f3b0f1 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,13 +1,13 @@ ### Header Summary: A collection of basic system utilities Name: util-linux -Version: 2.21.2 -Release: 3%{?dist} +Version: 2.22 +Release: 0.1%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base -URL: http://kernel.org/~kzak/util-linux/ +URL: http://en.wikipedia.org/wiki/Util-linux -%define upstream_version %{version} +%define upstream_version %{version}-rc2 ### Macros %define floppyver 0.18 @@ -25,17 +25,18 @@ BuildRequires: libutempter-devel Buildrequires: systemd-devel ### Sources -Source0: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.21/util-linux-%{upstream_version}.tar.xz +Source0: ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.22/util-linux-%{upstream_version}.tar.xz Source1: util-linux-login.pamd Source2: util-linux-remote.pamd Source3: util-linux-chsh-chfn.pamd Source4: util-linux-60-raw.rules Source8: nologin.c Source9: nologin.8 -Source10: uuidd.init Source11: http://downloads.sourceforge.net/floppyutil/floppy-%{floppyver}.tar.bz2 ### Obsoletes & Conflicts & Provides +# sulogin, utmpdump merged into util-linux v2.22 +Conflicts: sysvinit-tools < 2.88-8 # old versions of e2fsprogs contain fsck, uuidgen Conflicts: e2fsprogs < 1.41.8-5 # rename from util-linux-ng back to util-linux @@ -60,6 +61,8 @@ Requires: libuuid = %{version}-%{release} Requires: libblkid = %{version}-%{release} Requires: libmount = %{version}-%{release} Requires: systemd >= 185 +Requires(post): systemd-units +Requires(preun): systemd-units ### Floppy patches (Fedora/RHEL specific) ### @@ -200,14 +203,15 @@ export CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 export SUID_CFLAGS="-fpie" export SUID_LDFLAGS="-pie" %configure \ + --with-systemdsystemunitdir=%{_unitdir} \ + --disable-eject \ --disable-silent-rules \ --disable-wall \ - --enable-partx \ - --enable-login-utils \ - --enable-kill \ + --enable-socket-activation \ + --enable-chfn-chsh \ --enable-write \ --enable-raw \ - --enable-new-mount \ + --disable-su \ --with-udev \ --with-selinux \ --with-audit \ @@ -261,10 +265,8 @@ echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8 # sbin -> bin mv ${RPM_BUILD_ROOT}%{_sbindir}/raw ${RPM_BUILD_ROOT}%{_bindir}/raw -# Our own initscript for uuidd -install -D -m 755 %{SOURCE10} ${RPM_BUILD_ROOT}/etc/rc.d/init.d/uuidd # And a dirs uuidd needs that the makefiles don't create -install -d ${RPM_BUILD_ROOT}/var/run/uuidd +install -d ${RPM_BUILD_ROOT}/run/uuidd install -d ${RPM_BUILD_ROOT}/var/lib/libuuid # libtool junk @@ -349,8 +351,8 @@ done # rename docs mv floppy-%{floppyver}/README floppy-%{floppyver}/README.floppy -# we install getopt/getopt-*.{bash,tcsh} as doc files -chmod 644 getopt/getopt-*.{bash,tcsh} +# we install getopt-*.{bash,tcsh} as doc files +chmod 644 misc-utils/getopt-*.{bash,tcsh} rm -f ${RPM_BUILD_ROOT}%{_datadir}/getopt/* rmdir ${RPM_BUILD_ROOT}%{_datadir}/getopt @@ -424,12 +426,21 @@ useradd -r -g uuidd -d /var/lib/libuuid -s /sbin/nologin \ exit 0 %post -n uuidd -/sbin/chkconfig --add uuidd +if [ $1 -eq 1 ]; then + # Package install, + /bin/systemctl enable uuidd.service >/dev/null 2>&1 || : + /bin/systemctl start uuidd.service > /dev/null 2>&1 || : +else + # Package upgrade + if /bin/systemctl --quiet is-enabled uuidd.service ; then + /bin/systemctl reenable uuidd.service >/dev/null 2>&1 || : + fi +fi %preun -n uuidd if [ "$1" = 0 ]; then - /sbin/service uuidd stop > /dev/null 2>&1 || : - /sbin/chkconfig --del uuidd + /bin/systemctl stop uuidd.service > /dev/null 2>&1 || : + /bin/systemctl disable uuidd.service > /dev/null 2>&1 || : fi @@ -437,12 +448,13 @@ fi %defattr(-,root,root) %doc README */README.* NEWS AUTHORS %doc Documentation/deprecated.txt Documentation/licenses/* -%doc getopt/getopt-*.{bash,tcsh} +%doc misc-utils/getopt-*.{bash,tcsh} %config(noreplace) %{_sysconfdir}/pam.d/chfn %config(noreplace) %{_sysconfdir}/pam.d/chsh %config(noreplace) %{_sysconfdir}/pam.d/login %config(noreplace) %{_sysconfdir}/pam.d/remote +%config(noreplace) %{_prefix}/lib/udev/rules.d %attr(4755,root,root) %{_bindir}/mount %attr(4755,root,root) %{_bindir}/umount @@ -454,48 +466,15 @@ fi %ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog %ghost %verify(not md5 size mtime) %config(noreplace,missingok) /etc/mtab -%{_bindir}/dmesg -%{_bindir}/findmnt -%{_bindir}/lsblk -%{_bindir}/more -%{_bindir}/mountpoint -%{_bindir}/taskset - -%{_sbindir}/addpart -%{_sbindir}/agetty -%{_sbindir}/blkid -%{_sbindir}/blockdev -%{_sbindir}/chcpu -%{_sbindir}/ctrlaltdel -%{_sbindir}/delpart -%{_sbindir}/fdisk -%{_sbindir}/findfs -%{_sbindir}/fsck -%{_sbindir}/fsck.cramfs -%{_sbindir}/fsck.minix -%{_sbindir}/fsfreeze -%{_sbindir}/fstrim -%{_sbindir}/losetup -%{_sbindir}/mkfs -%{_sbindir}/mkfs.cramfs -%{_sbindir}/mkfs.minix -%{_sbindir}/mkswap -%{_sbindir}/nologin -%{_sbindir}/partx -%{_sbindir}/pivot_root -%{_sbindir}/swaplabel -%{_sbindir}/swapoff -%{_sbindir}/swapon -%{_sbindir}/switch_root -%{_sbindir}/wipefs - %{_bindir}/cal %{_bindir}/chrt %{_bindir}/col %{_bindir}/colcrt %{_bindir}/colrm %{_bindir}/column +%{_bindir}/dmesg %{_bindir}/fallocate +%{_bindir}/findmnt %{_bindir}/flock %{_bindir}/getopt %{_bindir}/hexdump @@ -507,10 +486,15 @@ fi %{_bindir}/kill %{_bindir}/logger %{_bindir}/look +%{_bindir}/lsblk %{_bindir}/lscpu +%{_bindir}/lslocks %{_bindir}/mcookie +%{_bindir}/more +%{_bindir}/mountpoint %{_bindir}/namei %{_bindir}/prlimit +%{_bindir}/raw %{_bindir}/rename %{_bindir}/renice %{_bindir}/rev @@ -520,15 +504,13 @@ fi %{_bindir}/setsid %{_bindir}/setterm %{_bindir}/tailf +%{_bindir}/taskset %{_bindir}/ul %{_bindir}/unshare +%{_bindir}/utmpdump %{_bindir}/uuidgen +%{_bindir}/wdctl %{_bindir}/whereis - -%{_sbindir}/ldattach -%{_sbindir}/readprofile -%{_sbindir}/rtcwake - %{_mandir}/man1/cal.1* %{_mandir}/man1/chfn.1* %{_mandir}/man1/chrt.1* @@ -567,12 +549,11 @@ fi %{_mandir}/man1/taskset.1* %{_mandir}/man1/ul.1* %{_mandir}/man1/unshare.1* +%{_mandir}/man1/utmpdump.1.gz %{_mandir}/man1/uuidgen.1* %{_mandir}/man1/whereis.1* %{_mandir}/man1/write.1* - %{_mandir}/man5/fstab.5* - %{_mandir}/man8/addpart.8* %{_mandir}/man8/agetty.8* %{_mandir}/man8/blkid.8* @@ -591,6 +572,7 @@ fi %{_mandir}/man8/ldattach.8* %{_mandir}/man8/losetup.8* %{_mandir}/man8/lsblk.8* +%{_mandir}/man8/lslocks.8.gz %{_mandir}/man8/mkfs.8* %{_mandir}/man8/mkfs.minix.8* %{_mandir}/man8/mkswap.8* @@ -598,20 +580,52 @@ fi %{_mandir}/man8/nologin.8* %{_mandir}/man8/partx.8* %{_mandir}/man8/pivot_root.8* +%{_mandir}/man8/raw.8* +%{_mandir}/man8/rawdevices.8* %{_mandir}/man8/readprofile.8* +%{_mandir}/man8/resizepart.8* %{_mandir}/man8/rtcwake.8* %{_mandir}/man8/setarch.8* +%{_mandir}/man8/sulogin.8.gz %{_mandir}/man8/swaplabel.8* %{_mandir}/man8/swapoff.8* %{_mandir}/man8/swapon.8* %{_mandir}/man8/switch_root.8* %{_mandir}/man8/umount.8* +%{_mandir}/man8/wdctl.8.gz %{_mandir}/man8/wipefs.8* - -%{_bindir}/raw -%config(noreplace) %{_prefix}/lib/udev/rules.d -%{_mandir}/man8/raw.8* -%{_mandir}/man8/rawdevices.8* +%{_sbindir}/addpart +%{_sbindir}/agetty +%{_sbindir}/blkid +%{_sbindir}/blockdev +%{_sbindir}/chcpu +%{_sbindir}/ctrlaltdel +%{_sbindir}/delpart +%{_sbindir}/fdisk +%{_sbindir}/findfs +%{_sbindir}/fsck +%{_sbindir}/fsck.cramfs +%{_sbindir}/fsck.minix +%{_sbindir}/fsfreeze +%{_sbindir}/fstrim +%{_sbindir}/ldattach +%{_sbindir}/losetup +%{_sbindir}/mkfs +%{_sbindir}/mkfs.cramfs +%{_sbindir}/mkfs.minix +%{_sbindir}/mkswap +%{_sbindir}/nologin +%{_sbindir}/partx +%{_sbindir}/pivot_root +%{_sbindir}/readprofile +%{_sbindir}/resizepart +%{_sbindir}/rtcwake +%{_sbindir}/sulogin +%{_sbindir}/swaplabel +%{_sbindir}/swapoff +%{_sbindir}/swapon +%{_sbindir}/switch_root +%{_sbindir}/wipefs %ifnarch s390 s390x %{_sbindir}/clock @@ -647,11 +661,11 @@ fi %files -n uuidd %defattr(-,root,root) %doc Documentation/licenses/COPYING.GPLv2 -/etc/rc.d/init.d/uuidd %{_mandir}/man8/uuidd.8* %attr(-, uuidd, uuidd) %{_sbindir}/uuidd +%{_unitdir}/* %dir %attr(2775, uuidd, uuidd) /var/lib/libuuid -%dir %attr(2775, uuidd, uuidd) /var/run/uuidd +%dir %attr(2775, uuidd, uuidd) /run/uuidd %files -n libmount @@ -707,6 +721,11 @@ fi %changelog +* Thu Aug 16 2012 Karel Zak 2.22-0.1 +- upgrade to the release 2.22-rc2 + ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.22/v2.22-ReleaseNotes +- add sulogin, utmpdump, lslocks, wdctl + * Fri Jul 27 2012 Fedora Release Engineering - 2.21.2-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild diff --git a/uuidd.init b/uuidd.init deleted file mode 100755 index 9fba666..0000000 --- a/uuidd.init +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# -# uuidd uuidd daemon for unique time-based UUID generation -# -# Author: Eric Sandeen -# -# chkconfig: - 60 99 -# -# description: uuidd is a helper daemon to guarantee uniqueness of \ -# time-based UUIDs when using libuuid. -# processname: uuidd -# pidfile: /var/lib/libuuid/uuidd.pid -# - -### BEGIN INIT INFO -# Provides: uuidd -# Required-Start: $time $local_fs -# Required-Stop: $time $local_fs -# Default-Stop: 0 1 6 -# Short-Description: UUID daemon -# Description: Daemon which guarantees uniqueness of time-based UUIDS -# when using libuuid. -### END INIT INFO - -# source function library -. /etc/rc.d/init.d/functions - -[ -e /etc/sysconfig/uuidd ] && . /etc/sysconfig/uuidd - -DAEMON=uuidd -exec=/usr/sbin/uuidd -prog=uuidd -user=uuidd -lockfile=/var/lock/subsys/$DAEMON -pidfile=/var/run/uuidd/uuidd.pid - -check() { - # Check that we're a privileged user - [ $(id -u) -eq 0 ] || exit 4 - - # Check if daemon binary is executable - [ -x $exec ] || exit 5 -} - -start () { - check - echo -n $"Starting $prog: " - daemon --user $user --pidfile $pidfile $DAEMON - retval=$? - echo - [ $retval -eq 0 ] && touch $lockfile - return $retval -} - -stop () { - check - echo -n $"Stopping $prog: " - killproc $DAEMON - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $DAEMON -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - - -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - exit 2 -esac -exit $? From 1de1774f06e15b2c6df080e1b187a9722c7b7422 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 6 Sep 2012 12:51:38 +0200 Subject: [PATCH 2/5] 2.22-1: upgrade, enable eject, fix #853164, #851230 Signed-off-by: Karel Zak --- .gitignore | 1 + sources | 2 +- util-linux.spec | 18 ++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 31636e5..1334088 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,4 @@ /util-linux-2.21.1.tar.xz /util-linux-2.21.2.tar.xz /util-linux-2.22-rc2.tar.xz +/util-linux-2.22.tar.xz diff --git a/sources b/sources index 34364af..4fe7f39 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -505d71aaade14033d060373d87e4f41d util-linux-2.22-rc2.tar.xz a02aac97c74259ca1b24972c89147ca4 floppy-0.18.tar.bz2 +ba2d8cc12a937231c80a04f7f7149303 util-linux-2.22.tar.xz diff --git a/util-linux.spec b/util-linux.spec index 1f3b0f1..dac7222 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,12 +2,12 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.22 -Release: 0.1%{?dist} +Release: 1%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux -%define upstream_version %{version}-rc2 +%define upstream_version %{version} ### Macros %define floppyver 0.18 @@ -35,6 +35,9 @@ Source9: nologin.8 Source11: http://downloads.sourceforge.net/floppyutil/floppy-%{floppyver}.tar.bz2 ### Obsoletes & Conflicts & Provides +# eject has been merged into util-linux v2.22 +Obsoletes: eject <= 2.1.5 +Provides: eject = 2.1.6 # sulogin, utmpdump merged into util-linux v2.22 Conflicts: sysvinit-tools < 2.88-8 # old versions of e2fsprogs contain fsck, uuidgen @@ -201,10 +204,9 @@ unset LINGUAS || : export CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 $RPM_OPT_FLAGS" export SUID_CFLAGS="-fpie" -export SUID_LDFLAGS="-pie" +export SUID_LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now" %configure \ --with-systemdsystemunitdir=%{_unitdir} \ - --disable-eject \ --disable-silent-rules \ --disable-wall \ --enable-socket-activation \ @@ -473,6 +475,7 @@ fi %{_bindir}/colrm %{_bindir}/column %{_bindir}/dmesg +%{_bindir}/eject %{_bindir}/fallocate %{_bindir}/findmnt %{_bindir}/flock @@ -520,6 +523,7 @@ fi %{_mandir}/man1/colrm.1* %{_mandir}/man1/column.1* %{_mandir}/man1/dmesg.1* +%{_mandir}/man1/eject.1* %{_mandir}/man1/fallocate.1* %{_mandir}/man1/flock.1* %{_mandir}/man1/getopt.1* @@ -721,6 +725,12 @@ fi %changelog +* Thu Sep 6 2012 Karel Zak 2.22-1 +- upgrade to the release 2.22 +- enable eject(1) from util-linux, obsolete original eject package +- fix #853164 - setuid program should have full RELRO +- fix #851230 - probe_ntfs: /usr/sbin/blkid was killed by SIGSEGV + * Thu Aug 16 2012 Karel Zak 2.22-0.1 - upgrade to the release 2.22-rc2 ftp://ftp.kernel.org/pub/linux/utils/util-linux/v2.22/v2.22-ReleaseNotes From 82639d6500b446d4be22ada077fe0192b114ce61 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 3 Oct 2012 09:42:04 +0200 Subject: [PATCH 3/5] 2.22-2: remove obsolete references to e2fsprogs Signed-off-by: Karel Zak --- util-linux.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/util-linux.spec b/util-linux.spec index dac7222..3b0ee15 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.22 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -144,7 +144,7 @@ License: BSD Conflicts: filesystem < 3 %description -n libuuid -This is the universally unique ID library, part of e2fsprogs. +This is the universally unique ID library, part of util-linux. The libuuid library generates and parses 128-bit universally unique id's (UUID's). A UUID is an identifier that is unique across both @@ -164,7 +164,7 @@ Requires: pkgconfig %description -n libuuid-devel This is the universally unique ID development library and headers, -part of e2fsprogs. +part of util-linux. The libuuid library generates and parses 128-bit universally unique id's (UUID's). A UUID is an identifier that is unique across both @@ -725,6 +725,9 @@ fi %changelog +* Wed Oct 3 2012 Karel Zak 2.22-2 +- remove obsolete references to e2fsprogs + * Thu Sep 6 2012 Karel Zak 2.22-1 - upgrade to the release 2.22 - enable eject(1) from util-linux, obsolete original eject package From e79ab2d9de06338324d89a3ff8c21ad81deee3fb Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 10 Oct 2012 17:12:15 +0200 Subject: [PATCH 4/5] 2.22.1-1: upgrade Signed-off-by: Karel Zak --- .gitignore | 1 + sources | 2 +- util-linux.spec | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 1334088..0d27901 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,4 @@ /util-linux-2.21.2.tar.xz /util-linux-2.22-rc2.tar.xz /util-linux-2.22.tar.xz +/util-linux-2.22.1.tar.xz diff --git a/sources b/sources index 4fe7f39..7d69556 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ +c6c15a1afc04d8a69d5b99db1c39623f util-linux-2.22.1.tar.xz a02aac97c74259ca1b24972c89147ca4 floppy-0.18.tar.bz2 -ba2d8cc12a937231c80a04f7f7149303 util-linux-2.22.tar.xz diff --git a/util-linux.spec b/util-linux.spec index 3b0ee15..2d2e868 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,8 +1,8 @@ ### Header Summary: A collection of basic system utilities Name: util-linux -Version: 2.22 -Release: 2%{?dist} +Version: 2.22.1 +Release: 1%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -725,6 +725,9 @@ fi %changelog +* Thu Oct 10 2012 Karel Zak 2.22.1-1 +- upgrade to the release 2.22.1 + * Wed Oct 3 2012 Karel Zak 2.22-2 - remove obsolete references to e2fsprogs From 4d123a0a1169ab4970476f2feed84b8ddfc97a36 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 1 Nov 2012 10:28:02 +0100 Subject: [PATCH 5/5] 2.22.1-2: apply upstream 2.22.2 patches Signed-off-by: Karel Zak --- ...t-use-umount-optimization-for-l-or-f.patch | 34 ++++++ 0002-wipefs-use-O_EXCL.patch | 27 +++++ ...-remove-loop-declaration-smatch-scan.patch | 37 ++++++ ...ix-compiler-warning-Wstrict-aliasing.patch | 35 ++++++ ...eviation-for-no-canonicalize-to-man-.patch | 31 +++++ ...long-options-for-L-and-U-to-man-page.patch | 33 ++++++ 0007-lib-loopdev-improve-debug-messages.patch | 107 ++++++++++++++++++ 0008-lib-loopdev-check-for-sys.patch | 35 ++++++ ...ile-with-DINCLUDE_FS_TESTS-for-make-.patch | 49 ++++++++ ...-fix-compiler-warning-Wunused-result.patch | 44 +++++++ ...misc-make-readlink-usage-more-robust.patch | 63 +++++++++++ util-linux.spec | 35 +++++- 12 files changed, 529 insertions(+), 1 deletion(-) create mode 100644 0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch create mode 100644 0002-wipefs-use-O_EXCL.patch create mode 100644 0003-swapon-remove-loop-declaration-smatch-scan.patch create mode 100644 0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch create mode 100644 0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch create mode 100644 0006-mount-add-long-options-for-L-and-U-to-man-page.patch create mode 100644 0007-lib-loopdev-improve-debug-messages.patch create mode 100644 0008-lib-loopdev-check-for-sys.patch create mode 100644 0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch create mode 100644 0010-login-fix-compiler-warning-Wunused-result.patch create mode 100644 0011-misc-make-readlink-usage-more-robust.patch diff --git a/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch b/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch new file mode 100644 index 0000000..952c5e1 --- /dev/null +++ b/0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch @@ -0,0 +1,34 @@ +From 6eeca6c7170295f325b814ee0cd1576da885cd30 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 15 Oct 2012 11:10:50 +0200 +Subject: [PATCH 01/11] libmount: don't use umount optimization for -l or -f + +The options -l (lazy) and -f (force) means that the mountpoint may be +unreadable (for example because NFS server is unreadable). So we +should not try to be smart in this case and we should try to minimize +number of situations when stat() or readlink() is used for the +mountpoint. + +Signed-off-by: Karel Zak +--- + libmount/src/context_umount.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c +index ce095bf..2c2e64c 100644 +--- a/libmount/src/context_umount.c ++++ b/libmount/src/context_umount.c +@@ -83,7 +83,9 @@ static int lookup_umount_fs(struct libmnt_context *cxt) + * where LABEL, UUID or symlinks are to canonicalized. It means that + * it's usable only for canonicalized stuff (e.g. kernel mountinfo). + */ +- if (!cxt->mtab_writable && *tgt == '/') { ++ if (!cxt->mtab_writable && *tgt == '/' && ++ !mnt_context_is_force(cxt) && !mnt_context_is_lazy(cxt)) { ++ + struct stat st; + + if (stat(tgt, &st) == 0 && S_ISDIR(st.st_mode)) { +-- +1.7.11.7 + diff --git a/0002-wipefs-use-O_EXCL.patch b/0002-wipefs-use-O_EXCL.patch new file mode 100644 index 0000000..66a6476 --- /dev/null +++ b/0002-wipefs-use-O_EXCL.patch @@ -0,0 +1,27 @@ +From 9faf9c8494cf37fdcf68b1dfe10fd7900e93ec00 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 15 Oct 2012 12:38:09 +0200 +Subject: [PATCH 02/11] wipefs: use O_EXCL + +Address: https://bugzilla.redhat.com/show_bug.cgi?id=865961 +Signed-off-by: Karel Zak +--- + misc-utils/wipefs.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/misc-utils/wipefs.c b/misc-utils/wipefs.c +index cddad8a..0ddc148 100644 +--- a/misc-utils/wipefs.c ++++ b/misc-utils/wipefs.c +@@ -309,7 +309,7 @@ static void do_wipe_real(blkid_probe pr, const char *devname, struct wipe_desc * + static struct wipe_desc * + do_wipe(struct wipe_desc *wp, const char *devname, int noact, int all, int quiet) + { +- blkid_probe pr = new_probe(devname, O_RDWR); ++ blkid_probe pr = new_probe(devname, O_RDWR | O_EXCL); + struct wipe_desc *w, *wp0 = clone_offset(wp); + int zap = all ? 1 : wp->zap; + +-- +1.7.11.7 + diff --git a/0003-swapon-remove-loop-declaration-smatch-scan.patch b/0003-swapon-remove-loop-declaration-smatch-scan.patch new file mode 100644 index 0000000..d5b90fe --- /dev/null +++ b/0003-swapon-remove-loop-declaration-smatch-scan.patch @@ -0,0 +1,37 @@ +From 10a9cbcf36d43c0d4a13bf5e91315b4ffd29e636 Mon Sep 17 00:00:00 2001 +From: Sami Kerola +Date: Mon, 8 Oct 2012 08:08:20 +0100 +Subject: [PATCH 03/11] swapon: remove loop declaration [smatch scan] + +sys-utils/swapon.c:677:2: error: 'for' loop initial declarations are +only allowed in C99 mode + +Signed-off-by: Sami Kerola +--- + sys-utils/swapon.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/sys-utils/swapon.c b/sys-utils/swapon.c +index c9cabc1..0e1ab66 100644 +--- a/sys-utils/swapon.c ++++ b/sys-utils/swapon.c +@@ -642,6 +642,7 @@ static int swapon_all(void) + + static void __attribute__ ((__noreturn__)) usage(FILE * out) + { ++ size_t i; + fputs(USAGE_HEADER, out); + + fprintf(out, _(" %s [options] []\n"), program_invocation_short_name); +@@ -674,7 +675,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE * out) + " name of file to be used\n"), out); + + fputs(_("\nAvailable columns (for --show):\n"), out); +- for (size_t i = 0; i < NCOLS; i++) ++ for (i = 0; i < NCOLS; i++) + fprintf(out, " %4s %s\n", infos[i].name, _(infos[i].help)); + + fprintf(out, USAGE_MAN_TAIL("swapon(8)")); +-- +1.7.11.7 + diff --git a/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch b/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch new file mode 100644 index 0000000..af08118 --- /dev/null +++ b/0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch @@ -0,0 +1,35 @@ +From 9f6c8591eeffb6591dc6a18512e618f0acf09890 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 15 Oct 2012 17:01:30 +0200 +Subject: [PATCH 04/11] libblkid: fix compiler warning [-Wstrict-aliasing] + +libblkid/src/superblocks/befs.c: In function 'get_uuid': +libblkid/src/superblocks/befs.c:353:6: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] + +Signed-off-by: Karel Zak +--- + libblkid/src/superblocks/befs.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/libblkid/src/superblocks/befs.c b/libblkid/src/superblocks/befs.c +index a7f4317..452da1e 100644 +--- a/libblkid/src/superblocks/befs.c ++++ b/libblkid/src/superblocks/befs.c +@@ -348,9 +348,11 @@ static int get_uuid(blkid_probe pr, const struct befs_super_block *bs, + && FS16_TO_CPU(sd->name_size, fs_le) == strlen(KEY_NAME) + && FS16_TO_CPU(sd->data_size, fs_le) == KEY_SIZE + && strcmp(sd->name, KEY_NAME) == 0) { +- *uuid = *(uint64_t *) ((uint8_t *) sd->name +- + FS16_TO_CPU(sd->name_size, fs_le) +- + 3); ++ ++ memcpy(uuid, ++ sd->name + FS16_TO_CPU(sd->name_size, fs_le) + 3, ++ sizeof(uint64_t)); ++ + break; + } else if (FS32_TO_CPU(sd->type, fs_le) == 0 + && FS16_TO_CPU(sd->name_size, fs_le) == 0 +-- +1.7.11.7 + diff --git a/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch b/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch new file mode 100644 index 0000000..dedadd2 --- /dev/null +++ b/0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch @@ -0,0 +1,31 @@ +From 532116d4dd16632806ed4a036c2e89b966221031 Mon Sep 17 00:00:00 2001 +From: Bill Pemberton +Date: Wed, 10 Oct 2012 16:54:01 -0400 +Subject: [PATCH 05/11] mount: add -c abbreviation for --no-canonicalize to + man page + +The --no-canonicalize option can also be set using -c. The --help for +mount shows this option but the man page did not. Add -c to the man +page. + +Signed-off-by: Bill Pemberton +--- + sys-utils/mount.8 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index dce4b8c..83a4518 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -552,7 +552,7 @@ Mount without writing in + This is necessary for example when + .I /etc + is on a read-only filesystem. +-.IP "\fB\-\-no\-canonicalize\fP" ++.IP "\fB\-c, \-\-no\-canonicalize\fP" + Don't canonicalize paths. The mount command canonicalizes all paths + (from command line or fstab) and stores canonicalized paths to the + .IR /etc/mtab +-- +1.7.11.7 + diff --git a/0006-mount-add-long-options-for-L-and-U-to-man-page.patch b/0006-mount-add-long-options-for-L-and-U-to-man-page.patch new file mode 100644 index 0000000..feb4c39 --- /dev/null +++ b/0006-mount-add-long-options-for-L-and-U-to-man-page.patch @@ -0,0 +1,33 @@ +From b426209c5ba2126a9038363a269fec884af470fb Mon Sep 17 00:00:00 2001 +From: Bill Pemberton +Date: Wed, 10 Oct 2012 16:54:02 -0400 +Subject: [PATCH 06/11] mount: add long options for -L and -U to man page + +The -L and -U flags both have long options too (--label and --uuid). +The usage() function will show them but the man page didn't list them. + +Signed-off-by: Bill Pemberton +--- + sys-utils/mount.8 | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 +index 83a4518..0b40bf7 100644 +--- a/sys-utils/mount.8 ++++ b/sys-utils/mount.8 +@@ -586,10 +586,10 @@ set the block device to read-only mode, see command + .IP "\fB\-w, \-\-rw\fP" + Mount the filesystem read/write. This is the default. A synonym is + .BR "\-o rw" . +-.IP "\fB\-L \fIlabel\fP" ++.IP "\fB\-L, \-\-label \fIlabel\fP" + Mount the partition that has the specified + .IR label . +-.IP "\fB\-U \fIuuid\fP" ++.IP "\fB\-U, \-\-uuid \fIuuid\fP" + Mount the partition that has the specified + .IR uuid . + These two options require the file +-- +1.7.11.7 + diff --git a/0007-lib-loopdev-improve-debug-messages.patch b/0007-lib-loopdev-improve-debug-messages.patch new file mode 100644 index 0000000..0db04da --- /dev/null +++ b/0007-lib-loopdev-improve-debug-messages.patch @@ -0,0 +1,107 @@ +From deb0e659451d4ade29df3dbb842607edd6080c0d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 17 Oct 2012 11:42:21 +0200 +Subject: [PATCH 07/11] lib/loopdev: improve debug messages + +Signed-off-by: Karel Zak +--- + lib/loopdev.c | 22 ++++++++++++++++++---- + sys-utils/losetup.c | 2 -- + 2 files changed, 18 insertions(+), 6 deletions(-) + +diff --git a/lib/loopdev.c b/lib/loopdev.c +index a9f6df2..0e6033a 100644 +--- a/lib/loopdev.c ++++ b/lib/loopdev.c +@@ -87,8 +87,10 @@ int loopcxt_set_device(struct loopdev_cxt *lc, const char *device) + if (!lc) + return -EINVAL; + +- if (lc->fd >= 0) ++ if (lc->fd >= 0) { + close(lc->fd); ++ DBG(lc, loopdev_debug("closing old open fd")); ++ } + lc->fd = -1; + lc->mode = 0; + lc->has_info = 0; +@@ -158,19 +160,26 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags) + memcpy(lc, &dummy, sizeof(dummy)); + lc->flags = flags; + ++ if (getenv("LOOPDEV_DEBUG")) ++ loopcxt_enable_debug(lc, TRUE); ++ + rc = loopcxt_set_device(lc, NULL); + if (rc) + return rc; + + if (!(lc->flags & LOOPDEV_FL_NOSYSFS) && +- get_linux_version() >= KERNEL_VERSION(2,6,37)) ++ get_linux_version() >= KERNEL_VERSION(2,6,37)) { + /* + * Use only sysfs for basic information about loop devices + */ + lc->flags |= LOOPDEV_FL_NOIOCTL; ++ DBG(lc, loopdev_debug("init: ignore ioctls")); ++ } + +- if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st)) ++ if (!(lc->flags & LOOPDEV_FL_CONTROL) && !stat(_PATH_DEV_LOOPCTL, &st)) { + lc->flags |= LOOPDEV_FL_CONTROL; ++ DBG(lc, loopdev_debug("init: loop-control detected ")); ++ } + + return 0; + } +@@ -272,7 +281,9 @@ int loopcxt_get_fd(struct loopdev_cxt *lc) + if (lc->fd < 0) { + lc->mode = lc->flags & LOOPDEV_FL_RDWR ? O_RDWR : O_RDONLY; + lc->fd = open(lc->device, lc->mode); +- DBG(lc, loopdev_debug("open %s", lc->fd < 0 ? "failed" : "ok")); ++ DBG(lc, loopdev_debug("open %s [%s]: %s", lc->device, ++ lc->flags & LOOPDEV_FL_RDWR ? "rw" : "ro", ++ lc->fd < 0 ? "failed" : "ok")); + } + return lc->fd; + } +@@ -576,6 +587,7 @@ int loopcxt_next(struct loopdev_cxt *lc) + * of loop devices). This is enough for 99% of all cases. + */ + if (iter->default_check) { ++ DBG(lc, loopdev_debug("iter: next: default check")); + for (++iter->ncur; iter->ncur < LOOPDEV_DEFAULT_NNODES; + iter->ncur++) { + char name[16]; +@@ -590,6 +602,7 @@ int loopcxt_next(struct loopdev_cxt *lc) + /* C) the worst possibility, scan whole /dev or /dev/loop/ + */ + if (!iter->minors) { ++ DBG(lc, loopdev_debug("iter: next: scan /dev")); + iter->nminors = (lc->flags & LOOPDEV_FL_DEVSUBDIR) ? + loop_scandir(_PATH_DEV_LOOP, &iter->minors, 0) : + loop_scandir(_PATH_DEV, &iter->minors, 1); +@@ -1150,6 +1163,7 @@ int loopcxt_setup_device(struct loopdev_cxt *lc) + DBG(lc, loopdev_debug("setup: backing file open: OK")); + + if (lc->fd != -1 && lc->mode != mode) { ++ DBG(lc, loopdev_debug("closing already open device (mode mismatch)")); + close(lc->fd); + lc->fd = -1; + lc->mode = 0; +diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c +index fdcc0be..a8381a8 100644 +--- a/sys-utils/losetup.c ++++ b/sys-utils/losetup.c +@@ -250,8 +250,6 @@ int main(int argc, char **argv) + if (loopcxt_init(&lc, 0)) + err(EXIT_FAILURE, _("failed to initialize loopcxt")); + +- loopcxt_enable_debug(&lc, getenv("LOOPDEV_DEBUG") ? TRUE : FALSE); +- + while ((c = getopt_long(argc, argv, "ac:d:De:E:fhj:o:p:PrvV", + longopts, NULL)) != -1) { + +-- +1.7.11.7 + diff --git a/0008-lib-loopdev-check-for-sys.patch b/0008-lib-loopdev-check-for-sys.patch new file mode 100644 index 0000000..ba50416 --- /dev/null +++ b/0008-lib-loopdev-check-for-sys.patch @@ -0,0 +1,35 @@ +From 939636dd664cc608232c272de77be96e6f089235 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 17 Oct 2012 11:43:39 +0200 +Subject: [PATCH 08/11] lib/loopdev: check for /sys + +The current loopdev code prefers /sys to get information about +loop devices. The old methods like scan /dev are fallback solution +only. Unfortunately, the code does not check if /sys is mounted. + +Addresses: http://blog.flameeyes.eu/2012/10/sophistication-can-be-bad +Signed-off-by: Karel Zak +--- + lib/loopdev.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/loopdev.c b/lib/loopdev.c +index 0e6033a..f62af83 100644 +--- a/lib/loopdev.c ++++ b/lib/loopdev.c +@@ -167,6 +167,12 @@ int loopcxt_init(struct loopdev_cxt *lc, int flags) + if (rc) + return rc; + ++ if (stat(_PATH_SYS_BLOCK, &st) || !S_ISDIR(st.st_mode)) { ++ lc->flags |= LOOPDEV_FL_NOSYSFS; ++ lc->flags &= ~LOOPDEV_FL_NOIOCTL; ++ DBG(lc, loopdev_debug("init: disable /sys usage")); ++ } ++ + if (!(lc->flags & LOOPDEV_FL_NOSYSFS) && + get_linux_version() >= KERNEL_VERSION(2,6,37)) { + /* +-- +1.7.11.7 + diff --git a/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch b/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch new file mode 100644 index 0000000..dc4f7b7 --- /dev/null +++ b/0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch @@ -0,0 +1,49 @@ +From 75f03f036011003c2a9e8e634ca3ce7930873318 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 22 Oct 2012 10:10:55 +0200 +Subject: [PATCH 09/11] fsck.cramfs: compile with -DINCLUDE_FS_TESTS for make + check + + make check + sudo su - + cd tests + ./run.sh cramfs + +Signed-off-by: Karel Zak +--- + disk-utils/Makemodule.am | 5 +++++ + tests/commands.sh | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/disk-utils/Makemodule.am b/disk-utils/Makemodule.am +index f2360bf..b329a99 100644 +--- a/disk-utils/Makemodule.am ++++ b/disk-utils/Makemodule.am +@@ -97,6 +97,11 @@ fsck_cramfs_LDADD = $(LDADD) -lz libcommon.la + sbin_PROGRAMS += mkfs.cramfs + mkfs_cramfs_SOURCES = disk-utils/mkfs.cramfs.c $(cramfs_common_sources) + mkfs_cramfs_LDADD = $(LDADD) -lz libcommon.la ++ ++check_PROGRAMS += test_fsck.cramfs ++test_fsck_cramfs_SOURCES = $(fsck_cramfs_SOURCES) ++test_fsck_cramfs_LDADD = $(fsck_cramfs_LDADD) ++test_fsck_cramfs_CFLAGS = $(AM_CFLAGS) -DINCLUDE_FS_TESTS + endif + + +diff --git a/tests/commands.sh b/tests/commands.sh +index 8a1577e..db1d4ac 100644 +--- a/tests/commands.sh ++++ b/tests/commands.sh +@@ -37,7 +37,7 @@ TS_CMD_LOSETUP=${TS_CMD_LOSETUP:-"$top_builddir/losetup"} + TS_CMD_MKSWAP=${TS_CMD_MKSWAP:-"$top_builddir/mkswap"} + TS_CMD_MKCRAMFS=${TS_CMD_MKCRAMFS:-"$top_builddir/mkfs.cramfs"} + TS_CMD_MKMINIX=${TS_CMD_MKMINIX:-"$top_builddir/mkfs.minix"} +-TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/fsck.cramfs"} ++TS_CMD_FSCKCRAMFS=${TS_CMD_FSCKCRAMFS:-"$top_builddir/test_fsck.cramfs"} + TS_CMD_FSCKMINIX=${TS_CMD_FSCKMINIX:-"$top_builddir/fsck.minix"} + + TS_CMD_IPCS=${TS_CMD_IPCS:-"$top_builddir/ipcs"} +-- +1.7.11.7 + diff --git a/0010-login-fix-compiler-warning-Wunused-result.patch b/0010-login-fix-compiler-warning-Wunused-result.patch new file mode 100644 index 0000000..2d50045 --- /dev/null +++ b/0010-login-fix-compiler-warning-Wunused-result.patch @@ -0,0 +1,44 @@ +From ed68f1e2f5609a3f42492df407d62b8fc006ea17 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Mon, 22 Oct 2012 13:13:02 +0200 +Subject: [PATCH 10/11] login: fix compiler warning [-Wunused-result] + +It's probably unnecessary paranoia, but let's check if we're able to +restore the original IDs after ~/.hushlogin file check. + +Signed-off-by: Karel Zak +--- + login-utils/login.c | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/login-utils/login.c b/login-utils/login.c +index 8ae5266..f5896da 100644 +--- a/login-utils/login.c ++++ b/login-utils/login.c +@@ -1031,13 +1031,17 @@ static int get_hushlogin_status(struct passwd *pwd) + gid_t egid = getegid(); + + sprintf(buf, "%s/%s", pwd->pw_dir, file); +- setregid(-1, pwd->pw_gid); +- setreuid(0, pwd->pw_uid); +- ok = effective_access(buf, O_RDONLY) == 0; +- setuid(0); /* setreuid doesn't do it alone! */ +- setreuid(ruid, 0); +- setregid(-1, egid); + ++ if (setregid(-1, pwd->pw_gid) == 0 && ++ setreuid(0, pwd->pw_uid) == 0) ++ ok = effective_access(buf, O_RDONLY) == 0; ++ ++ if (setuid(0) != 0 || ++ setreuid(ruid, 0) != 0 || ++ setregid(-1, egid) != 0) { ++ syslog(LOG_ALERT, _("hush login status: restore original IDs failed")); ++ exit(EXIT_FAILURE); ++ } + if (ok) + return 1; /* enabled by user */ + } +-- +1.7.11.7 + diff --git a/0011-misc-make-readlink-usage-more-robust.patch b/0011-misc-make-readlink-usage-more-robust.patch new file mode 100644 index 0000000..ce4e754 --- /dev/null +++ b/0011-misc-make-readlink-usage-more-robust.patch @@ -0,0 +1,63 @@ +From a3528342bc716ecdabdd86609ae5a3198f560870 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 23 Oct 2012 12:40:39 +0200 +Subject: [PATCH 11/11] misc: make readlink() usage more robust + +Signed-off-by: Karel Zak +--- + misc-utils/lsblk.c | 4 ++-- + misc-utils/lslocks.c | 2 +- + sys-utils/eject.c | 2 +- + 3 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c +index cc97c05..9c25dd0 100644 +--- a/misc-utils/lsblk.c ++++ b/misc-utils/lsblk.c +@@ -962,7 +962,7 @@ static int get_wholedisk_from_partition_dirent(DIR *dir, const char *dirname, + int len; + + if ((len = readlink_at(dirfd(dir), dirname, +- d->d_name, path, sizeof(path))) < 0) ++ d->d_name, path, sizeof(path) - 1)) < 0) + return 0; + + path[len] = '\0'; +@@ -1075,7 +1075,7 @@ static char *devno_to_sysfs_name(dev_t devno, char *devname, char *buf, size_t b + return NULL; + } + +- len = readlink(path, buf, buf_size); ++ len = readlink(path, buf, buf_size - 1); + if (len < 0) { + warn(_("%s: failed to read link"), path); + return NULL; +diff --git a/misc-utils/lslocks.c b/misc-utils/lslocks.c +index 45fb6de..495eb80 100644 +--- a/misc-utils/lslocks.c ++++ b/misc-utils/lslocks.c +@@ -196,7 +196,7 @@ static char *get_filename_sz(ino_t inode, pid_t pid, size_t *size) + continue; + + if ((len = readlink_at(fd, path, dp->d_name, +- sym, sizeof(path))) < 1) ++ sym, sizeof(sym) - 1)) < 1) + goto out; + + *size = sb.st_size; +diff --git a/sys-utils/eject.c b/sys-utils/eject.c +index 1a5b834..6d0da18 100644 +--- a/sys-utils/eject.c ++++ b/sys-utils/eject.c +@@ -837,7 +837,7 @@ static char *get_subsystem(char *chain, char *buf, size_t bufsz) + memcpy(chain + len, SUBSYSTEM_LINKNAME, sizeof(SUBSYSTEM_LINKNAME)); + + /* try if subsystem symlink exists */ +- sz = readlink(chain, buf, bufsz); ++ sz = readlink(chain, buf, bufsz - 1); + + /* remove last subsystem from chain */ + chain[len] = '\0'; +-- +1.7.11.7 + diff --git a/util-linux.spec b/util-linux.spec index 2d2e868..aa6dab8 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.22.1 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -83,6 +83,23 @@ Patch3: util-linux-ng-2.21-login-lastlog.patch # 231192 - ipcs is not printing correct values on pLinux Patch4: util-linux-2.21-ipcs-32bit.patch + +### Upstream patches from proposed stable/v2.22.2 branch +### (remove after update to the final 2.22.2) +### +Patch101: 0001-libmount-don-t-use-umount-optimization-for-l-or-f.patch +Patch102: 0002-wipefs-use-O_EXCL.patch +Patch103: 0003-swapon-remove-loop-declaration-smatch-scan.patch +Patch104: 0004-libblkid-fix-compiler-warning-Wstrict-aliasing.patch +Patch105: 0005-mount-add-c-abbreviation-for-no-canonicalize-to-man-.patch +Patch106: 0006-mount-add-long-options-for-L-and-U-to-man-page.patch +Patch107: 0007-lib-loopdev-improve-debug-messages.patch +Patch108: 0008-lib-loopdev-check-for-sys.patch +Patch109: 0009-fsck.cramfs-compile-with-DINCLUDE_FS_TESTS-for-make-.patch +Patch110: 0010-login-fix-compiler-warning-Wunused-result.patch +Patch111: 0011-misc-make-readlink-usage-more-robust.patch + + %description The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among @@ -199,6 +216,18 @@ cp %{SOURCE8} %{SOURCE9} . %patch3 -p1 %patch4 -p1 +%patch101 -p1 +%patch102 -p1 +%patch103 -p1 +%patch104 -p1 +%patch105 -p1 +%patch106 -p1 +%patch107 -p1 +%patch108 -p1 +%patch109 -p1 +%patch110 -p1 +%patch111 -p1 + %build unset LINGUAS || : @@ -725,6 +754,10 @@ fi %changelog +* Thu Nov 1 2012 Karel Zak 2.22.1-2 +- apply pathes from upstream stable/v2.22 branch +- fix #865961 - wipefs -a should use O_EXCL + * Thu Oct 10 2012 Karel Zak 2.22.1-1 - upgrade to the release 2.22.1