Date: Sunday, March 4, 2012 @ 16:47:12 Author: tomegun Revision: 152118
add some patches Added: util-linux/trunk/libmount-cosmetic-changes-around-none.patch util-linux/trunk/libmount-don-t-treat-none-differently.patch util-linux/trunk/mount-new-add-internal-only-i-to-non-root-allowed-op.patch Modified: util-linux/trunk/PKGBUILD ------------------------------------------------------------+ PKGBUILD | 17 - libmount-cosmetic-changes-around-none.patch | 57 +++++ libmount-don-t-treat-none-differently.patch | 107 +++++++++++ mount-new-add-internal-only-i-to-non-root-allowed-op.patch | 32 +++ 4 files changed, 204 insertions(+), 9 deletions(-) Modified: PKGBUILD =================================================================== --- PKGBUILD 2012-03-04 15:08:47 UTC (rev 152117) +++ PKGBUILD 2012-03-04 21:47:12 UTC (rev 152118) @@ -4,7 +4,7 @@ pkgname=util-linux pkgver=2.21 -pkgrel=4 +pkgrel=5 pkgdesc="Miscellaneous system utilities for Linux" url="http://www.kernel.org/pub/linux/utils/util-linux/" arch=('i686' 'x86_64') @@ -20,7 +20,10 @@ libmount-canonicalize-targets-from-fstab-on-mount-a.patch mount-new-cleanup-mount-a-return-codes.patch libmount-use-mount.-type-s-for-NFS-only.patch - libmount-allow-empty-source-for-mount-2-syscall.patch) + libmount-allow-empty-source-for-mount-2-syscall.patch + mount-new-add-internal-only-i-to-non-root-allowed-op.patch + libmount-don-t-treat-none-differently.patch + libmount-cosmetic-changes-around-none.patch) optdepends=('perl: for chkdupexe support') build() { @@ -35,6 +38,9 @@ patch -p1 -i ../mount-new-cleanup-mount-a-return-codes.patch patch -p1 -i ../libmount-use-mount.-type-s-for-NFS-only.patch patch -p1 -i ../libmount-allow-empty-source-for-mount-2-syscall.patch + patch -p1 -i ../mount-new-add-internal-only-i-to-non-root-allowed-op.patch + patch -p1 -i ../libmount-don-t-treat-none-differently.patch + patch -p1 -i ../libmount-cosmetic-changes-around-none.patch ./configure --prefix=/usr \ --libdir=/usr/lib \ @@ -58,10 +64,3 @@ # delete stray empty dir, fixed upstream rm -r usr/share/man/ru } -md5sums=('208aa058f4117759d2939d1be7d662fc' - 'c4011222a19b020d9b8465c3c7e443f6' - '8c1bf7b10e22e2b835441e6ae2d804d6' - '7b92423c588ed35229a9a166349c29a9' - 'c483ab2d52609b5857d096b256a5075c' - 'e31037773db7f3244b71db434f60e6f0' - '2de5ae7916e79970e90bf06542e43d86') Added: libmount-cosmetic-changes-around-none.patch =================================================================== --- libmount-cosmetic-changes-around-none.patch (rev 0) +++ libmount-cosmetic-changes-around-none.patch 2012-03-04 21:47:12 UTC (rev 152118) @@ -0,0 +1,57 @@ +From 41d6af28c3475987a085dc085c2348e22dc7fbdd Mon Sep 17 00:00:00 2001 +From: Karel Zak <[email protected]> +Date: Fri, 2 Mar 2012 11:23:34 +0100 +Subject: [PATCH] libmount: cosmetic changes around "none" + +Signed-off-by: Karel Zak <[email protected]> +--- + libmount/src/context.c | 6 +++++- + libmount/src/context_mount.c | 7 +++++-- + 2 files changed, 10 insertions(+), 3 deletions(-) + +diff --git a/libmount/src/context.c b/libmount/src/context.c +index 1f30292..f97dd36 100644 +--- a/libmount/src/context.c ++++ b/libmount/src/context.c +@@ -1165,6 +1165,10 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt) + + src = mnt_fs_get_source(cxt->fs); + ++ if (!src && (cxt->mountflags & MS_PROPAGATION)) ++ /* mount --make-{shared,private,...} */ ++ return mnt_fs_set_source(cxt->fs, "none"); ++ + /* ignore filesystems without source or filesystems + * where the source is quasi-path (//foo/bar) + */ +@@ -1203,7 +1207,7 @@ int mnt_context_prepare_srcpath(struct libmnt_context *cxt) + + if ((cxt->mountflags & (MS_BIND | MS_MOVE | MS_PROPAGATION)) || + mnt_fs_is_pseudofs(cxt->fs)) { +- DBG(CXT, mnt_debug_h(cxt, "PROPAGATION/pseudo FS source: %s", path)); ++ DBG(CXT, mnt_debug_h(cxt, "BIND/MOVE/pseudo FS source: %s", path)); + return rc; + } + +diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c +index 098243b..c56ffd4 100644 +--- a/libmount/src/context_mount.c ++++ b/libmount/src/context_mount.c +@@ -453,9 +453,12 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type) + + if (!target) + return -EINVAL; +- if (!src) ++ if (!src) { ++ /* unnecessary, should be already resolved in ++ * mnt_context_prepare_srcpath(), but for sure... */ ++ DBG(CXT, mnt_debug_h(cxt, "WARNING: source is NULL -- using \"none\"!")); + src = "none"; +- ++ } + type = try_type ? : mnt_fs_get_fstype(cxt->fs); + + if (!(flags & MS_MGC_MSK)) +-- +1.7.9.2 + Added: libmount-don-t-treat-none-differently.patch =================================================================== --- libmount-don-t-treat-none-differently.patch (rev 0) +++ libmount-don-t-treat-none-differently.patch 2012-03-04 21:47:12 UTC (rev 152118) @@ -0,0 +1,107 @@ +From d0ce7c07e66f4e458d290083fdcf62218d151883 Mon Sep 17 00:00:00 2001 +From: Dave Reisner <[email protected]> +Date: Thu, 1 Mar 2012 22:47:00 -0500 +Subject: [PATCH] libmount: don't treat "none" differently + +This causes more problems than it solves. In the latest edition: + + # mount -t proc none foo + mount: foo: mount failed: Invalid argument + +A check for source and target fails in mnt_context_apply_fstab() +because, even though they were indeed specified on the cmdline, +__mnt_fs_set_source_ptr() altered this and NULL'd out the source. + +If you're able to mount this device via other means, other tools start +reporting oddities, such as mount's output: + + (null) on /foo type proc (rw,relatime) + +or findmnt: + + TARGET SOURCE FSTYPE OPTIONS + /foo proc rw,relatime + +Simply treat "none" like any other source when passed in. + +[[email protected]: - don't translate NULL to "none" in mnt_fs_set_source()] + +Signed-off-by: Dave Reisner <[email protected]> +Signed-off-by: Karel Zak <[email protected]> +--- + libmount/src/fs.c | 7 ++----- + libmount/src/tab.c | 7 +++---- + libmount/src/tab_parse.c | 7 +------ + 3 files changed, 6 insertions(+), 15 deletions(-) + +diff --git a/libmount/src/fs.c b/libmount/src/fs.c +index a28e66c..5e4139c 100644 +--- a/libmount/src/fs.c ++++ b/libmount/src/fs.c +@@ -304,11 +304,7 @@ int __mnt_fs_set_source_ptr(struct libmnt_fs *fs, char *source) + + assert(fs); + +- if (source && !strcmp(source, "none")) { +- free(source); +- source = NULL; +- +- } else if (source && strchr(source, '=')) { ++ if (source && strchr(source, '=')) { + if (blkid_parse_tag_string(source, &t, &v) != 0) + return -1; + } +@@ -341,6 +337,7 @@ int mnt_fs_set_source(struct libmnt_fs *fs, const char *source) + + if (!fs) + return -EINVAL; ++ + if (source) { + p = strdup(source); + if (!p) +diff --git a/libmount/src/tab.c b/libmount/src/tab.c +index 21b05c7..7dd9654 100644 +--- a/libmount/src/tab.c ++++ b/libmount/src/tab.c +@@ -480,9 +480,8 @@ struct libmnt_fs *mnt_table_find_target(struct libmnt_table *tb, const char *pat + * The 2nd, 3rd and 4th iterations are not performed when @tb cache is not + * set (see mnt_table_set_cache()). + * +- * Note that valid source path is NULL; the libmount uses NULL instead of +- * "none". The "none" is used in /proc/{mounts,self/mountninfo} for pseudo +- * filesystems. ++ * Note that NULL is a valid source path; it will be replaced with "none". The ++ * "none" is used in /proc/{mounts,self/mountinfo} for pseudo filesystems. + * + * Returns: a tab entry or NULL. + */ +@@ -505,7 +504,7 @@ struct libmnt_fs *mnt_table_find_srcpath(struct libmnt_table *tb, const char *pa + + p = mnt_fs_get_srcpath(fs); + +- if (path == NULL && src == NULL) ++ if (path == NULL && (src == NULL || !strcmp(src, "none"))) + return fs; /* source is "none" */ + if (path && p && streq_except_trailing_slash(p, path)) + return fs; +diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c +index 0f618bb..5bc55ae 100644 +--- a/libmount/src/tab_parse.c ++++ b/libmount/src/tab_parse.c +@@ -180,12 +180,7 @@ static int mnt_parse_mountinfo_line(struct libmnt_fs *fs, char *s) + unmangle_string(fs->vfs_optstr); + unmangle_string(fstype); + unmangle_string(src); +- +- if (!strcmp(fs->fs_optstr, "none")) { +- free(fs->fs_optstr); +- fs->fs_optstr = NULL; +- } else +- unmangle_string(fs->fs_optstr); ++ unmangle_string(fs->fs_optstr); + + rc = __mnt_fs_set_fstype_ptr(fs, fstype); + if (!rc) { +-- +1.7.9.2 + Added: mount-new-add-internal-only-i-to-non-root-allowed-op.patch =================================================================== --- mount-new-add-internal-only-i-to-non-root-allowed-op.patch (rev 0) +++ mount-new-add-internal-only-i-to-non-root-allowed-op.patch 2012-03-04 21:47:12 UTC (rev 152118) @@ -0,0 +1,32 @@ +From 50d0ad9875af9e478cd2577ac42041b16170a691 Mon Sep 17 00:00:00 2001 +From: Raghavendra D Prabhu <[email protected]> +Date: Sun, 26 Feb 2012 16:36:42 +0530 +Subject: [PATCH] mount: (new) add 'internal-only(i)' to non-root allowed + options + +Commit ce433404 introduced the change, which causes something like mount -i +<user-mount-path> to break which worked well before util-linux-2.21, now it +gives message 'mount: only root can use "--internal-only" option' when that +shouldn't be the case when it is already in fstab. + +Signed-off-by: Raghavendra D Prabhu <[email protected]> +--- + sys-utils/mount.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sys-utils/mount.c b/sys-utils/mount.c +index 23abc91..8f5dcdb 100644 +--- a/sys-utils/mount.c ++++ b/sys-utils/mount.c +@@ -712,7 +712,7 @@ int main(int argc, char **argv) + longopts, NULL)) != -1) { + + /* only few options are allowed for non-root users */ +- if (mnt_context_is_restricted(cxt) && !strchr("hlLUVvpr", c)) ++ if (mnt_context_is_restricted(cxt) && !strchr("hlLUVvpri", c)) + exit_non_root(option_to_longopt(c, longopts)); + + switch(c) { +-- +1.7.9.2 +
