summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc3
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch137
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-lsblk-force-to-print-PKNAME-for-partition.patch36
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.35.1.bb (renamed from meta/recipes-core/util-linux/util-linux_2.34.bb)6
4 files changed, 142 insertions, 40 deletions
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
index 179cb3dac5..0566569a61 100644
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -8,7 +8,7 @@ SECTION = "base"
8 8
9LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause" 9LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause"
10 10
11LIC_FILES_CHKSUM = "file://README.licensing;md5=972a134f1e14b2b060e365df2fab0099 \ 11LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \
12 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 12 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
13 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 13 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
14 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \ 14 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
@@ -105,6 +105,7 @@ EXTRA_OECONF = "\
105EXTRA_OECONF_append_class-target = " --enable-setpriv" 105EXTRA_OECONF_append_class-target = " --enable-setpriv"
106EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" 106EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv"
107EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" 107EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv"
108EXTRA_OECONF_append = " --disable-hwclock-gplv3"
108 109
109# enable pcre2 for native/nativesdk to match host distros 110# enable pcre2 for native/nativesdk to match host distros
110# this helps to keep same expectations when using the SDK or 111# this helps to keep same expectations when using the SDK or
diff --git a/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch b/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
new file mode 100644
index 0000000000..911f70bc1f
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch
@@ -0,0 +1,137 @@
1From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Tue, 4 Feb 2020 15:11:19 +0100
4Subject: [PATCH] libfdisk: (script) accept sector-size, ignore unknown headers
5
6- add sector-size between supported headers (already in --dump output)
7
8- report unknown headers by -ENOTSUP
9
10- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file()
11
12Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/00e53f17c8462cb34ece08cc10db60a7da29a305]
13
14Addresses: https://github.com/karelzak/util-linux/issues/949
15Signed-off-by: Karel Zak <kzak@redhat.com>
16Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
17---
18 disk-utils/sfdisk.c | 6 +++++-
19 libfdisk/src/script.c | 49 ++++++++++++++++++++++++++-----------------------
20 2 files changed, 31 insertions(+), 24 deletions(-)
21
22diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
23index bb6e1c6..c0bea70 100644
24--- a/disk-utils/sfdisk.c
25+++ b/disk-utils/sfdisk.c
26@@ -1782,7 +1782,11 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
27 }
28
29 rc = fdisk_script_read_line(dp, stdin, buf, sizeof(buf));
30- if (rc < 0) {
31+ if (rc == -ENOTSUP) {
32+ buf[sizeof(buf) - 1] = '\0';
33+ fdisk_warnx(sf->cxt, _("Unknown script header '%s' -- ignore."), buf);
34+ continue;
35+ } else if (rc < 0) {
36 DBG(PARSE, ul_debug("script parsing failed, trying sfdisk specific commands"));
37 buf[sizeof(buf) - 1] = '\0';
38 rc = loop_control_commands(sf, dp, buf);
39diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
40index a21771b..d3e67fa 100644
41--- a/libfdisk/src/script.c
42+++ b/libfdisk/src/script.c
43@@ -805,8 +805,12 @@ static inline int is_header_line(const char *s)
44 /* parses "<name>: value", note modifies @s*/
45 static int parse_line_header(struct fdisk_script *dp, char *s)
46 {
47- int rc = -EINVAL;
48+ size_t i;
49 char *name, *value;
50+ static const char *supported[] = {
51+ "label", "unit", "label-id", "device", "grain",
52+ "first-lba", "last-lba", "table-length", "sector-size"
53+ };
54
55 DBG(SCRIPT, ul_debugobj(dp, " parse header '%s'", s));
56
57@@ -816,7 +820,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s)
58 name = s;
59 value = strchr(s, ':');
60 if (!value)
61- goto done;
62+ return -EINVAL;
63 *value = '\0';
64 value++;
65
66@@ -825,32 +829,30 @@ static int parse_line_header(struct fdisk_script *dp, char *s)
67 ltrim_whitespace((unsigned char *) value);
68 rtrim_whitespace((unsigned char *) value);
69
70+ if (!*name || !*value)
71+ return -EINVAL;
72+
73+ /* check header name */
74+ for (i = 0; i < ARRAY_SIZE(supported); i++) {
75+ if (strcmp(name, supported[i]) == 0)
76+ break;
77+ }
78+ if (i == ARRAY_SIZE(supported))
79+ return -ENOTSUP;
80+
81+ /* header specific actions */
82 if (strcmp(name, "label") == 0) {
83 if (dp->cxt && !fdisk_get_label(dp->cxt, value))
84- goto done; /* unknown label name */
85+ return -EINVAL; /* unknown label name */
86 dp->force_label = 1;
87+
88 } else if (strcmp(name, "unit") == 0) {
89 if (strcmp(value, "sectors") != 0)
90- goto done; /* only "sectors" supported */
91- } else if (strcmp(name, "label-id") == 0
92- || strcmp(name, "device") == 0
93- || strcmp(name, "grain") == 0
94- || strcmp(name, "first-lba") == 0
95- || strcmp(name, "last-lba") == 0
96- || strcmp(name, "table-length") == 0) {
97- ; /* whatever is possible */
98- } else
99- goto done; /* unknown header */
100+ return -EINVAL; /* only "sectors" supported */
101
102- if (*name && *value)
103- rc = fdisk_script_set_header(dp, name, value);
104-done:
105- if (rc)
106- DBG(SCRIPT, ul_debugobj(dp, "header parse error: "
107- "[rc=%d, name='%s', value='%s']",
108- rc, name, value));
109- return rc;
110+ }
111
112+ return fdisk_script_set_header(dp, name, value);
113 }
114
115 /* returns zero terminated string with next token and @str is updated */
116@@ -1363,7 +1365,8 @@ int fdisk_script_set_fgets(struct fdisk_script *dp,
117 *
118 * Reads next line into dump.
119 *
120- * Returns: 0 on success, <0 on error, 1 when nothing to read.
121+ * Returns: 0 on success, <0 on error, 1 when nothing to read. For unknown headers
122+ * returns -ENOTSUP, it's usually safe to ignore this error.
123 */
124 int fdisk_script_read_line(struct fdisk_script *dp, FILE *f, char *buf, size_t bufsz)
125 {
126@@ -1428,7 +1431,7 @@ int fdisk_script_read_file(struct fdisk_script *dp, FILE *f)
127
128 while (!feof(f)) {
129 rc = fdisk_script_read_line(dp, f, buf, sizeof(buf));
130- if (rc)
131+ if (rc && rc != -ENOTSUP)
132 break;
133 }
134
135--
1362.7.4
137
diff --git a/meta/recipes-core/util-linux/util-linux/0001-lsblk-force-to-print-PKNAME-for-partition.patch b/meta/recipes-core/util-linux/util-linux/0001-lsblk-force-to-print-PKNAME-for-partition.patch
deleted file mode 100644
index 5d4c148fb3..0000000000
--- a/meta/recipes-core/util-linux/util-linux/0001-lsblk-force-to-print-PKNAME-for-partition.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1From e3bb9bfb76c17b1d05814436ced62c05c4011f48 Mon Sep 17 00:00:00 2001
2From: Karel Zak <kzak@redhat.com>
3Date: Thu, 27 Jun 2019 09:22:18 +0200
4Subject: [PATCH] lsblk: force to print PKNAME for partition
5
6PKNAME (parent kernel device name) is based on printed tree according
7to parent -> child relationship. The tree is optional and not printed
8if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old
9versions print the PKNAME also in this case.
10
11Upstream-Status: Backport [https://github.com/karelzak/util-linux/commit/e3bb9bfb76c17b1d05814436ced62c05c4011f48]
12
13Addresses: https://github.com/karelzak/util-linux/issues/813
14Signed-off-by: Karel Zak <kzak@redhat.com>
15Signed-off-by: Liwei Song <liwei.song@windriver.com>
16---
17 misc-utils/lsblk.c | 3 +++
18 1 file changed, 3 insertions(+)
19
20diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
21index e95af7af0256..3ce6da730264 100644
22--- a/misc-utils/lsblk.c
23+++ b/misc-utils/lsblk.c
24@@ -1019,6 +1019,9 @@ static void device_to_scols(
25 DBG(DEV, ul_debugobj(dev, "add '%s' to scols", dev->name));
26 ON_DBG(DEV, if (ul_path_isopen_dirfd(dev->sysfs)) ul_debugobj(dev, " %s ---> is open!", dev->name));
27
28+ if (!parent && dev->wholedisk)
29+ parent = dev->wholedisk;
30+
31 /* Do not print device more than one in --list mode */
32 if (!(lsblk->flags & LSBLK_TREE) && dev->is_printed)
33 return;
34--
352.17.1
36
diff --git a/meta/recipes-core/util-linux/util-linux_2.34.bb b/meta/recipes-core/util-linux/util-linux_2.35.1.bb
index 557449d140..51964c9124 100644
--- a/meta/recipes-core/util-linux/util-linux_2.34.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.35.1.bb
@@ -7,8 +7,8 @@ SRC_URI += "file://configure-sbindir.patch \
7 file://run-ptest \ 7 file://run-ptest \
8 file://display_testname_for_subtest.patch \ 8 file://display_testname_for_subtest.patch \
9 file://avoid_parallel_tests.patch \ 9 file://avoid_parallel_tests.patch \
10 file://0001-lsblk-force-to-print-PKNAME-for-partition.patch \
11 file://0001-hwclock-fix-for-glibc-2.31-settimeofday.patch \ 10 file://0001-hwclock-fix-for-glibc-2.31-settimeofday.patch \
11 file://0001-libfdisk-script-accept-sector-size-ignore-unknown-he.patch \
12" 12"
13SRC_URI[md5sum] = "a78cbeaed9c39094b96a48ba8f891d50" 13SRC_URI[md5sum] = "7f64882f631225f0295ca05080cee1bf"
14SRC_URI[sha256sum] = "743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5" 14SRC_URI[sha256sum] = "d9de3edd287366cd908e77677514b9387b22bc7b88f45b83e1922c3597f1d7f9"