commit:     5ef0405e6d22915b93da87d5eb77ff132ca6da14
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May 23 03:13:09 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May 23 03:13:20 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ef0405e

sys-apps/util-linux: backport another mount regression fix (user option parsing)

Closes: https://bugs.gentoo.org/906859
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../util-linux-2.39-mount-parse-options-user.patch | 46 ++++++++++++++++++++++
 sys-apps/util-linux/util-linux-2.39-r2.ebuild      |  1 +
 2 files changed, 47 insertions(+)

diff --git 
a/sys-apps/util-linux/files/util-linux-2.39-mount-parse-options-user.patch 
b/sys-apps/util-linux/files/util-linux-2.39-mount-parse-options-user.patch
new file mode 100644
index 000000000000..e02d02c7f503
--- /dev/null
+++ b/sys-apps/util-linux/files/util-linux-2.39-mount-parse-options-user.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/906797#c4
+https://bugs.gentoo.org/906859
+https://github.com/util-linux/util-linux/issues/2238
+https://github.com/util-linux/util-linux/commit/c0267687fd7b41b00d523d1985182d7eb574effd
+
+From c0267687fd7b41b00d523d1985182d7eb574effd Mon Sep 17 00:00:00 2001
+From: Karel Zak <[email protected]>
+Date: Mon, 22 May 2023 15:00:25 +0200
+Subject: [PATCH] libmount: fix options prepend/insert and merging
+
+ * the order of the new options should not be changed
+   (for example prepend "a,b,c" to list with "d" has to generate "a,b,c,d", 
not "c,b,a,d")
+
+ * make sure that  options map is defined when merging options
+
+Fixes: https://github.com/util-linux/util-linux/issues/2238
+Signed-off-by: Karel Zak <[email protected]>
+--- a/libmount/src/optlist.c
++++ b/libmount/src/optlist.c
+@@ -338,6 +338,7 @@ int mnt_optlist_merge_opts(struct libmnt_optlist *ls)
+ 
+                       /* remove inverted option */
+                       else if (opt->ent && x->ent
++                          && opt->map == x->map
+                           && opt->ent->id == x->ent->id
+                           && (opt->ent->mask & MNT_INVERT
+                                   || x->ent->mask & MNT_INVERT))
+@@ -520,6 +521,8 @@ static int optlist_add_optstr(struct libmnt_optlist *ls, 
const char *optstr,
+               if (!opt)
+                       return -ENOMEM;
+               opt->src = MNT_OPTSRC_STRING;
++              if (where)
++                      where = &opt->opts;
+       }
+ 
+       optlist_cleanup_cache(ls);
+@@ -622,6 +625,8 @@ static int optlist_add_flags(struct libmnt_optlist *ls, 
unsigned long flags,
+               if (!opt)
+                       return -ENOMEM;
+               opt->src = MNT_OPTSRC_FLAG;
++              if (where)
++                      where = &opt->opts;
+       }
+ 
+       optlist_cleanup_cache(ls);
+

diff --git a/sys-apps/util-linux/util-linux-2.39-r2.ebuild 
b/sys-apps/util-linux/util-linux-2.39-r2.ebuild
index 43dd41681342..edd0dd68e804 100644
--- a/sys-apps/util-linux/util-linux-2.39-r2.ebuild
+++ b/sys-apps/util-linux/util-linux-2.39-r2.ebuild
@@ -97,6 +97,7 @@ RESTRICT="!test? ( test )"
 PATCHES=(
        "${FILESDIR}/${PN}-2.39-check-for-mount_setattr.patch"
        "${FILESDIR}/${PN}-2.39-tests-for-mount_setattr.patch"
+       "${FILESDIR}/${PN}-2.39-mount-parse-options-user.patch"
 )
 
 pkg_pretend() {

Reply via email to