[arch-commits] Commit in util-linux/trunk (3 files)
Thomas Bächler
thomas at nymeria.archlinux.org
Wed Apr 2 09:39:32 UTC 2014
Date: Wednesday, April 2, 2014 @ 11:39:32
Author: thomas
Revision: 209737
Fix libmount with 3.14
Added:
util-linux/trunk/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch
util-linux/trunk/move_is_mountinfo.patch
Modified:
util-linux/trunk/PKGBUILD
-------------------------------------------------------+
0001-libmount-FS-id-and-parent-ID-could-be-zero.patch | 98 ++++++++++++++++
PKGBUILD | 17 ++
move_is_mountinfo.patch | 46 +++++++
3 files changed, 158 insertions(+), 3 deletions(-)
Added: 0001-libmount-FS-id-and-parent-ID-could-be-zero.patch
===================================================================
--- 0001-libmount-FS-id-and-parent-ID-could-be-zero.patch (rev 0)
+++ 0001-libmount-FS-id-and-parent-ID-could-be-zero.patch 2014-04-02 09:39:32 UTC (rev 209737)
@@ -0,0 +1,98 @@
+From 6c373810f5b1d32824371e9dff6ee5a006388f98 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Thu, 20 Feb 2014 16:59:11 +0100
+Subject: [PATCH] libmount: FS id and parent ID could be zero
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+It seems that linux 3.14 is able to produce things like:
+
+ 19 0 8:3 / / rw,relatime - ext4 /dev/sda3 rw,data=ordered
+ ^
+
+Reported-by: Mantas Mikulėnas <grawity at gmail.com>
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ libmount/src/tab.c | 12 ++++--------
+ misc-utils/findmnt.c | 5 +++--
+ 2 files changed, 7 insertions(+), 10 deletions(-)
+
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 4c2f8a4..332312b 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -505,7 +505,7 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
+ assert(tb);
+ assert(root);
+
+- if (!tb || !root)
++ if (!tb || !root || !is_mountinfo(tb))
+ return -EINVAL;
+
+ DBG(TAB, mnt_debug_h(tb, "lookup root fs"));
+@@ -515,8 +515,6 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
+ mnt_reset_iter(&itr, MNT_ITER_FORWARD);
+ while(mnt_table_next_fs(tb, &itr, &fs) == 0) {
+ int id = mnt_fs_get_parent_id(fs);
+- if (!id)
+- break; /* @tab is not a mountinfo file? */
+
+ if (!*root || id < root_id) {
+ *root = fs;
+@@ -524,7 +522,7 @@ int mnt_table_get_root_fs(struct libmnt_table *tb, struct libmnt_fs **root)
+ }
+ }
+
+- return root_id ? 0 : -EINVAL;
++ return *root ? 0 : -EINVAL;
+ }
+
+ /**
+@@ -545,15 +543,13 @@ int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ struct libmnt_fs *fs;
+ int parent_id, lastchld_id = 0, chld_id = 0;
+
+- if (!tb || !itr || !parent)
++ if (!tb || !itr || !parent || !is_mountinfo(tb))
+ return -EINVAL;
+
+ DBG(TAB, mnt_debug_h(tb, "lookup next child of '%s'",
+ mnt_fs_get_target(parent)));
+
+ parent_id = mnt_fs_get_id(parent);
+- if (!parent_id)
+- return -EINVAL;
+
+ /* get ID of the previously returned child */
+ if (itr->head && itr->p != itr->head) {
+@@ -584,7 +580,7 @@ int mnt_table_next_child_fs(struct libmnt_table *tb, struct libmnt_iter *itr,
+ }
+ }
+
+- if (!chld_id)
++ if (!*chld)
+ return 1; /* end of iterator */
+
+ /* set the iterator to the @chld for the next call */
+diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
+index fb21174..988cd73 100644
+--- a/misc-utils/findmnt.c
++++ b/misc-utils/findmnt.c
+@@ -822,8 +822,9 @@ static int tab_is_tree(struct libmnt_table *tb)
+ if (!itr)
+ return 0;
+
+- if (mnt_table_next_fs(tb, itr, &fs) == 0)
+- rc = mnt_fs_get_id(fs) > 0 && mnt_fs_get_parent_id(fs) > 0;
++ rc = (mnt_table_next_fs(tb, itr, &fs) == 0 &&
++ mnt_fs_is_kernel(fs) &&
++ mnt_fs_get_root(fs));
+
+ mnt_free_iter(itr);
+ return rc;
+--
+1.9.1
+
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2014-04-02 04:20:01 UTC (rev 209736)
+++ PKGBUILD 2014-04-02 09:39:32 UTC (rev 209737)
@@ -6,7 +6,7 @@
pkgbase=util-linux
pkgname=(util-linux libutil-linux)
pkgver=2.24.1
-pkgrel=4
+pkgrel=5
pkgdesc="Miscellaneous system utilities for Linux"
url="http://www.kernel.org/pub/linux/utils/util-linux/"
arch=('i686' 'x86_64')
@@ -19,13 +19,24 @@
uuidd.tmpfiles
pam-login
pam-common
- pam-su)
+ pam-su
+ move_is_mountinfo.patch
+ 0001-libmount-FS-id-and-parent-ID-could-be-zero.patch)
md5sums=('88d46ae23ca599ac5af9cf96b531590f'
'a39554bfd65cccfd8254bb46922f4a67'
'4368b3f98abd8a32662e094c54e7f9b1'
'a31374fef2cba0ca34dfc7078e2969e4'
- 'fa85e5cce5d723275b14365ba71a8aad')
+ 'fa85e5cce5d723275b14365ba71a8aad'
+ '4cdc5f9a6e51b032274761a82937d438'
+ '2f4bc305bd11d6bfaa81e6c1eb0c6f1b')
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ patch -p1 -i "${srcdir}/move_is_mountinfo.patch"
+ patch -p1 -i "${srcdir}/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch"
+}
+
build() {
cd "$pkgname-$pkgver"
Added: move_is_mountinfo.patch
===================================================================
--- move_is_mountinfo.patch (rev 0)
+++ move_is_mountinfo.patch 2014-04-02 09:39:32 UTC (rev 209737)
@@ -0,0 +1,46 @@
+diff --git a/libmount/src/tab.c b/libmount/src/tab.c
+index 3633b6a..8ae49c8 100644
+--- a/libmount/src/tab.c
++++ b/libmount/src/tab.c
+@@ -47,6 +47,20 @@
+ #include "strutils.h"
+ #include "loopdev.h"
+
++static int is_mountinfo(struct libmnt_table *tb)
++{
++ struct libmnt_fs *fs;
++
++ if (!tb)
++ return 0;
++
++ fs = list_first_entry(&tb->ents, struct libmnt_fs, ents);
++ if (fs && mnt_fs_is_kernel(fs) && mnt_fs_get_root(fs))
++ return 1;
++
++ return 0;
++}
++
+ /**
+ * mnt_new_table:
+ *
+@@ -1229,20 +1335,6 @@ err:
+ return NULL;
+ }
+
+-static int is_mountinfo(struct libmnt_table *tb)
+-{
+- struct libmnt_fs *fs;
+-
+- if (!tb)
+- return 0;
+-
+- fs = list_first_entry(&tb->ents, struct libmnt_fs, ents);
+- if (fs && mnt_fs_is_kernel(fs) && mnt_fs_get_root(fs))
+- return 1;
+-
+- return 0;
+-}
+-
+ /**
+ * mnt_table_is_fs__mounted:
+ * @tb: /proc/self/mountinfo file
More information about the arch-commits
mailing list