From db855d07b8628cb876082f9b2cb481234dd54b14 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 22 May 2023 15:57:23 +0200 Subject: [PATCH] 2.39-3: fix mount options --- ...x-options-prepend-insert-and-merging.patch | 49 +++++++++++++++++++ util-linux.spec | 8 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 libmount-fix-options-prepend-insert-and-merging.patch diff --git a/libmount-fix-options-prepend-insert-and-merging.patch b/libmount-fix-options-prepend-insert-and-merging.patch new file mode 100644 index 0000000..b44c435 --- /dev/null +++ b/libmount-fix-options-prepend-insert-and-merging.patch @@ -0,0 +1,49 @@ +From c0267687fd7b41b00d523d1985182d7eb574effd Mon Sep 17 00:00:00 2001 +From: Karel Zak +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 +--- + libmount/src/optlist.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libmount/src/optlist.c b/libmount/src/optlist.c +index a8c1ad89a..f74e75928 100644 +--- 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); +-- +2.40.1 + diff --git a/util-linux.spec b/util-linux.spec index d664c02..209326a 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: Collection of basic system utilities Name: util-linux Version: 2.39 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain URL: https://en.wikipedia.org/wiki/Util-linux @@ -98,6 +98,9 @@ Patch0: login-lastlog-create.patch # https://github.com/coreos/console-login-helper-messages/issues/60 Patch1: login-default-motd-file.patch +### Upstream patches +Patch2: libmount-fix-options-prepend-insert-and-merging.patch + %description The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among @@ -925,6 +928,9 @@ fi %changelog +* Mon May 22 2023 Karel Zak - 2.39-3 +- fix mount options prepend/insert and merging (upstream) + * Thu May 18 2023 Adam Williamson - 2.39-2 - Have util-linux obsolete and provide util-linux-user