diff options
author | root <root@rshg054.dnsready.net> | 2013-05-17 01:53:16 -0700 |
---|---|---|
committer | root <root@rshg054.dnsready.net> | 2013-05-17 01:53:16 -0700 |
commit | b5f4c940227b9a7051c381688636d59f67864f93 (patch) | |
tree | 99d9cd904411e9aad2ea12662db7d3eb8c786085 /core/util-linux | |
parent | 453f3b8b2c568e9babcdc4852772278a39f130c0 (diff) |
Fri May 17 01:52:35 PDT 2013
Diffstat (limited to 'core/util-linux')
3 files changed, 104 insertions, 10 deletions
diff --git a/core/util-linux/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch b/core/util-linux/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch new file mode 100644 index 000000000..26da877ef --- /dev/null +++ b/core/util-linux/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch @@ -0,0 +1,57 @@ +From e3b6cb87e0ba1304fa07ec316784de1c6243b28e Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Mon, 13 May 2013 10:54:41 +0200 +Subject: [PATCH] lib/loopdev: fix loopcxt_check_size() to work with blkdevs + +The loopcxt_check_size() is workaround for kernels < v3.9, kernel has +been fixed by commit 541c742a7559eb65f0e36d3e2338c2ca532a3e61. + +The function sets loopdev size according to backing file size. The +problem is that the backing file could be a block device where +stat.st_size is zero, so we have to use blkdev_get_size() for block +devices. + +Addresses: https://bugs.archlinux.org/task/35193 +Reported-by: Dave Reisner <d@falconindy.com> +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + lib/loopdev.c | 16 +++++++++++++++- + 1 file changed, 15 insertions(+), 1 deletion(-) + +diff --git a/lib/loopdev.c b/lib/loopdev.c +index c35e306..3b65b5d 100644 +--- a/lib/loopdev.c ++++ b/lib/loopdev.c +@@ -1097,7 +1097,17 @@ static int loopcxt_check_size(struct loopdev_cxt *lc, int file_fd) + if (fstat(file_fd, &st)) + return -errno; + +- expected_size = st.st_size; ++ if (S_ISBLK(st.st_mode)) { ++ if (blkdev_get_size(file_fd, ++ (unsigned long long *) &expected_size)) ++ return -errno; ++ } else ++ expected_size = st.st_size; ++ ++ if (expected_size == 0 || expected_size <= lc->info.lo_offset) { ++ DBG(lc, loopdev_debug("failed to determine expected size")); ++ return 0; /* ignore this error */ ++ } + + if (lc->info.lo_offset > 0) + expected_size -= lc->info.lo_offset; +@@ -1113,6 +1123,10 @@ static int loopcxt_check_size(struct loopdev_cxt *lc, int file_fd) + return -errno; + + if (expected_size != size) { ++ DBG(lc, loopdev_debug("warning: loopdev and expected " ++ "size dismatch (%ju/%ju)", ++ size, expected_size)); ++ + if (loopcxt_set_capacity(lc)) { + /* ioctl not available */ + if (errno == ENOTTY || errno == EINVAL) +-- +1.8.2.3 + diff --git a/core/util-linux/0001-losetup-use-warn_size-for-regular-files-only.patch b/core/util-linux/0001-losetup-use-warn_size-for-regular-files-only.patch new file mode 100644 index 000000000..afc875719 --- /dev/null +++ b/core/util-linux/0001-losetup-use-warn_size-for-regular-files-only.patch @@ -0,0 +1,26 @@ +From b048b8af3a5568c90f6e0c2d56f6cb399dedb0d1 Mon Sep 17 00:00:00 2001 +From: Karel Zak <kzak@redhat.com> +Date: Mon, 13 May 2013 11:00:47 +0200 +Subject: [PATCH] losetup: use warn_size() for regular files only + +Signed-off-by: Karel Zak <kzak@redhat.com> +--- + sys-utils/losetup.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c +index ccf120e..b44c9e5 100644 +--- a/sys-utils/losetup.c ++++ b/sys-utils/losetup.c +@@ -380,7 +380,7 @@ static void warn_size(const char *filename, uint64_t size) + struct stat st; + + if (!size) { +- if (stat(filename, &st)) ++ if (stat(filename, &st) || S_ISBLK(st.st_mode)) + return; + size = st.st_size; + } +-- +1.8.2.3 + diff --git a/core/util-linux/PKGBUILD b/core/util-linux/PKGBUILD index 3894784c6..77b94f1a8 100644 --- a/core/util-linux/PKGBUILD +++ b/core/util-linux/PKGBUILD @@ -1,10 +1,10 @@ -# $Id: PKGBUILD 184217 2013-05-03 23:40:29Z dreisner $ +# $Id: PKGBUILD 185607 2013-05-15 22:53:31Z tomegun $ # Maintainer: Tom Gundersen <teg@jklm.no> # Contributor: judd <jvinet@zeroflux.org> pkgname=util-linux pkgver=2.23 -pkgrel=1 +pkgrel=2 pkgdesc="Miscellaneous system utilities for Linux" url="http://www.kernel.org/pub/linux/utils/util-linux/" arch=('i686' 'x86_64') @@ -13,10 +13,12 @@ depends=('pam' 'shadow' 'coreutils' 'glibc') makedepends=('systemd') # checkdepends=('bc') conflicts=('util-linux-ng' 'eject') -provides=("util-linux-ng=${pkgver}" 'eject') +provides=("util-linux-ng=$pkgver" 'eject') license=('GPL2') options=('!libtool') -source=(ftp://ftp.kernel.org/pub/linux/utils/${pkgname}/v2.23/${pkgname}-${pkgver}.tar.xz +source=("ftp://ftp.kernel.org/pub/linux/utils/$pkgname/v2.23/$pkgname-$pkgver.tar.xz" + 0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch + 0001-losetup-use-warn_size-for-regular-files-only.patch uuidd.tmpfiles pam-login pam-common @@ -27,9 +29,23 @@ backup=(etc/pam.d/chfn etc/pam.d/su etc/pam.d/su-l) install=util-linux.install +md5sums=('cf5e9bb402371beaaffc3a5f276d5783' + 'fdb627fbb3d6a42e0b36978649b4c064' + 'de0ba450945a60f27c5df86e64523d57' + 'a39554bfd65cccfd8254bb46922f4a67' + '4368b3f98abd8a32662e094c54e7f9b1' + 'a31374fef2cba0ca34dfc7078e2969e4' + 'fa85e5cce5d723275b14365ba71a8aad') + +prepare() { + cd "$pkgname-$pkgver" + + patch -Np1 <"$srcdir"/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch + patch -Np1 <"$srcdir"/0001-losetup-use-warn_size-for-regular-files-only.patch +} build() { - cd "${srcdir}/${pkgname}-${pkgver}" + cd "${pkgname}-${pkgver}" ./configure --prefix=/usr \ --libdir=/usr/lib \ @@ -76,8 +92,3 @@ package() { # TODO(dreisner): offer this upstream? install -Dm644 "$srcdir/uuidd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/uuidd.conf" } -md5sums=('cf5e9bb402371beaaffc3a5f276d5783' - 'a39554bfd65cccfd8254bb46922f4a67' - '4368b3f98abd8a32662e094c54e7f9b1' - 'a31374fef2cba0ca34dfc7078e2969e4' - 'fa85e5cce5d723275b14365ba71a8aad') |