From 79f19dda889055ade26693974d543c33eafdfc45 Mon Sep 17 00:00:00 2001 From: wh02252983 Date: Tue, 19 Aug 2025 15:52:42 +0800 Subject: [PATCH] [bugfix] backport community patches To #N/A backport community patches Project: #N/A Signed-off-by: wh02252983 wh02252983@alibaba-inc.com --- ...e-some-MS_-flags-as-superblock-flags.patch | 104 +++++++++++ 0005-libmount-cleanup-fake-mode.patch | 161 ++++++++++++++++++ 0006-libmount-utils-fix-statx-fallback.patch | 36 ++++ 0007-libmount-ifdef-statx-call.patch | 55 ++++++ ...ibmount-improve-EPERM-interpretation.patch | 48 ++++++ 0009-column-fix-l.patch | 109 ++++++++++++ util-linux.spec | 18 +- 7 files changed, 529 insertions(+), 2 deletions(-) create mode 100644 0004-libmount-use-some-MS_-flags-as-superblock-flags.patch create mode 100644 0005-libmount-cleanup-fake-mode.patch create mode 100644 0006-libmount-utils-fix-statx-fallback.patch create mode 100644 0007-libmount-ifdef-statx-call.patch create mode 100644 0008-libmount-improve-EPERM-interpretation.patch create mode 100644 0009-column-fix-l.patch diff --git a/0004-libmount-use-some-MS_-flags-as-superblock-flags.patch b/0004-libmount-use-some-MS_-flags-as-superblock-flags.patch new file mode 100644 index 0000000..1242ddd --- /dev/null +++ b/0004-libmount-use-some-MS_-flags-as-superblock-flags.patch @@ -0,0 +1,104 @@ +From 54e4a6b145fd6ef943d93e16de748283e687855d Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 20 Jul 2023 12:34:14 +0200 +Subject: [PATCH] libmount: use some MS_* flags as superblock flags + +The old mount(2) API usually utilizes MS_* flags to set up the VFS +node. However, there are some exceptions like "sync" (MS_SYNCHRONOUS), +where the flag is used (by kernel) for the superblock instead. The new +API addresses this issue, ensuring that these options are used for +fsconfig(). + +This commit introduces MNT_SUPERBLOCK to identify these options in the +libmount options Linux map, and it enforces the new mount code to +utilize these options for fsconfig(FSCONFIG_SET_FLAG). + +Reported-by: Abbink Esger +Signed-off-by: Karel Zak +--- + libmount/src/hook_mount.c | 11 +++++++++-- + libmount/src/libmount.h.in | 1 + + libmount/src/optmap.c | 14 +++++++------- + 3 files changed, 17 insertions(+), 9 deletions(-) + +diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c +index 77a7bed30..ed4ec349c 100644 +--- a/libmount/src/hook_mount.c ++++ b/libmount/src/hook_mount.c +@@ -154,12 +154,19 @@ static int configure_superblock(struct libmnt_context *cxt, + const char *name = mnt_opt_get_name(opt); + const char *value = mnt_opt_get_value(opt); + const struct libmnt_optmap *ent = mnt_opt_get_mapent(opt); ++ const int is_linux = ent && mnt_opt_get_map(opt) == cxt->map_linux; + +- if (ent && mnt_opt_get_map(opt) == cxt->map_linux && +- ent->id == MS_RDONLY) { ++ if (is_linux && ent->id == MS_RDONLY) { ++ /* Use ro/rw for superblock (for backward compatibility) */ + value = NULL; + has_rwro = 1; ++ ++ } else if (is_linux && ent->mask & MNT_SUPERBLOCK) { ++ /* Use some old MS_* (VFS) flags as superblock flags */ ++ ; ++ + } else if (!name || mnt_opt_get_map(opt) || mnt_opt_is_external(opt)) ++ /* Ignore VFS flags, userspace and external options */ + continue; + + rc = fsconfig_set_value(cxt, hs, fd, name, value); +diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in +index f156483b6..06c27047d 100644 +--- a/libmount/src/libmount.h.in ++++ b/libmount/src/libmount.h.in +@@ -89,6 +89,7 @@ struct libmnt_optmap + #define MNT_PREFIX (1 << 3) /* prefix used for some options (e.g. "x-foo") */ + #define MNT_NOHLPS (1 << 4) /* don't add the option to mount. helpers command line */ + #define MNT_NOFSTAB (1 << 5) /* not expected in fstab */ ++#define MNT_SUPERBLOCK (1 << 6) /* MS_* for mount(2), otherwise requires fsconfig() */ + + /** + * libmnt_fs: +diff --git a/libmount/src/optmap.c b/libmount/src/optmap.c +index 3a91f30d4..d7569a0f0 100644 +--- a/libmount/src/optmap.c ++++ b/libmount/src/optmap.c +@@ -79,10 +79,10 @@ static const struct libmnt_optmap linux_flags_map[] = + { "dev", MS_NODEV, MNT_INVERT }, /* interpret device files */ + { "nodev", MS_NODEV }, /* don't interpret devices */ + +- { "sync", MS_SYNCHRONOUS }, /* synchronous I/O */ +- { "async", MS_SYNCHRONOUS, MNT_INVERT },/* asynchronous I/O */ ++ { "sync", MS_SYNCHRONOUS, MNT_SUPERBLOCK }, /* synchronous I/O */ ++ { "async", MS_SYNCHRONOUS, MNT_INVERT | MNT_SUPERBLOCK },/* asynchronous I/O */ + +- { "dirsync", MS_DIRSYNC }, /* synchronous directory modifications */ ++ { "dirsync", MS_DIRSYNC, MNT_SUPERBLOCK },/* synchronous directory modifications */ + { "remount", MS_REMOUNT, MNT_NOMTAB }, /* alter flags of mounted FS */ + { "bind", MS_BIND }, /* Remount part of the tree elsewhere */ + { "rbind", MS_BIND | MS_REC }, /* Idem, plus mounted subtrees */ +@@ -95,8 +95,8 @@ static const struct libmnt_optmap linux_flags_map[] = + { "loud", MS_SILENT, MNT_INVERT }, /* print out messages. */ + #endif + #ifdef MS_MANDLOCK +- { "mand", MS_MANDLOCK }, /* Allow mandatory locks on this FS */ +- { "nomand", MS_MANDLOCK, MNT_INVERT }, /* Forbid mandatory locks on this FS */ ++ { "mand", MS_MANDLOCK, MNT_SUPERBLOCK }, /* Allow mandatory locks on this FS */ ++ { "nomand", MS_MANDLOCK, MNT_INVERT | MNT_SUPERBLOCK}, /* Forbid mandatory locks on this FS */ + #endif + #ifdef MS_NOATIME + { "atime", MS_NOATIME, MNT_INVERT }, /* Update access time */ +@@ -119,8 +119,8 @@ static const struct libmnt_optmap linux_flags_map[] = + { "nostrictatime", MS_STRICTATIME, MNT_INVERT }, /* kernel default atime */ + #endif + #ifdef MS_LAZYTIME +- { "lazytime", MS_LAZYTIME }, /* Update {a,m,c}time on the in-memory inode only */ +- { "nolazytime", MS_LAZYTIME, MNT_INVERT }, ++ { "lazytime", MS_LAZYTIME, MNT_SUPERBLOCK }, /* Update {a,m,c}time on the in-memory inode only */ ++ { "nolazytime", MS_LAZYTIME, MNT_INVERT | MNT_SUPERBLOCK }, + #endif + #ifdef MS_PROPAGATION + { "unbindable", MS_UNBINDABLE, MNT_NOHLPS | MNT_NOMTAB }, /* Unbindable */ +-- +2.33.0 + diff --git a/0005-libmount-cleanup-fake-mode.patch b/0005-libmount-cleanup-fake-mode.patch new file mode 100644 index 0000000..a1a1526 --- /dev/null +++ b/0005-libmount-cleanup-fake-mode.patch @@ -0,0 +1,161 @@ +From 99358137968bca95962be0513bd8e7a656514991 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 1 Aug 2023 14:49:48 +0200 +Subject: [PATCH] libmount: cleanup --fake mode + +It was originally designed to play nasty games with /etc/mtab (mount +when /etc is read-only and update later when it's write-able). + +The --fake is completely useless with the new API due to complexity +where we cannot skip any step, because the next stuff depends on it. +So, it makes more sense skip all functionality where libmount does +anything significant. + +This commit add --fake check to hooks logic to skip all hooks as the +hooks are place where libmount implements mount related invasive +operations (create mountpoint, namespaces, create superblock, move, +mount, etc.). + +Frankly, --fake without mtab is useless. + +Fixes: https://kkgithub.com/util-linux/util-linux/issues/2395 +Signed-off-by: Karel Zak +--- + libmount/src/context_mount.c | 5 +++++ + libmount/src/hook_mount.c | 7 ------- + libmount/src/hook_mount_legacy.c | 18 ------------------ + libmount/src/hooks.c | 12 ++++++++++-- + sys-utils/mount.8.adoc | 6 +++++- + 5 files changed, 20 insertions(+), 28 deletions(-) + +diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c +index 0b1e2553018..f7e28095458 100644 +--- a/libmount/src/context_mount.c ++++ b/libmount/src/context_mount.c +@@ -541,6 +541,11 @@ static int do_mount(struct libmnt_context *cxt, const char *try_type) + if (!rc) + rc = mnt_context_call_hooks(cxt, MNT_STAGE_MOUNT); + ++ if (rc == 0 && mnt_context_is_fake(cxt)) { ++ DBG(CXT, ul_debugobj(cxt, "FAKE (-f) set status=0")); ++ cxt->syscall_status = 0; ++ } ++ + if (org_type && rc != 0) + __mnt_fs_set_fstype_ptr(cxt->fs, org_type); + org_type = NULL; +diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c +index ed4ec349ca3..d69a018ecc1 100644 +--- a/libmount/src/hook_mount.c ++++ b/libmount/src/hook_mount.c +@@ -576,9 +576,6 @@ static int init_sysapi(struct libmnt_context *cxt, + if (!api) + return -ENOMEM; + +- if (mnt_context_is_fake(cxt)) +- goto fake; +- + if (path) { + api->fd_tree = open_mount_tree(cxt, path, flags); + if (api->fd_tree < 0) +@@ -611,10 +608,6 @@ static int init_sysapi(struct libmnt_context *cxt, + fail: + DBG(HOOK, ul_debugobj(hs, "init fs/tree failed [errno=%d %m]", errno)); + return -errno; +-fake: +- DBG(CXT, ul_debugobj(cxt, " FAKE (-f)")); +- cxt->syscall_status = 0; +- return 0; + } + + static int force_classic_mount(struct libmnt_context *cxt) +diff --git a/libmount/src/hook_mount_legacy.c b/libmount/src/hook_mount_legacy.c +index 2c07a015b8c..7e62864673a 100644 +--- a/libmount/src/hook_mount_legacy.c ++++ b/libmount/src/hook_mount_legacy.c +@@ -61,12 +61,6 @@ static int hook_propagation(struct libmnt_context *cxt, + hd->flags, + hd->flags & MS_REC ? " (recursive)" : "")); + +- if (mnt_context_is_fake(cxt)) { +- DBG(CXT, ul_debugobj(cxt, " FAKE (-f)")); +- cxt->syscall_status = 0; +- return 0; +- } +- + /* + * hd->flags are propagation flags as set in prepare_propagation() + * +@@ -156,12 +150,6 @@ static int hook_bindremount(struct libmnt_context *cxt, + hd->flags, + hd->flags & MS_REC ? " (recursive)" : "")); + +- if (mnt_context_is_fake(cxt)) { +- DBG(CXT, ul_debugobj(cxt, " FAKE (-f)")); +- cxt->syscall_status = 0; +- return 0; +- } +- + if (mnt_optlist_is_silent(cxt->optlist)) + extra |= MS_SILENT; + +@@ -251,12 +239,6 @@ static int hook_mount(struct libmnt_context *cxt, + options ? (cxt->flags & MNT_FL_MOUNTDATA) ? "binary" : + options : "")); + +- if (mnt_context_is_fake(cxt)) { +- DBG(HOOK, ul_debugobj(hs, " FAKE (-f)")); +- cxt->syscall_status = 0; +- return 0; +- } +- + if (mount(src, target, type, flags, options)) { + cxt->syscall_status = -errno; + cxt->syscall_name = "mount"; +diff --git a/libmount/src/hooks.c b/libmount/src/hooks.c +index 88cf68d6111..2d791626058 100644 +--- a/libmount/src/hooks.c ++++ b/libmount/src/hooks.c +@@ -313,7 +313,12 @@ int mnt_context_has_hook(struct libmnt_context *cxt, + + static int call_hook(struct libmnt_context *cxt, struct hookset_hook *hook) + { +- int rc = hook->func(cxt, hook->hookset, hook->data); ++ int rc = 0; ++ ++ if (mnt_context_is_fake(cxt)) ++ DBG(CXT, ul_debugobj(cxt, " FAKE call")); ++ else ++ rc = hook->func(cxt, hook->hookset, hook->data); + + hook->executed = 1; + if (!rc) +@@ -359,7 +364,10 @@ int mnt_context_call_hooks(struct libmnt_context *cxt, int stage) + + DBG(CXT, ul_debugobj(cxt, "calling %s [first]", hs->name)); + +- rc = hs->firstcall(cxt, hs, NULL); ++ if (mnt_context_is_fake(cxt)) ++ DBG(CXT, ul_debugobj(cxt, " FAKE call")); ++ else ++ rc = hs->firstcall(cxt, hs, NULL); + if (!rc) + rc = call_depend_hooks(cxt, hs->name, stage); + if (rc < 0) +diff --git a/sys-utils/mount.8.adoc b/sys-utils/mount.8.adoc +index 60661d83be5..71e372317aa 100644 +--- a/sys-utils/mount.8.adoc ++++ b/sys-utils/mount.8.adoc +@@ -325,7 +325,11 @@ Note that *mount* does not pass this option to the **/sbin/mount.**__type__ help + (Used in conjunction with *-a*.) Fork off a new incarnation of *mount* for each device. This will do the mounts on different devices or different NFS servers in parallel. This has the advantage that it is faster; also NFS timeouts proceed in parallel. A disadvantage is that the order of the mount operations is undefined. Thus, you cannot use this option if you want to mount both _/usr_ and _/usr/spool_. + + *-f, --fake*:: +-Causes everything to be done except for the actual system call; if it's not obvious, this "fakes" mounting the filesystem. This option is useful in conjunction with the *-v* flag to determine what the *mount* command is trying to do. It can also be used to add entries for devices that were mounted earlier with the *-n* option. The *-f* option checks for an existing record in _/etc/mtab_ and fails when the record already exists (with a regular non-fake mount, this check is done by the kernel). ++Causes everything to be done except for the mount-related system calls. The --fake option was originally designed to write an entry to /etc/mtab without actually mounting. +++ ++The /etc/mtab is no longer maintained in userspace, and starting from version 2.39, the mount operation can be a complex chain of operations with dependencies between the syscalls. The --fake option forces libmount to skip all mount source preparation, mount option analysis, and the actual mounting process. +++ ++The difference between fake and non-fake execution is huge. This is the reason why the --fake option has minimal significance for the current mount(8) implementation and it is maintained mostly for backward compatibility. + + *-i, --internal-only*:: + Don't call the **/sbin/mount.**__filesystem__ helper even if it exists. diff --git a/0006-libmount-utils-fix-statx-fallback.patch b/0006-libmount-utils-fix-statx-fallback.patch new file mode 100644 index 0000000..4d53642 --- /dev/null +++ b/0006-libmount-utils-fix-statx-fallback.patch @@ -0,0 +1,36 @@ +From 03435a7c65538f02e249ff099c3c55ca4d791301 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= +Date: Thu, 3 Aug 2023 07:13:28 +0200 +Subject: [PATCH] libmount: (utils) fix statx fallback +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If the systemcall is not available ENOSYS is returned. + +Under glibc the statx implementation also has its own fallback logic. +As AT_STATX_DONT_SYNC can't be implemented correctly in that fallback +logic the wrapper will return EINVAL in case the emulation is needed and +AT_STATX_DONT_SYNC is set. +So also use our own fallback in that case. + +Fixes: #2409 +Signed-off-by: Thomas Weißschuh +--- + libmount/src/utils.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libmount/src/utils.c b/libmount/src/utils.c +index 50553f1d5a1..410ded4aa27 100644 +--- a/libmount/src/utils.c ++++ b/libmount/src/utils.c +@@ -133,7 +133,8 @@ static int safe_stat(const char *target, struct stat *st, int nofollow) + st->st_mode = stx.stx_mode; + } + +- if (rc == 0 || errno != EOPNOTSUPP) ++ if (rc == 0 || ++ (errno != EOPNOTSUPP && errno != ENOSYS && errno != EINVAL)) + return rc; + } + #endif diff --git a/0007-libmount-ifdef-statx-call.patch b/0007-libmount-ifdef-statx-call.patch new file mode 100644 index 0000000..b1bebab --- /dev/null +++ b/0007-libmount-ifdef-statx-call.patch @@ -0,0 +1,55 @@ +From ce266c9e168d4f88ae04fea3f9984deb9d9a5dfd Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 3 Aug 2023 12:39:19 +0200 +Subject: [PATCH] libmount: ifdef statx() call + +In this case the statx() is use to get mount ID. It's optional and not +required. Let's #ifdef the statx() call and also check for stx_mnt_id +struct member. + +Fixes: https://github.com/util-linux/util-linux/issues/2415 +Signed-off-by: Karel Zak +--- + configure.ac | 5 ++++- + libmount/src/hook_mount.c | 2 ++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index 13eb6c1e6..b075f0265 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -514,7 +514,10 @@ AC_CHECK_MEMBERS([struct termios.c_line],,, + [[#include ]]) + + AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec],,, +- [#include ]) ++ [[#include ]]) ++ ++AC_CHECK_MEMBERS([struct statx.stx_mnt_id],,, ++ [[#include ]]) + + AC_CHECK_DECLS([_NL_TIME_WEEK_1STDAY],[],[],[[#include ]]) + +diff --git a/libmount/src/hook_mount.c b/libmount/src/hook_mount.c +index d69a018ec..056338c49 100644 +--- a/libmount/src/hook_mount.c ++++ b/libmount/src/hook_mount.c +@@ -294,6 +294,7 @@ static int hook_create_mount(struct libmnt_context *cxt, + /* cleanup after fail (libmount may only try the FS type) */ + close_sysapi_fds(api); + ++#if defined(HAVE_STRUCT_STATX) && defined(HAVE_STRUCT_STATX_STX_MNT_ID) + if (!rc && cxt->fs) { + struct statx st; + +@@ -306,6 +307,7 @@ static int hook_create_mount(struct libmnt_context *cxt, + fs->id = cxt->fs->id; + } + } ++#endif + + done: + DBG(HOOK, ul_debugobj(hs, "create FS done [rc=%d, id=%d]", rc, cxt->fs ? cxt->fs->id : -1)); +-- +2.33.0 + diff --git a/0008-libmount-improve-EPERM-interpretation.patch b/0008-libmount-improve-EPERM-interpretation.patch new file mode 100644 index 0000000..c8836e8 --- /dev/null +++ b/0008-libmount-improve-EPERM-interpretation.patch @@ -0,0 +1,48 @@ +From d14d39cbdd41eeb17401e9e64e240d7cb54e0516 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Thu, 3 Aug 2023 13:06:30 +0200 +Subject: [PATCH] libmount: improve EPERM interpretation + +In some cases mount(2)/open_tree(2) returns EPERM for root user. In +this case libmount reports it as "mount point is not a directory". + +It does not makes sense for bind mount where target could be a +regular file. + +This patch is not ideal, the error handler is generic, but semantic +for new mount API and mount(2) is different. For example now it checks +for regular file, but the new API supports bind over symlinks, so +proper fix will require lstat() and S_ISLNK(), etc. We need to move +error messages to hook_mount.c and mount_mount_legacy.c to make it +more specific. + +Fixes: https://github.com/util-linux/util-linux/issues/2413 +Signed-off-by: Karel Zak +--- + libmount/src/context_mount.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c +index f7e280954..41986e74b 100644 +--- a/libmount/src/context_mount.c ++++ b/libmount/src/context_mount.c +@@ -1577,10 +1577,13 @@ int mnt_context_get_mount_excode( + if (!buf) + break; + if (geteuid() == 0) { +- if (mnt_safe_stat(tgt, &st) || !S_ISDIR(st.st_mode)) +- snprintf(buf, bufsz, _("mount point is not a directory")); +- else ++ ++ if (mnt_safe_stat(tgt, &st) == 0 ++ && ((mflags & MS_BIND && S_ISREG(st.st_mode)) ++ || S_ISDIR(st.st_mode))) + snprintf(buf, bufsz, _("permission denied")); ++ else ++ snprintf(buf, bufsz, _("mount point is not a directory")); + } else + snprintf(buf, bufsz, _("must be superuser to use mount")); + break; +-- +2.43.0 + diff --git a/0009-column-fix-l.patch b/0009-column-fix-l.patch new file mode 100644 index 0000000..5c4d94f --- /dev/null +++ b/0009-column-fix-l.patch @@ -0,0 +1,109 @@ +From 6dd30a72e7074493152e8ef9c76759218f489985 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Wed, 2 Aug 2023 12:57:37 +0200 +Subject: [PATCH] column: fix -l +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The original implementation is complicated and broken. + +It's possible to calculate the rest of the string (for the last +column) from the current position rather than calculate it +continuously. Use the last wcstok() result also means that it will +work as expected independently on "greedy" mode (skips repeating +separators. + + # printf 'a b c d\n1 2 3 4\n' | ./column -t -o '|' -l3 + a|b|c d + 1|2|3 4 + +(see space between 'a' and 'b' on input) + +References: 8ac75e31de0ece74515e98e0b22e54cc0a9808bd +Fixes: https://github.com/util-linux/util-linux/issues/1763 +Signed-off-by: Karel Zak + +Reference:https://github.com/util-linux/util-linux/commit/6dd30a72e7074493152e8ef9c76759218f489985 +Conflict:NA +--- + text-utils/column.c | 37 ++++++++++++++++--------------------- + 1 file changed, 16 insertions(+), 21 deletions(-) + +diff --git a/text-utils/column.c b/text-utils/column.c +index 88d46b9..79245cd 100644 +--- a/text-utils/column.c ++++ b/text-utils/column.c +@@ -471,37 +471,33 @@ static void modify_table(struct column_control *ctl) + + static int add_line_to_table(struct column_control *ctl, wchar_t *wcs0) + { +- wchar_t *wcdata, *sv = NULL, *wcs = wcs0; +- size_t n = 0, nchars = 0, skip = 0, len; ++ wchar_t *sv = NULL, *wcs = wcs0, *all = NULL; ++ size_t n = 0; + struct libscols_line *ln = NULL; + ++ + if (!ctl->tab) + init_table(ctl); + +- len = wcslen(wcs0); ++ if (ctl->maxncols) { ++ all = wcsdup(wcs0); ++ if (!all) ++ err(EXIT_FAILURE, _("failed to allocate input line")); ++ } + + do { + char *data; ++ wchar_t *wcdata = local_wcstok(ctl, wcs, &sv); ++ ++ if (!wcdata) ++ break; + + if (ctl->maxncols && n + 1 == ctl->maxncols) { +- if (nchars + skip < len) +- wcdata = wcs0 + (nchars + skip); +- else +- wcdata = NULL; +- } else { +- wcdata = local_wcstok(ctl, wcs, &sv); +- +- /* For the default separator ('greedy' mode) it uses +- * strtok() and it skips leading white chars. In this +- * case we need to remember size of the ignored white +- * chars due to wcdata calculation in maxncols case */ +- if (wcdata && ctl->greedy +- && n == 0 && nchars == 0 && wcdata > wcs) +- skip = wcdata - wcs; ++ /* Use rest of the string as column data */ ++ size_t skip = wcdata - wcs0; ++ wcdata = all + skip; + } + +- if (!wcdata) +- break; + if (scols_table_get_ncols(ctl->tab) < n + 1) { + if (scols_table_is_json(ctl->tab) && !ctl->hide_unnamed) + errx(EXIT_FAILURE, _("line %zu: for JSON the name of the " +@@ -517,8 +513,6 @@ static int add_line_to_table(struct column_control *ctl, wchar_t *wcs0) + err(EXIT_FAILURE, _("failed to allocate output line")); + } + +- nchars += wcslen(wcdata) + 1; +- + data = wcs_to_mbs(wcdata); + if (!data) + err(EXIT_FAILURE, _("failed to allocate output data")); +@@ -530,6 +524,7 @@ static int add_line_to_table(struct column_control *ctl, wchar_t *wcs0) + break; + } while (1); + ++ free(all); + return 0; + } + +-- +2.33.0 + diff --git a/util-linux.spec b/util-linux.spec index 37887b1..3ed25ae 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 5 Summary: Collection of basic system utilities Name: util-linux @@ -99,7 +99,18 @@ Patch2: libmount-Fix-regression-when-mounting-with-atime.patch Patch3: 0001-fix-CVE-2024-28085.patch Patch4: 0002-Add-Phytium-FTC862-cpu-model.patch Patch5: 0003-Add-Phytium-FTC310-FTC664-support.patch - +# https://github.com/util-linux/util-linux/commit/e5858dbb6b3bc85d0b4f1f38b8016c67940b21b0 +Patch6: 0004-libmount-use-some-MS_-flags-as-superblock-flags.patch +# https://github.com/util-linux/util-linux/commit/99358137968bca95962be0513bd8e7a656514991 +Patch7: 0005-libmount-cleanup-fake-mode.patch +# https://github.com/util-linux/util-linux/commit/03435a7c65538f02e249ff099c3c55ca4d791301 +Patch8: 0006-libmount-utils-fix-statx-fallback.patch +# https://github.com/util-linux/util-linux/commit/ce266c9e168d4f88ae04fea3f9984deb9d9a5dfd +Patch9: 0007-libmount-ifdef-statx-call.patch +# https://github.com/util-linux/util-linux/commit/d14d39cbdd41eeb17401e9e64e240d7cb54e0516 +Patch10: 0008-libmount-improve-EPERM-interpretation.patch +# https://github.com/util-linux/util-linux/commit/140404e1fd22705c3a6972378b17af5e5ea87432 +Patch11: 0009-column-fix-l.patch %description The util-linux package contains a large variety of low-level system @@ -886,6 +897,9 @@ fi %changelog +* Tue Aug 19 2025 wh02252983 - 2.39.1-5 +- backport community patches + * Tue Jul 22 2025 mgb01105731 - 2.39.1-4 - Fix conflicts with shadow -- Gitee