diff --git a/system/base/util-linux/files/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/system/base/util-linux/files/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch deleted file mode 100644 index 9d624f2d..00000000 --- a/system/base/util-linux/files/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 4 Feb 2020 15:11:19 +0100 -Subject: [PATCH] libfdisk: (script) accept sector-size, ignore unknown headers - -- add sector-size between supported headers (already in --dump output) - -- report unknown headers by -ENOTSUP - -- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file() - -Addresses: https://github.com/karelzak/util-linux/issues/949 -Signed-off-by: Karel Zak ---- - disk-utils/sfdisk.c | 6 +++++- - libfdisk/src/script.c | 49 +++++++++++++++++++++++-------------------- - 2 files changed, 31 insertions(+), 24 deletions(-) - -diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c -index bb6e1c6df..c0bea7046 100644 ---- a/disk-utils/sfdisk.c -+++ b/disk-utils/sfdisk.c -@@ -1782,7 +1782,11 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - } - - rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf)); -- if (rc < 0) { -+ if (rc == -ENOTSUP) { -+ buf[sizeof(buf) - 1] = '\0'; -+ fdisk_warnx(sf->cxt, _("Unknown script header '%s' -- ignore."), buf); -+ continue; -+ } else if (rc < 0) { - DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands")); - buf[sizeof(buf) - 1] = '\0'; - rc = loop_control_commands(sf, dp, buf); -diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c -index a21771b6a..d3e67fa9c 100644 ---- a/libfdisk/src/script.c -+++ b/libfdisk/src/script.c -@@ -805,8 +805,12 @@ static inline int is_header_line(const char *s) - /* parses ": value", note modifies @s*/ - static int parse_line_header(struct fdisk_script *dp, char *s) - { -- int rc = -EINVAL; -+ size_t i; - char *name, *value; -+ static const char *supported[] = { -+ "label", "unit", "label-id", "device", "grain", -+ "first-lba", "last-lba", "table-length", "sector-size" -+ }; - - DBG(SCRIPT, ul_debugobj(dp, " parse header '%s'", s)); - -@@ -816,7 +820,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s) - name = s; - value = strchr(s, ':'); - if (!value) -- goto done; -+ return -EINVAL; - *value = '\0'; - value++; - -@@ -825,32 +829,30 @@ static int parse_line_header(struct fdisk_script *dp, char *s) - ltrim_whitespace((unsigned char *) value); - rtrim_whitespace((unsigned char *) value); - -+ if (!*name || !*value) -+ return -EINVAL; -+ -+ /* check header name */ -+ for (i = 0; i < ARRAY_SIZE(supported); i++) { -+ if (strcmp(name, supported[i]) == 0) -+ break; -+ } -+ if (i == ARRAY_SIZE(supported)) -+ return -ENOTSUP; -+ -+ /* header specific actions */ - if (strcmp(name, "label") == 0) { - if (dp->cxt && !fdisk_get_label(dp->cxt, value)) -- goto done; /* unknown label name */ -+ return -EINVAL; /* unknown label name */ - dp->force_label = 1; -+ - } else if (strcmp(name, "unit") == 0) { - if (strcmp(value, "sectors") != 0) -- goto done; /* only "sectors" supported */ -- } else if (strcmp(name, "label-id") == 0 -- || strcmp(name, "device") == 0 -- || strcmp(name, "grain") == 0 -- || strcmp(name, "first-lba") == 0 -- || strcmp(name, "last-lba") == 0 -- || strcmp(name, "table-length") == 0) { -- ; /* whatever is possible */ -- } else -- goto done; /* unknown header */ -+ return -EINVAL; /* only "sectors" supported */ - -- if (*name && *value) -- rc = fdisk_script_set_header(dp, name, value); --done: -- if (rc) -- DBG(SCRIPT, ul_debugobj(dp, "header parse error: " -- "[rc=%d, name='%s', value='%s']", -- rc, name, value)); -- return rc; -+ } - -+ return fdisk_script_set_header(dp, name, value); - } - - /* returns zero terminated string with next token and @str is updated */ -@@ -1363,7 +1365,8 @@ int fdisk_script_set_fgets(struct fdisk_script *dp, - * - * Reads next line into dump. - * -- * Returns: 0 on success, <0 on error, 1 when nothing to read. -+ * Returns: 0 on success, <0 on error, 1 when nothing to read. For unknown headers -+ * returns -ENOTSUP, it's usually safe to ignore this error. - */ - int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz) - { -@@ -1428,7 +1431,7 @@ int fdisk_script_read_file(struct fdisk_script *dp, FILE *f) - - while (!feof(f)) { - rc = fdisk_script_read_line(dp, f, buf, sizeof(buf)); -- if (rc) -+ if (rc && rc != -ENOTSUP) - break; - } - --- -2.24.1 - diff --git a/system/base/util-linux/files/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch b/system/base/util-linux/files/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch deleted file mode 100644 index 01a8d441..00000000 --- a/system/base/util-linux/files/0001-libmount-FS-id-and-parent-ID-could-be-zero.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 6c373810f5b1d32824371e9dff6ee5a006388f98 Mon Sep 17 00:00:00 2001 -From: Karel Zak -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 -Signed-off-by: Karel Zak ---- - 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 - diff --git a/system/base/util-linux/files/0001-lsblk-force-to-print-PKNAME-for-partition.patch b/system/base/util-linux/files/0001-lsblk-force-to-print-PKNAME-for-partition.patch deleted file mode 100644 index 3fc342b3..00000000 --- a/system/base/util-linux/files/0001-lsblk-force-to-print-PKNAME-for-partition.patch +++ /dev/null @@ -1,31 +0,0 @@ -From e3bb9bfb76c17b1d05814436ced62c05c4011f48 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 27 Jun 2019 09:22:18 +0200 -Subject: [PATCH 1/1] lsblk: force to print PKNAME for partition - -PKNAME (parent kernel device name) is based on printed tree according -to parent -> child relationship. The tree is optional and not printed -if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old -versions print the PKNAME also in this case. - -Addresses: https://github.com/karelzak/util-linux/issues/813 -Signed-off-by: Karel Zak -Signed-off-by: Christian Hesse ---- - misc-utils/lsblk.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c -index e95af7af0..3ce6da730 100644 ---- a/misc-utils/lsblk.c -+++ b/misc-utils/lsblk.c -@@ -1019,6 +1019,9 @@ static void device_to_scols( - DBG(DEV, ul_debugobj(dev, "add '%s' to scols", dev->name)); - ON_DBG(DEV, if (ul_path_isopen_dirfd(dev->sysfs)) ul_debugobj(dev, " %s ---> is open!", dev->name)); - -+ if (!parent && dev->wholedisk) -+ parent = dev->wholedisk; -+ - /* Do not print device more than one in --list mode */ - if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed) - return; diff --git a/system/base/util-linux/files/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch b/system/base/util-linux/files/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch deleted file mode 100644 index 56191a30..00000000 --- a/system/base/util-linux/files/0001-switch_root-verify-initramfs-by-f_type-not-devno.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 751c39383adaf5ff5a860516238d524b0e20f835 Mon Sep 17 00:00:00 2001 -From: Dave Reisner -Date: Wed, 2 Apr 2014 10:41:30 -0400 -Subject: [PATCH] switch_root: verify initramfs by f_type, not devno - -As of linux 3.14, the initramfs device will have both major and -minor 0, causing our paranoia check to fail. Make this version agnostic -by checking the filesystem type, rather than a device number. - -[adopted from master for backport into 2.24.x branch] - -Signed-off-by: Dave Reisner ---- - sys-utils/switch_root.c | 15 +++++++++------ - 1 file changed, 9 insertions(+), 6 deletions(-) - -diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c -index f26f7da..40e222d 100644 ---- a/sys-utils/switch_root.c -+++ b/sys-utils/switch_root.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -33,6 +34,8 @@ - #include - #include - -+#include -+ - #include "c.h" - #include "nls.h" - #include "closestream.h" -@@ -174,12 +177,12 @@ static int switchroot(const char *newroot) - if (cfd >= 0) { - pid = fork(); - if (pid <= 0) { -- if (fstat(cfd, &sb) == 0) { -- if (sb.st_dev == makedev(0, 1)) -- recursiveRemove(cfd); -- else -- warn(_("old root filesystem is not an initramfs")); -- } -+ struct statfs stfs; -+ if (fstatfs(cfd, &stfs) == 0 && -+ (stfs.f_type == RAMFS_MAGIC || stfs.f_type == TMPFS_MAGIC)) -+ recursiveRemove(cfd); -+ else -+ warn(_("old root filesystem is not an initramfs")); - - if (pid == 0) - exit(EXIT_SUCCESS); --- -1.9.1 - diff --git a/system/base/util-linux/files/0003-lsblk-fix-P-regression-from-v2.34.patch b/system/base/util-linux/files/0003-lsblk-fix-P-regression-from-v2.34.patch deleted file mode 100644 index 6d9b6da7..00000000 --- a/system/base/util-linux/files/0003-lsblk-fix-P-regression-from-v2.34.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 91b636b5654576d0b808d0030ca9d773099e1db9 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Tue, 25 Feb 2020 15:31:23 +0100 -Subject: [PATCH] lsblk: fix -P regression from v2.34 - -Since v2.34 --list prints devices only once to make the output -user-readable. Unfortunately, it's regression for scripts/applications -where we need to parse lsblk output. So, let's make --pairs and --raw -backwardly compatible with versions before 2.34 and print all hierarchy. - -Addresses: https://github.com/ibm-s390-tools/s390-tools/issues/80 -Signed-off-by: Karel Zak ---- - misc-utils/lsblk.8 | 10 ++++++---- - misc-utils/lsblk.c | 9 +++++---- - 2 files changed, 11 insertions(+), 8 deletions(-) - -diff --git a/misc-utils/lsblk.8 b/misc-utils/lsblk.8 -index 373a80ee2..416b28298 100644 ---- a/misc-utils/lsblk.8 -+++ b/misc-utils/lsblk.8 -@@ -96,7 +96,8 @@ also \fB\-\-tree\fR if necessary. - .BR \-l , " \-\-list" - Produce output in the form of a list. The output does not provide information - about relationships between devices and since version 2.34 every device is --printed only once. -+printed only once if \fB\-\-pairs\fR or \fB\-\-raw\fR not specified (the -+parsable outputs are maintained in backwardly compatible way). - .TP - .BR \-M , " \-\-merge" - Group parents of sub-trees to provide more readable output for RAIDs and -@@ -122,14 +123,15 @@ specified in the format \fI+list\fP (e.g., \fBlsblk \-o +UUID\fP). - Output all available columns. - .TP - .BR \-P , " \-\-pairs" --Produce output in the form of key="value" pairs. --All potentially unsafe characters are hex-escaped (\\x). -+Produce output in the form of key="value" pairs. The output lines are still ordered by -+dependencies. All potentially unsafe characters are hex-escaped (\\x). - .TP - .BR \-p , " \-\-paths" - Print full device paths. - .TP - .BR \-r , " \-\-raw" --Produce output in raw format. All potentially unsafe characters are hex-escaped -+Produce output in raw format. The output lines are still ordered by -+dependencies. All potentially unsafe characters are hex-escaped - (\\x) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT columns. - .TP - .BR \-S , " \-\-scsi" -diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c -index 441655e24..72ac7b483 100644 ---- a/misc-utils/lsblk.c -+++ b/misc-utils/lsblk.c -@@ -1058,8 +1058,8 @@ static void device_to_scols( - if (!parent && dev->wholedisk) - parent = dev->wholedisk; - -- /* Do not print device more than one in --list mode */ -- if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed) -+ /* Do not print device more than once on --list if tree order is not requested */ -+ if (!(lsblk->flags & LSBLK_TREE) && !lsblk->force_tree_order && dev->is_printed) - return; - - if (lsblk->merge && list_count_entries(&dev->parents) > 1) { -@@ -2044,8 +2044,9 @@ int main(int argc, char *argv[]) - * /sys is no more sorted */ - lsblk->sort_id = COL_MAJMIN; - -- /* For --inverse --list we still follow parent->child relation */ -- if (lsblk->inverse && !(lsblk->flags & LSBLK_TREE)) -+ /* For --{inverse,raw,pairs} --list we still follow parent->child relation */ -+ if (!(lsblk->flags & LSBLK_TREE) -+ && (lsblk->inverse || lsblk->flags & LSBLK_EXPORT || lsblk->flags & LSBLK_RAW)) - lsblk->force_tree_order = 1; - - if (lsblk->sort_id >= 0 && column_id_to_number(lsblk->sort_id) < 0) { --- -2.24.1 - diff --git a/system/base/util-linux/files/libmount-Fix-regression-when-mounting-with-atime.patch b/system/base/util-linux/files/libmount-Fix-regression-when-mounting-with-atime.patch new file mode 100644 index 00000000..1c986537 --- /dev/null +++ b/system/base/util-linux/files/libmount-Fix-regression-when-mounting-with-atime.patch @@ -0,0 +1,133 @@ +From 2b99ee2526ae61be761b0e31c50e106dbec5e9e4 Mon Sep 17 00:00:00 2001 +From: Filipe Manana +Date: Thu, 17 Aug 2023 10:20:13 +0100 +Subject: [PATCH] libmount: Fix regression when mounting with atime + +A regression was introduced in v2.39 that causes mounting with the atime +option to fail: + + $ mkfs.ext4 -F /dev/sdi + $ mount -o atime /dev/sdi /mnt/sdi + mount: /mnt/sdi: not mount point or bad option. + dmesg(1) may have more information after failed mount system call. + +The failure comes from the mount_setattr(2) call returning -EINVAL. This +is because we pass an invalid value for the attr_clr argument. From a +strace capture we have: + + mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=0, attr_clr=MOUNT_ATTR_NOATIME, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument) + +We can't pass MOUNT_ATTR_NOATIME to mount_setattr(2) through the attr_clr +argument because all atime options are exclusive, so in order to set atime +one has to pass MOUNT_ATTR__ATIME to attr_clr and leave attr_set as +MOUNT_ATTR_RELATIME (which is defined as a value of 0). + +This can be read from the man page for mount_setattr(2) and also from the +kernel source: + + $ cat fs/namespace.c + static int build_mount_kattr(const struct mount_attr *attr, size_t usize, + struct mount_kattr *kattr, unsigned int flags) + { + (...) + /* + * Since the MOUNT_ATTR_ values are an enum, not a bitmap, + * users wanting to transition to a different atime setting cannot + * simply specify the atime setting in @attr_set, but must also + * specify MOUNT_ATTR__ATIME in the @attr_clr field. + * So ensure that MOUNT_ATTR__ATIME can't be partially set in + * @attr_clr and that @attr_set can't have any atime bits set if + * MOUNT_ATTR__ATIME isn't set in @attr_clr. + */ + if (attr->attr_clr & MOUNT_ATTR__ATIME) { + if ((attr->attr_clr & MOUNT_ATTR__ATIME) != MOUNT_ATTR__ATIME) + return -EINVAL; + + /* + * Clear all previous time settings as they are mutually + * exclusive. + */ + kattr->attr_clr |= MNT_RELATIME | MNT_NOATIME; + switch (attr->attr_set & MOUNT_ATTR__ATIME) { + case MOUNT_ATTR_RELATIME: + kattr->attr_set |= MNT_RELATIME; + break; + case MOUNT_ATTR_NOATIME: + kattr->attr_set |= MNT_NOATIME; + break; + case MOUNT_ATTR_STRICTATIME: + break; + default: + return -EINVAL; + } + (...) + +So fix this by setting attr_clr MOUNT_ATTR__ATIME if we want to clear any +atime related option. + +Signed-off-by: Filipe Manana +--- + libmount/src/optlist.c | 13 ++++++++++++- + tests/expected/libmount/context-mount-flags | 3 +++ + tests/ts/libmount/context | 9 ++++++++- + 3 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/libmount/src/optlist.c b/libmount/src/optlist.c +index e93810b47..d0afc94f7 100644 +--- a/libmount/src/optlist.c ++++ b/libmount/src/optlist.c +@@ -875,7 +875,18 @@ int mnt_optlist_get_attrs(struct libmnt_optlist *ls, uint64_t *set, uint64_t *cl + + if (opt->ent->mask & MNT_INVERT) { + DBG(OPTLIST, ul_debugobj(ls, " clr: %s", opt->ent->name)); +- *clr |= x; ++ /* ++ * All atime settings are mutually exclusive so *clr must ++ * have MOUNT_ATTR__ATIME set. ++ * ++ * See the function fs/namespace.c:build_mount_kattr() ++ * in the linux kernel source. ++ */ ++ if (x == MOUNT_ATTR_RELATIME || x == MOUNT_ATTR_NOATIME || ++ x == MOUNT_ATTR_STRICTATIME) ++ *clr |= MOUNT_ATTR__ATIME; ++ else ++ *clr |= x; + } else { + DBG(OPTLIST, ul_debugobj(ls, " set: %s", opt->ent->name)); + *set |= x; +diff --git a/tests/expected/libmount/context-mount-flags b/tests/expected/libmount/context-mount-flags +index 960641863..eb71323dd 100644 +--- a/tests/expected/libmount/context-mount-flags ++++ b/tests/expected/libmount/context-mount-flags +@@ -3,3 +3,6 @@ ro,nosuid,noexec + successfully mounted + rw,nosuid,noexec + successfully umounted ++successfully mounted ++rw,relatime ++successfully umounted +diff --git a/tests/ts/libmount/context b/tests/ts/libmount/context +index f5b47185e..a5d2e81a3 100755 +--- a/tests/ts/libmount/context ++++ b/tests/ts/libmount/context +@@ -116,8 +116,15 @@ $TS_CMD_FINDMNT --kernel --mountpoint $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPU + + ts_run $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG + is_mounted $DEVICE && echo "$DEVICE still mounted" >> $TS_OUTPUT 2>> $TS_ERRLOG +-ts_finalize_subtest + ++# Test that the atime option works after the migration to use the new kernel mount APIs. ++ts_run $TESTPROG --mount -o atime $DEVICE $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ++$TS_CMD_FINDMNT --kernel --mountpoint $MOUNTPOINT -o VFS-OPTIONS -n >> $TS_OUTPUT 2>> $TS_ERRLOG ++is_mounted $DEVICE || echo "$DEVICE not mounted" >> $TS_OUTPUT 2>> $TS_ERRLOG ++ts_run $TESTPROG --umount $MOUNTPOINT >> $TS_OUTPUT 2>> $TS_ERRLOG ++is_mounted $DEVICE && echo "$DEVICE still mounted" >> $TS_OUTPUT 2>> $TS_ERRLOG ++ ++ts_finalize_subtest + + ts_init_subtest "mount-loopdev" + mkdir -p $MOUNTPOINT &> /dev/null +-- +2.40.1 + diff --git a/system/base/util-linux/files/login-lastlog-create.patch b/system/base/util-linux/files/login-lastlog-create.patch deleted file mode 100644 index 799f3304..00000000 --- a/system/base/util-linux/files/login-lastlog-create.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -up util-linux-2.36/login-utils/login.c.kzak util-linux-2.36/login-utils/login.c ---- util-linux-2.36/login-utils/login.c.kzak 2020-07-23 14:13:26.777030764 +0200 -+++ util-linux-2.36/login-utils/login.c 2020-07-23 14:11:22.793686983 +0200 -@@ -585,7 +585,7 @@ static void log_lastlog(struct login_con - sa.sa_handler = SIG_IGN; - sigaction(SIGXFSZ, &sa, &oldsa_xfsz); - -- fd = open(_PATH_LASTLOG, O_RDWR, 0); -+ fd = open(_PATH_LASTLOG, O_RDWR | O_CREAT, 0); - if (fd < 0) - goto done; - offset = cxt->pwd->pw_uid * sizeof(ll); diff --git a/system/base/util-linux/files/move_is_mountinfo.patch b/system/base/util-linux/files/move_is_mountinfo.patch deleted file mode 100644 index ad9387ef..00000000 --- a/system/base/util-linux/files/move_is_mountinfo.patch +++ /dev/null @@ -1,46 +0,0 @@ -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 diff --git a/system/base/util-linux/files/upstream/0001-sfdisk-support-empty-label-use-case.patch b/system/base/util-linux/files/upstream/0001-sfdisk-support-empty-label-use-case.patch deleted file mode 100644 index 29ab44d9..00000000 --- a/system/base/util-linux/files/upstream/0001-sfdisk-support-empty-label-use-case.patch +++ /dev/null @@ -1,223 +0,0 @@ -From 35ca51182782193f555fbdcb06bb10766550d017 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 30 Nov 2016 12:43:10 +0100 -Subject: [PATCH] sfdisk: support empty label use-case - -By default sfdisk creates partition table when a first partition is -specified, otherwise the device is not modified. This force users to -create at least one partition. - -This commit allows to create empty label without partitions if "label: -" header line is specified by script. - -The commit also modifies "New situation:" output to list label name -and label identifier. - -Addresses: https://github.com/karelzak/util-linux/issues/374 -Signed-off-by: Karel Zak ---- - disk-utils/fdisk-list.c | 23 +++++++++++++++-------- - disk-utils/fdisk-list.h | 1 + - disk-utils/sfdisk.8 | 18 +++++++++++++++++- - disk-utils/sfdisk.c | 17 +++++++++++++++++ - libfdisk/src/libfdisk.h.in | 1 + - libfdisk/src/libfdisk.sym | 5 +++++ - libfdisk/src/script.c | 20 +++++++++++++++++++- - 7 files changed, 75 insertions(+), 10 deletions(-) - -diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c -index e6b2033..c9560f4 100644 ---- a/disk-utils/fdisk-list.c -+++ b/disk-utils/fdisk-list.c -@@ -34,10 +34,23 @@ static int is_ide_cdrom_or_tape(char *device) - return ret; - } - -+void list_disk_identifier(struct fdisk_context *cxt) -+{ -+ struct fdisk_label *lb = fdisk_get_label(cxt, NULL); -+ char *id = NULL; -+ -+ if (fdisk_has_label(cxt)) -+ fdisk_info(cxt, _("Disklabel type: %s"), -+ fdisk_label_get_name(lb)); -+ -+ if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) { -+ fdisk_info(cxt, _("Disk identifier: %s"), id); -+ free(id); -+ } -+} - - void list_disk_geometry(struct fdisk_context *cxt) - { -- char *id = NULL; - struct fdisk_label *lb = fdisk_get_label(cxt, NULL); - uint64_t bytes = fdisk_get_nsectors(cxt) * fdisk_get_sector_size(cxt); - char *strsz = size_to_human_string(SIZE_SUFFIX_SPACE -@@ -71,14 +84,8 @@ void list_disk_geometry(struct fdisk_context *cxt) - if (fdisk_get_alignment_offset(cxt)) - fdisk_info(cxt, _("Alignment offset: %lu bytes"), - fdisk_get_alignment_offset(cxt)); -- if (fdisk_has_label(cxt)) -- fdisk_info(cxt, _("Disklabel type: %s"), -- fdisk_label_get_name(lb)); - -- if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) { -- fdisk_info(cxt, _("Disk identifier: %s"), id); -- free(id); -- } -+ list_disk_identifier(cxt); - } - - void list_disklabel(struct fdisk_context *cxt) -diff --git a/disk-utils/fdisk-list.h b/disk-utils/fdisk-list.h -index eddab92..4ed5c25 100644 ---- a/disk-utils/fdisk-list.h -+++ b/disk-utils/fdisk-list.h -@@ -2,6 +2,7 @@ - #define UTIL_LINUX_FDISK_LIST_H - - extern void list_disklabel(struct fdisk_context *cxt); -+extern void list_disk_identifier(struct fdisk_context *cxt); - extern void list_disk_geometry(struct fdisk_context *cxt); - extern void list_freespace(struct fdisk_context *cxt); - -diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8 -index fcde872..efe4a86 100644 ---- a/disk-utils/sfdisk.8 -+++ b/disk-utils/sfdisk.8 -@@ -212,7 +212,10 @@ Deprecated option. Only the sector unit is supported. - .BR \-X , " \-\-label " \fItype - Specify the disk label type (e.g. \fBdos\fR, \fBgpt\fR, ...). If this option - is not given, then \fBsfdisk\fR defaults to the existing label, but if there --is no label on the device yet, then the type defaults to \fBdos\fR. -+is no label on the device yet, then the type defaults to \fBdos\fR. The default -+or the current label may be overwritten by the "label: " script header -+line. The option \fB\-\-label\fR does not force \fBsfdisk\fR to create empty -+disk label (see the \fBEMPTY DISK LABEL\fR section below). - .TP - .BR \-Y , " \-\-label\-nested " \fItype - Force editing of a nested disk label. The primary disk label has to exist already. -@@ -404,6 +407,19 @@ For backward compatibility the \fBId=\fR field has the same meaning. - .RE - .RE - -+.SH "EMPTY DISK LABEL" -+.B sfdisk -+does not create partition table without partitions by default. The lines with -+partitions are expected in the script by default. The empty partition table has -+to be explicitly requested by "label: " script header line without any -+partitions lines. For example: -+.RS -+.sp -+.B "echo 'label: gpt' | sfdisk /dev/sdb" -+.sp -+.RE -+creates empty GPT partition table. Note that the \fB\-\-append\fR disables this feature. -+ - .SH "BACKING UP THE PARTITION TABLE" - It is recommended to save the layout of your devices. - .B sfdisk -diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c -index 10307ad..2d65974 100644 ---- a/disk-utils/sfdisk.c -+++ b/disk-utils/sfdisk.c -@@ -1766,8 +1766,25 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv) - } - } while (1); - -+ /* create empty disk label if label, but no partition specified */ -+ if (rc == SFDISK_DONE_EOF && created == 0 -+ && fdisk_script_has_force_label(dp) == 1 -+ && fdisk_table_get_nents(tb) == 0 -+ && fdisk_script_get_header(dp, "label")) { -+ -+ int xrc = fdisk_apply_script_headers(sf->cxt, dp); -+ created = !xrc; -+ if (xrc) { -+ fdisk_warnx(sf->cxt, _( -+ "Failed to apply script headers, " -+ "disk label not created.")); -+ rc = SFDISK_DONE_ABORT; -+ } -+ } -+ - if (!sf->quiet && rc != SFDISK_DONE_ABORT) { - fdisk_info(sf->cxt, _("\nNew situation:")); -+ list_disk_identifier(sf->cxt); - list_disklabel(sf->cxt); - } - -diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in -index 9154f5b..59cce19 100644 ---- a/libfdisk/src/libfdisk.h.in -+++ b/libfdisk/src/libfdisk.h.in -@@ -642,6 +642,7 @@ const char *fdisk_script_get_header(struct fdisk_script *dp, const char *name); - int fdisk_script_set_header(struct fdisk_script *dp, const char *name, const char *data); - struct fdisk_table *fdisk_script_get_table(struct fdisk_script *dp); - int fdisk_script_get_nlines(struct fdisk_script *dp); -+int fdisk_script_has_force_label(struct fdisk_script *dp); - - int fdisk_script_set_userdata(struct fdisk_script *dp, void *data); - void *fdisk_script_get_userdata(struct fdisk_script *dp); -diff --git a/libfdisk/src/libfdisk.sym b/libfdisk/src/libfdisk.sym -index 02cd7a8..d6d4ac5 100644 ---- a/libfdisk/src/libfdisk.sym -+++ b/libfdisk/src/libfdisk.sym -@@ -274,3 +274,8 @@ FDISK_2.29 { - fdisk_labelitem_is_number; - fdisk_gpt_set_npartitions; - } FDISK_2.28; -+ -+ -+FDISK_2.30 { -+ fdisk_script_has_force_label; -+} FDISK_2.29; -diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c -index ae7e99a..0d1f260 100644 ---- a/libfdisk/src/script.c -+++ b/libfdisk/src/script.c -@@ -36,7 +36,8 @@ struct fdisk_script { - size_t nlines; - struct fdisk_label *label; - -- unsigned int json : 1; /* JSON output */ -+ unsigned int json : 1, /* JSON output */ -+ force_label : 1; /* label: specified */ - }; - - -@@ -354,6 +355,22 @@ int fdisk_script_get_nlines(struct fdisk_script *dp) - } - - /** -+ * fdisk_script_has_force_label: -+ * @dp: script -+ * -+ * Note that fdisk_script_set_header(dp, "label", name) does not modify -+ * force_label status. The label has to be specified by script. -+ * -+ * Returns: true if "label: " has been parsed. -+ */ -+int fdisk_script_has_force_label(struct fdisk_script *dp) -+{ -+ assert(dp); -+ return dp->force_label; -+} -+ -+ -+/** - * fdisk_script_read_context: - * @dp: script - * @cxt: context -@@ -706,6 +723,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s) - if (strcmp(name, "label") == 0) { - if (dp->cxt && !fdisk_get_label(dp->cxt, value)) - goto done; /* unknown label name */ -+ dp->force_label = 1; - } else if (strcmp(name, "unit") == 0) { - if (strcmp(value, "sectors") != 0) - goto done; /* only "sectors" supported */ --- -2.10.2 - diff --git a/system/base/util-linux/pspec.xml b/system/base/util-linux/pspec.xml index 41ad843c..78a3e91e 100644 --- a/system/base/util-linux/pspec.xml +++ b/system/base/util-linux/pspec.xml @@ -28,11 +28,7 @@ upstream/util-linux-ng-2.21-login-lastlog.patch - - - - - + libmount-Fix-regression-when-mounting-with-atime.patch @@ -153,6 +149,13 @@ + + 2023-09-11 + 2.39.2 + Rebuild + Mustafa Cinasal + muscnsl@hotmail.com + 2023-08-19 2.39.2