[arch-commits] Commit in util-linux/repos (20 files)
Dave Reisner
dreisner at nymeria.archlinux.org
Wed May 22 15:26:27 UTC 2013
Date: Wednesday, May 22, 2013 @ 17:26:27
Author: dreisner
Revision: 186241
archrelease: copy trunk to testing-i686, testing-x86_64
Added:
util-linux/repos/testing-i686/
util-linux/repos/testing-i686/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
(from rev 186239, util-linux/trunk/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch)
util-linux/repos/testing-i686/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
(from rev 186239, util-linux/trunk/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch)
util-linux/repos/testing-i686/0001-losetup-use-warn_size-for-regular-files-only.patch
(from rev 186239, util-linux/trunk/0001-losetup-use-warn_size-for-regular-files-only.patch)
util-linux/repos/testing-i686/PKGBUILD
(from rev 186239, util-linux/trunk/PKGBUILD)
util-linux/repos/testing-i686/pam-common
(from rev 186239, util-linux/trunk/pam-common)
util-linux/repos/testing-i686/pam-login
(from rev 186239, util-linux/trunk/pam-login)
util-linux/repos/testing-i686/pam-su
(from rev 186239, util-linux/trunk/pam-su)
util-linux/repos/testing-i686/util-linux.install
(from rev 186239, util-linux/trunk/util-linux.install)
util-linux/repos/testing-i686/uuidd.tmpfiles
(from rev 186239, util-linux/trunk/uuidd.tmpfiles)
util-linux/repos/testing-x86_64/
util-linux/repos/testing-x86_64/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
(from rev 186239, util-linux/trunk/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch)
util-linux/repos/testing-x86_64/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
(from rev 186239, util-linux/trunk/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch)
util-linux/repos/testing-x86_64/0001-losetup-use-warn_size-for-regular-files-only.patch
(from rev 186239, util-linux/trunk/0001-losetup-use-warn_size-for-regular-files-only.patch)
util-linux/repos/testing-x86_64/PKGBUILD
(from rev 186239, util-linux/trunk/PKGBUILD)
util-linux/repos/testing-x86_64/pam-common
(from rev 186239, util-linux/trunk/pam-common)
util-linux/repos/testing-x86_64/pam-login
(from rev 186239, util-linux/trunk/pam-login)
util-linux/repos/testing-x86_64/pam-su
(from rev 186239, util-linux/trunk/pam-su)
util-linux/repos/testing-x86_64/util-linux.install
(from rev 186239, util-linux/trunk/util-linux.install)
util-linux/repos/testing-x86_64/uuidd.tmpfiles
(from rev 186239, util-linux/trunk/uuidd.tmpfiles)
--------------------------------------------------------------------------------+
testing-i686/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch | 57 +++
testing-i686/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch | 163 ++++++++++
testing-i686/0001-losetup-use-warn_size-for-regular-files-only.patch | 26 +
testing-i686/PKGBUILD | 97 +++++
testing-i686/pam-common | 6
testing-i686/pam-login | 7
testing-i686/pam-su | 9
testing-i686/util-linux.install | 21 +
testing-i686/uuidd.tmpfiles | 1
testing-x86_64/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch | 57 +++
testing-x86_64/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch | 163 ++++++++++
testing-x86_64/0001-losetup-use-warn_size-for-regular-files-only.patch | 26 +
testing-x86_64/PKGBUILD | 97 +++++
testing-x86_64/pam-common | 6
testing-x86_64/pam-login | 7
testing-x86_64/pam-su | 9
testing-x86_64/util-linux.install | 21 +
testing-x86_64/uuidd.tmpfiles | 1
18 files changed, 774 insertions(+)
Copied: util-linux/repos/testing-i686/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch (from rev 186239, util-linux/trunk/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch)
===================================================================
--- testing-i686/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch (rev 0)
+++ testing-i686/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,57 @@
+From e3b6cb87e0ba1304fa07ec316784de1c6243b28e Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at 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 at falconindy.com>
+Signed-off-by: Karel Zak <kzak at 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
+
Copied: util-linux/repos/testing-i686/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch (from rev 186239, util-linux/trunk/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch)
===================================================================
--- testing-i686/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch (rev 0)
+++ testing-i686/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,163 @@
+From 4fb18cde32a6cb672090762c785d89a6ed02ef57 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Thu, 9 May 2013 13:06:02 +0200
+Subject: [PATCH] libfdisk: do not use va_list in the Ask API
+
+ # fdisk /dev/sda
+ Welcome to fdisk (util-linux 2.23).
+
+ [...]
+
+ Command (m for help): a
+ Segmentation fault (core dumped)
+
+It's too fragile, the va_list implementation is architecture specific
+and it seems we need such thing in libfdisk at all.
+
+Reported-by: "Gabor Z. Papp" <gzp at papp.hu>
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ fdisks/fdisk-ask.c | 13 +++----------
+ libfdisk/src/ask.c | 35 +++++++++--------------------------
+ libfdisk/src/fdiskP.h | 2 --
+ libfdisk/src/libfdisk.h | 2 --
+ 4 files changed, 12 insertions(+), 40 deletions(-)
+
+diff --git a/fdisks/fdisk-ask.c b/fdisks/fdisk-ask.c
+index 7495d85..61dc0c2 100644
+--- a/fdisks/fdisk-ask.c
++++ b/fdisks/fdisk-ask.c
+@@ -167,7 +167,6 @@ static int ask_offset(struct fdisk_context *cxt,
+ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ void *data __attribute__((__unused__)))
+ {
+- va_list ap;
+ int rc = 0;
+ char buf[BUFSIZ];
+
+@@ -180,23 +179,17 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ case FDISK_ASKTYPE_OFFSET:
+ return ask_offset(cxt, ask, buf, sizeof(buf));
+ case FDISK_ASKTYPE_INFO:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stdout, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stdout);
+ fputc('\n', stdout);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARNX:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ fputc('\n', stderr);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARN:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ errno = fdisk_ask_print_get_errno(ask);
+ fprintf(stderr, ": %m\n");
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_YESNO:
+ fputc('\n', stdout);
+diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c
+index d2325d5..cdb4d01 100644
+--- a/libfdisk/src/ask.c
++++ b/libfdisk/src/ask.c
+@@ -18,11 +18,6 @@ void fdisk_reset_ask(struct fdisk_ask *ask)
+ case FDISK_ASKTYPE_NUMBER:
+ free(ask->data.num.range);
+ break;
+- case FDISK_ASKTYPE_WARNX:
+- case FDISK_ASKTYPE_WARN:
+- if (ask->data.print.has_va)
+- va_end(ask->data.print.va);
+- break;
+ default:
+ break;
+ }
+@@ -452,44 +447,32 @@ int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg)
+ return 0;
+ }
+
+-/* caller has to call va_end(ap) */
+-int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- assert(is_print_ask(ask));
+- va_copy(ap, ask->data.print.va);
+- return 0;
+-}
+-
+-/* note that fdisk_free_ask() calls va_end() to free the private va list. */
+-int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- va_copy(ask->data.print.va, ap);
+- ask->data.print.has_va = 1;
+- return 0;
+-}
+-
+ static int do_vprint(struct fdisk_context *cxt, int errnum, int type,
+ const char *fmt, va_list va)
+ {
+ struct fdisk_ask *ask;
+ int rc;
++ char *mesg;
+
+ assert(cxt);
+
++ if (vasprintf(&mesg, fmt, va) < 0)
++ return -ENOMEM;
++
+ ask = fdisk_new_ask();
+- if (!ask)
++ if (!ask) {
++ free(mesg);
+ return -ENOMEM;
++ }
+
+ fdisk_ask_set_type(ask, type);
+- fdisk_ask_print_set_mesg(ask, fmt);
+- fdisk_ask_print_set_va(ask, va);
++ fdisk_ask_print_set_mesg(ask, mesg);
+ if (errnum >= 0)
+ fdisk_ask_print_set_errno(ask, errnum);
+ rc = fdisk_do_ask(cxt, ask);
+
+ fdisk_free_ask(ask);
++ free(mesg);
+ return rc;
+ }
+
+diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
+index 570108c..ce42860 100644
+--- a/libfdisk/src/fdiskP.h
++++ b/libfdisk/src/fdiskP.h
+@@ -231,8 +231,6 @@ struct fdisk_ask {
+ /* FDISK_ASKTYPE_{WARN,WARNX,..} */
+ struct ask_print {
+ const char *mesg;
+- va_list va;
+- unsigned int has_va:1;
+ int errnum; /* errno */
+ } print;
+ /* FDISK_ASKTYPE_YESNO */
+diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h
+index 0a23236..8a44067 100644
+--- a/libfdisk/src/libfdisk.h
++++ b/libfdisk/src/libfdisk.h
+@@ -182,8 +182,6 @@ extern int fdisk_ask_print_get_errno(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_errno(struct fdisk_ask *ask, int errnum);
+ extern const char *fdisk_ask_print_get_mesg(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg);
+-extern int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap);
+-extern int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap);
+
+ #ifdef __cplusplus
+ }
+--
+1.8.2.3
+
Copied: util-linux/repos/testing-i686/0001-losetup-use-warn_size-for-regular-files-only.patch (from rev 186239, util-linux/trunk/0001-losetup-use-warn_size-for-regular-files-only.patch)
===================================================================
--- testing-i686/0001-losetup-use-warn_size-for-regular-files-only.patch (rev 0)
+++ testing-i686/0001-losetup-use-warn_size-for-regular-files-only.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,26 @@
+From b048b8af3a5568c90f6e0c2d56f6cb399dedb0d1 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at 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 at 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
+
Copied: util-linux/repos/testing-i686/PKGBUILD (from rev 186239, util-linux/trunk/PKGBUILD)
===================================================================
--- testing-i686/PKGBUILD (rev 0)
+++ testing-i686/PKGBUILD 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,97 @@
+# $Id$
+# Maintainer: Tom Gundersen <teg at jklm.no>
+# Contributor: judd <jvinet at zeroflux.org>
+
+pkgname=util-linux
+pkgver=2.23
+pkgrel=3
+pkgdesc="Miscellaneous system utilities for Linux"
+url="http://www.kernel.org/pub/linux/utils/util-linux/"
+arch=('i686' 'x86_64')
+groups=('base' 'base-devel')
+depends=('pam' 'shadow' 'coreutils' 'glibc')
+makedepends=('systemd')
+# checkdepends=('bc')
+conflicts=('util-linux-ng' '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"
+ 0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
+ 0001-losetup-use-warn_size-for-regular-files-only.patch
+ 0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
+ uuidd.tmpfiles
+ pam-login
+ pam-common
+ pam-su)
+backup=(etc/pam.d/chfn
+ etc/pam.d/chsh
+ etc/pam.d/login
+ etc/pam.d/su
+ etc/pam.d/su-l)
+install=util-linux.install
+md5sums=('cf5e9bb402371beaaffc3a5f276d5783'
+ 'fdb627fbb3d6a42e0b36978649b4c064'
+ 'de0ba450945a60f27c5df86e64523d57'
+ 'df949d15dbff01fe9fcda5d999a35b15'
+ '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
+ patch -Np1 <"$srcdir"/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
+}
+
+build() {
+ cd "${pkgname}-${pkgver}"
+
+ ./configure --prefix=/usr \
+ --libdir=/usr/lib \
+ --localstatedir=/run \
+ --enable-fs-paths-extra=/usr/bin:/usr/sbin \
+ --enable-raw \
+ --enable-vipw \
+ --enable-newgrp \
+ --enable-chfn-chsh \
+ --enable-write \
+ --enable-mesg \
+ --enable-socket-activation
+
+# --enable-reset \ # part of ncurses
+# --enable-line \ # not part of any package
+# --enable-last \ # not compat
+
+ make
+}
+
+#check() {
+# fails for some reason in chroot, works outside
+# make -C "$pkgname-$pkgver" check
+#}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ cd "${pkgdir}"
+
+ # setuid chfn and chsh
+ chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}
+
+ # install PAM files for login-utils
+ install -Dm644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chfn"
+ install -m644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chsh"
+ install -m644 "$srcdir/pam-login" "$pkgdir/etc/pam.d/login"
+ install -m644 "$srcdir/pam-su" "${pkgdir}/etc/pam.d/su"
+ install -m644 "$srcdir/pam-su" "${pkgdir}/etc/pam.d/su-l"
+
+ # include tmpfiles fragment for uuidd
+ # TODO(dreisner): offer this upstream?
+ install -Dm644 "$srcdir/uuidd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/uuidd.conf"
+}
Copied: util-linux/repos/testing-i686/pam-common (from rev 186239, util-linux/trunk/pam-common)
===================================================================
--- testing-i686/pam-common (rev 0)
+++ testing-i686/pam-common 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,6 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
+password required pam_permit.so
Copied: util-linux/repos/testing-i686/pam-login (from rev 186239, util-linux/trunk/pam-login)
===================================================================
--- testing-i686/pam-login (rev 0)
+++ testing-i686/pam-login 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,7 @@
+#%PAM-1.0
+
+auth required pam_securetty.so
+auth requisite pam_nologin.so
+auth include system-local-login
+account include system-local-login
+session include system-local-login
Copied: util-linux/repos/testing-i686/pam-su (from rev 186239, util-linux/trunk/pam-su)
===================================================================
--- testing-i686/pam-su (rev 0)
+++ testing-i686/pam-su 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,9 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+# Uncomment the following line to implicitly trust users in the "wheel" group.
+#auth sufficient pam_wheel.so trust use_uid
+# Uncomment the following line to require a user to be in the "wheel" group.
+#auth required pam_wheel.so use_uid
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
Copied: util-linux/repos/testing-i686/util-linux.install (from rev 186239, util-linux/trunk/util-linux.install)
===================================================================
--- testing-i686/util-linux.install (rev 0)
+++ testing-i686/util-linux.install 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,21 @@
+post_install() {
+ # we don't want use systemd-tmpfiles here because
+ # the package dependency would create a circular dep.
+ if [ ! -d run/uuidd ]; then
+ # refer to uid/gid by number to avoid dependency on filesystem
+ install -o 68 -g 68 -dm755 run/uuidd
+ fi
+}
+
+post_upgrade() {
+ if [ "$(vercmp $2 2.21.2-4)" -lt 0 ]; then
+ if [ -f /var/lib/hwclock/adjtime ]; then
+ mv /var/lib/hwclock/adjtime /etc/adjtime
+ fi
+ if [ -d /var/lib/hwclock ]; then
+ rmdir /var/lib/hwclock
+ fi
+ fi
+
+ post_install
+}
Copied: util-linux/repos/testing-i686/uuidd.tmpfiles (from rev 186239, util-linux/trunk/uuidd.tmpfiles)
===================================================================
--- testing-i686/uuidd.tmpfiles (rev 0)
+++ testing-i686/uuidd.tmpfiles 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1 @@
+d /run/uuidd 0755 uuidd uuidd
Copied: util-linux/repos/testing-x86_64/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch (from rev 186239, util-linux/trunk/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch)
===================================================================
--- testing-x86_64/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch (rev 0)
+++ testing-x86_64/0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,57 @@
+From e3b6cb87e0ba1304fa07ec316784de1c6243b28e Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at 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 at falconindy.com>
+Signed-off-by: Karel Zak <kzak at 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
+
Copied: util-linux/repos/testing-x86_64/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch (from rev 186239, util-linux/trunk/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch)
===================================================================
--- testing-x86_64/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch (rev 0)
+++ testing-x86_64/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,163 @@
+From 4fb18cde32a6cb672090762c785d89a6ed02ef57 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Thu, 9 May 2013 13:06:02 +0200
+Subject: [PATCH] libfdisk: do not use va_list in the Ask API
+
+ # fdisk /dev/sda
+ Welcome to fdisk (util-linux 2.23).
+
+ [...]
+
+ Command (m for help): a
+ Segmentation fault (core dumped)
+
+It's too fragile, the va_list implementation is architecture specific
+and it seems we need such thing in libfdisk at all.
+
+Reported-by: "Gabor Z. Papp" <gzp at papp.hu>
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ fdisks/fdisk-ask.c | 13 +++----------
+ libfdisk/src/ask.c | 35 +++++++++--------------------------
+ libfdisk/src/fdiskP.h | 2 --
+ libfdisk/src/libfdisk.h | 2 --
+ 4 files changed, 12 insertions(+), 40 deletions(-)
+
+diff --git a/fdisks/fdisk-ask.c b/fdisks/fdisk-ask.c
+index 7495d85..61dc0c2 100644
+--- a/fdisks/fdisk-ask.c
++++ b/fdisks/fdisk-ask.c
+@@ -167,7 +167,6 @@ static int ask_offset(struct fdisk_context *cxt,
+ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ void *data __attribute__((__unused__)))
+ {
+- va_list ap;
+ int rc = 0;
+ char buf[BUFSIZ];
+
+@@ -180,23 +179,17 @@ int ask_callback(struct fdisk_context *cxt, struct fdisk_ask *ask,
+ case FDISK_ASKTYPE_OFFSET:
+ return ask_offset(cxt, ask, buf, sizeof(buf));
+ case FDISK_ASKTYPE_INFO:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stdout, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stdout);
+ fputc('\n', stdout);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARNX:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ fputc('\n', stderr);
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_WARN:
+- fdisk_ask_print_get_va(ask, ap);
+- vfprintf(stderr, fdisk_ask_print_get_mesg(ask), ap);
++ fputs(fdisk_ask_print_get_mesg(ask), stderr);
+ errno = fdisk_ask_print_get_errno(ask);
+ fprintf(stderr, ": %m\n");
+- va_end(ap);
+ break;
+ case FDISK_ASKTYPE_YESNO:
+ fputc('\n', stdout);
+diff --git a/libfdisk/src/ask.c b/libfdisk/src/ask.c
+index d2325d5..cdb4d01 100644
+--- a/libfdisk/src/ask.c
++++ b/libfdisk/src/ask.c
+@@ -18,11 +18,6 @@ void fdisk_reset_ask(struct fdisk_ask *ask)
+ case FDISK_ASKTYPE_NUMBER:
+ free(ask->data.num.range);
+ break;
+- case FDISK_ASKTYPE_WARNX:
+- case FDISK_ASKTYPE_WARN:
+- if (ask->data.print.has_va)
+- va_end(ask->data.print.va);
+- break;
+ default:
+ break;
+ }
+@@ -452,44 +447,32 @@ int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg)
+ return 0;
+ }
+
+-/* caller has to call va_end(ap) */
+-int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- assert(is_print_ask(ask));
+- va_copy(ap, ask->data.print.va);
+- return 0;
+-}
+-
+-/* note that fdisk_free_ask() calls va_end() to free the private va list. */
+-int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap)
+-{
+- assert(ask);
+- va_copy(ask->data.print.va, ap);
+- ask->data.print.has_va = 1;
+- return 0;
+-}
+-
+ static int do_vprint(struct fdisk_context *cxt, int errnum, int type,
+ const char *fmt, va_list va)
+ {
+ struct fdisk_ask *ask;
+ int rc;
++ char *mesg;
+
+ assert(cxt);
+
++ if (vasprintf(&mesg, fmt, va) < 0)
++ return -ENOMEM;
++
+ ask = fdisk_new_ask();
+- if (!ask)
++ if (!ask) {
++ free(mesg);
+ return -ENOMEM;
++ }
+
+ fdisk_ask_set_type(ask, type);
+- fdisk_ask_print_set_mesg(ask, fmt);
+- fdisk_ask_print_set_va(ask, va);
++ fdisk_ask_print_set_mesg(ask, mesg);
+ if (errnum >= 0)
+ fdisk_ask_print_set_errno(ask, errnum);
+ rc = fdisk_do_ask(cxt, ask);
+
+ fdisk_free_ask(ask);
++ free(mesg);
+ return rc;
+ }
+
+diff --git a/libfdisk/src/fdiskP.h b/libfdisk/src/fdiskP.h
+index 570108c..ce42860 100644
+--- a/libfdisk/src/fdiskP.h
++++ b/libfdisk/src/fdiskP.h
+@@ -231,8 +231,6 @@ struct fdisk_ask {
+ /* FDISK_ASKTYPE_{WARN,WARNX,..} */
+ struct ask_print {
+ const char *mesg;
+- va_list va;
+- unsigned int has_va:1;
+ int errnum; /* errno */
+ } print;
+ /* FDISK_ASKTYPE_YESNO */
+diff --git a/libfdisk/src/libfdisk.h b/libfdisk/src/libfdisk.h
+index 0a23236..8a44067 100644
+--- a/libfdisk/src/libfdisk.h
++++ b/libfdisk/src/libfdisk.h
+@@ -182,8 +182,6 @@ extern int fdisk_ask_print_get_errno(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_errno(struct fdisk_ask *ask, int errnum);
+ extern const char *fdisk_ask_print_get_mesg(struct fdisk_ask *ask);
+ extern int fdisk_ask_print_set_mesg(struct fdisk_ask *ask, const char *mesg);
+-extern int fdisk_ask_print_get_va(struct fdisk_ask *ask, va_list ap);
+-extern int fdisk_ask_print_set_va(struct fdisk_ask *ask, va_list ap);
+
+ #ifdef __cplusplus
+ }
+--
+1.8.2.3
+
Copied: util-linux/repos/testing-x86_64/0001-losetup-use-warn_size-for-regular-files-only.patch (from rev 186239, util-linux/trunk/0001-losetup-use-warn_size-for-regular-files-only.patch)
===================================================================
--- testing-x86_64/0001-losetup-use-warn_size-for-regular-files-only.patch (rev 0)
+++ testing-x86_64/0001-losetup-use-warn_size-for-regular-files-only.patch 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,26 @@
+From b048b8af3a5568c90f6e0c2d56f6cb399dedb0d1 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at 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 at 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
+
Copied: util-linux/repos/testing-x86_64/PKGBUILD (from rev 186239, util-linux/trunk/PKGBUILD)
===================================================================
--- testing-x86_64/PKGBUILD (rev 0)
+++ testing-x86_64/PKGBUILD 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,97 @@
+# $Id$
+# Maintainer: Tom Gundersen <teg at jklm.no>
+# Contributor: judd <jvinet at zeroflux.org>
+
+pkgname=util-linux
+pkgver=2.23
+pkgrel=3
+pkgdesc="Miscellaneous system utilities for Linux"
+url="http://www.kernel.org/pub/linux/utils/util-linux/"
+arch=('i686' 'x86_64')
+groups=('base' 'base-devel')
+depends=('pam' 'shadow' 'coreutils' 'glibc')
+makedepends=('systemd')
+# checkdepends=('bc')
+conflicts=('util-linux-ng' '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"
+ 0001-lib-loopdev-fix-loopcxt_check_size-to-work-with-blkd.patch
+ 0001-losetup-use-warn_size-for-regular-files-only.patch
+ 0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
+ uuidd.tmpfiles
+ pam-login
+ pam-common
+ pam-su)
+backup=(etc/pam.d/chfn
+ etc/pam.d/chsh
+ etc/pam.d/login
+ etc/pam.d/su
+ etc/pam.d/su-l)
+install=util-linux.install
+md5sums=('cf5e9bb402371beaaffc3a5f276d5783'
+ 'fdb627fbb3d6a42e0b36978649b4c064'
+ 'de0ba450945a60f27c5df86e64523d57'
+ 'df949d15dbff01fe9fcda5d999a35b15'
+ '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
+ patch -Np1 <"$srcdir"/0001-libfdisk-do-not-use-va_list-in-the-Ask-API.patch
+}
+
+build() {
+ cd "${pkgname}-${pkgver}"
+
+ ./configure --prefix=/usr \
+ --libdir=/usr/lib \
+ --localstatedir=/run \
+ --enable-fs-paths-extra=/usr/bin:/usr/sbin \
+ --enable-raw \
+ --enable-vipw \
+ --enable-newgrp \
+ --enable-chfn-chsh \
+ --enable-write \
+ --enable-mesg \
+ --enable-socket-activation
+
+# --enable-reset \ # part of ncurses
+# --enable-line \ # not part of any package
+# --enable-last \ # not compat
+
+ make
+}
+
+#check() {
+# fails for some reason in chroot, works outside
+# make -C "$pkgname-$pkgver" check
+#}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ cd "${pkgdir}"
+
+ # setuid chfn and chsh
+ chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}
+
+ # install PAM files for login-utils
+ install -Dm644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chfn"
+ install -m644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chsh"
+ install -m644 "$srcdir/pam-login" "$pkgdir/etc/pam.d/login"
+ install -m644 "$srcdir/pam-su" "${pkgdir}/etc/pam.d/su"
+ install -m644 "$srcdir/pam-su" "${pkgdir}/etc/pam.d/su-l"
+
+ # include tmpfiles fragment for uuidd
+ # TODO(dreisner): offer this upstream?
+ install -Dm644 "$srcdir/uuidd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/uuidd.conf"
+}
Copied: util-linux/repos/testing-x86_64/pam-common (from rev 186239, util-linux/trunk/pam-common)
===================================================================
--- testing-x86_64/pam-common (rev 0)
+++ testing-x86_64/pam-common 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,6 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
+password required pam_permit.so
Copied: util-linux/repos/testing-x86_64/pam-login (from rev 186239, util-linux/trunk/pam-login)
===================================================================
--- testing-x86_64/pam-login (rev 0)
+++ testing-x86_64/pam-login 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,7 @@
+#%PAM-1.0
+
+auth required pam_securetty.so
+auth requisite pam_nologin.so
+auth include system-local-login
+account include system-local-login
+session include system-local-login
Copied: util-linux/repos/testing-x86_64/pam-su (from rev 186239, util-linux/trunk/pam-su)
===================================================================
--- testing-x86_64/pam-su (rev 0)
+++ testing-x86_64/pam-su 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,9 @@
+#%PAM-1.0
+auth sufficient pam_rootok.so
+# Uncomment the following line to implicitly trust users in the "wheel" group.
+#auth sufficient pam_wheel.so trust use_uid
+# Uncomment the following line to require a user to be in the "wheel" group.
+#auth required pam_wheel.so use_uid
+auth required pam_unix.so
+account required pam_unix.so
+session required pam_unix.so
Copied: util-linux/repos/testing-x86_64/util-linux.install (from rev 186239, util-linux/trunk/util-linux.install)
===================================================================
--- testing-x86_64/util-linux.install (rev 0)
+++ testing-x86_64/util-linux.install 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1,21 @@
+post_install() {
+ # we don't want use systemd-tmpfiles here because
+ # the package dependency would create a circular dep.
+ if [ ! -d run/uuidd ]; then
+ # refer to uid/gid by number to avoid dependency on filesystem
+ install -o 68 -g 68 -dm755 run/uuidd
+ fi
+}
+
+post_upgrade() {
+ if [ "$(vercmp $2 2.21.2-4)" -lt 0 ]; then
+ if [ -f /var/lib/hwclock/adjtime ]; then
+ mv /var/lib/hwclock/adjtime /etc/adjtime
+ fi
+ if [ -d /var/lib/hwclock ]; then
+ rmdir /var/lib/hwclock
+ fi
+ fi
+
+ post_install
+}
Copied: util-linux/repos/testing-x86_64/uuidd.tmpfiles (from rev 186239, util-linux/trunk/uuidd.tmpfiles)
===================================================================
--- testing-x86_64/uuidd.tmpfiles (rev 0)
+++ testing-x86_64/uuidd.tmpfiles 2013-05-22 15:26:27 UTC (rev 186241)
@@ -0,0 +1 @@
+d /run/uuidd 0755 uuidd uuidd
More information about the arch-commits
mailing list