[arch-commits] Commit in util-linux/trunk (0001-stable.patch PKGBUILD)
Date: Wednesday, May 20, 2020 @ 19:30:36 Author: eworm Revision: 387037 upgpkg: util-linux 2.35.2-1 new upstream release Modified: util-linux/trunk/PKGBUILD Deleted: util-linux/trunk/0001-stable.patch ---+ 0001-stable.patch | 164 PKGBUILD | 14 2 files changed, 3 insertions(+), 175 deletions(-) Deleted: 0001-stable.patch === --- 0001-stable.patch 2020-05-20 19:29:50 UTC (rev 387036) +++ 0001-stable.patch 2020-05-20 19:30:36 UTC (rev 387037) @@ -1,164 +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 1/2] 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)); --
[arch-commits] Commit in util-linux/trunk (0001-stable.patch PKGBUILD)
Date: Monday, April 13, 2020 @ 21:28:44 Author: eworm Revision: 380300 upgpkg: util-linux 2.35.1-2 pull in stable changes Added: util-linux/trunk/0001-stable.patch Modified: util-linux/trunk/PKGBUILD ---+ 0001-stable.patch | 164 PKGBUILD | 10 ++- 2 files changed, 173 insertions(+), 1 deletion(-) Added: 0001-stable.patch === --- 0001-stable.patch (rev 0) +++ 0001-stable.patch 2020-04-13 21:28:44 UTC (rev 380300) @@ -0,0 +1,164 @@ +From 00e53f17c8462cb34ece08cc10db60a7da29a305 Mon Sep 17 00:00:00 2001 +From: Karel Zak +Date: Tue, 4 Feb 2020 15:11:19 +0100 +Subject: [PATCH 1/2] 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)); +- retu