From 3be8b0ebb2196733bec1ef1d7db86ab9eb9deee19ea93f7c0446453d1f706a89 Mon Sep 17 00:00:00 2001 From: Sebastian Parschauer Date: Thu, 10 Aug 2017 15:18:26 +0000 Subject: [PATCH 1/3] Accepting request 515942 from home:sparschauer:branches:Base:System - parted: mkpart: Allow empty string "" for the GPT partition name in script mode (bsc#1023818, boo#1032562) - add: parted-mkpart-allow-empty-gpt-part-name.patch OBS-URL: https://build.opensuse.org/request/show/515942 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=129 --- parted-mkpart-allow-empty-gpt-part-name.patch | 59 +++++++++++++++++++ parted.changes | 7 +++ parted.spec | 2 + 3 files changed, 68 insertions(+) create mode 100644 parted-mkpart-allow-empty-gpt-part-name.patch diff --git a/parted-mkpart-allow-empty-gpt-part-name.patch b/parted-mkpart-allow-empty-gpt-part-name.patch new file mode 100644 index 0000000..00f80fa --- /dev/null +++ b/parted-mkpart-allow-empty-gpt-part-name.patch @@ -0,0 +1,59 @@ +From: Sebastian Parschauer +Date: Thu, 10 Aug 2017 14:52:47 +0200 +Subject: parted/ui: Count empty strings as words in multi_word mode +References: bsc#1023818, boo#1032562 +Patch-mainline: submitted, 2017-08-10 + +In non-interactive mode, the command line arguments are appended +to a string list with command_line_push_line() in multi_word mode. +That mode does not count empty strings as a word. +For mkpart and a GPT disk label, the partition name is picked up +from that string list. The partition name is mandatory and we +cannot make it optional. So it is not possible to set an empty +partition name from command line this way. +Also setting a default name is no option as this causes duplicate +/dev/disk/by-partlabel/ symlinks and systemd errors this way. + +So count empty strings as words in multi_word mode to allow the +the following commands to set an empty partition name. + +parted -s /dev/vdb mkpart "" 1MiB 100% +parted -s /dev/vdb mkpart "" ext3 1MiB 100% + +This does not break any other parts as these all check if the +provided string is a valid value. + +Signed-off-by: Sebastian Parschauer +--- + parted/ui.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/parted/ui.c b/parted/ui.c +index 752860baa087..b7e593bf12da 100644 +--- a/parted/ui.c ++++ b/parted/ui.c +@@ -712,8 +712,8 @@ _str_is_spaces (const char* str) + * In single-word mode, only one word is parsed per line. + * Leading and trailing spaces are removed. For example: " a b c " + * is a single word "a b c". The motivation for this mode is partition +- * names, etc. In single-word mode, the empty string is a word. +- * (but not in multi-word mode). ++ * names, etc. The empty string is always a word to allow empty ++ * partition names in non-interactive mode. + */ + void + command_line_push_line (const char* line, int multi_word) +@@ -755,10 +755,9 @@ command_line_push_line (const char* line, int multi_word) + + this_word [i++] = *line; + } +- if (i || !multi_word) { +- this_word [i] = 0; +- command_line_push_word (this_word); +- } ++ this_word [i] = 0; ++ command_line_push_word (this_word); ++ + } while (*line && multi_word); + } + diff --git a/parted.changes b/parted.changes index cbe7890..a0247b3 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Aug 10 16:44:57 CEST 2017 - sparschauer@suse.de + +- parted: mkpart: Allow empty string "" for the GPT partition name + in script mode (bsc#1023818, boo#1032562) + - add: parted-mkpart-allow-empty-gpt-part-name.patch + ------------------------------------------------------------------- Thu Jun 15 20:28:08 CEST 2017 - sparschauer@suse.de diff --git a/parted.spec b/parted.spec index 00d6908..014f992 100644 --- a/parted.spec +++ b/parted.spec @@ -79,6 +79,7 @@ Patch47: libparted-dasd-improve-lvm-raid-flag-handling.patch Patch48: parted-mkpart-set-a-swap-flag-if-available.patch Patch49: libparted-set-swap-flag-on-GPT-partitions.patch Patch50: libparted-dasd-add-swap-flag-handling-for-DASD-CDL.patch +Patch51: parted-mkpart-allow-empty-gpt-part-name.patch Patch100: parted-fatresize-autoconf.patch BuildRequires: check-devel BuildRequires: device-mapper-devel >= 1.02.33 @@ -172,6 +173,7 @@ to develop applications that require these. %patch48 -p1 %patch49 -p1 %patch50 -p1 +%patch51 -p1 %patch100 -p1 %build From c8d62f21e1e1bcb14b465b1c1830af0c9c4e38d235def5014de6cfc72d3f85ba Mon Sep 17 00:00:00 2001 From: Sebastian Parschauer Date: Fri, 11 Aug 2017 15:11:48 +0000 Subject: [PATCH 2/3] Accepting request 516173 from home:sparschauer:branches:Base:System - Amend parsing of empty GPT partition names to require quoted empty strings '""' or "''" (bsc#1023818, boo#1032562) - amend: parted-mkpart-allow-empty-gpt-part-name.patch OBS-URL: https://build.opensuse.org/request/show/516173 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=130 --- parted-mkpart-allow-empty-gpt-part-name.patch | 71 +++++++++++-------- parted.changes | 7 ++ 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/parted-mkpart-allow-empty-gpt-part-name.patch b/parted-mkpart-allow-empty-gpt-part-name.patch index 00f80fa..969b4d6 100644 --- a/parted-mkpart-allow-empty-gpt-part-name.patch +++ b/parted-mkpart-allow-empty-gpt-part-name.patch @@ -1,8 +1,9 @@ From: Sebastian Parschauer -Date: Thu, 10 Aug 2017 14:52:47 +0200 -Subject: parted/ui: Count empty strings as words in multi_word mode +Date: Fri, 11 Aug 2017 12:46:42 +0200 +Subject: parted/ui: Count empty quoted strings as words in multi_word + mode References: bsc#1023818, boo#1032562 -Patch-mainline: submitted, 2017-08-10 +Patch-mainline: submitted, 2017-08-11 In non-interactive mode, the command line arguments are appended to a string list with command_line_push_line() in multi_word mode. @@ -14,46 +15,54 @@ partition name from command line this way. Also setting a default name is no option as this causes duplicate /dev/disk/by-partlabel/ symlinks and systemd errors this way. -So count empty strings as words in multi_word mode to allow the +So count empty quoted strings as words in multi_word mode to allow the following commands to set an empty partition name. -parted -s /dev/vdb mkpart "" 1MiB 100% -parted -s /dev/vdb mkpart "" ext3 1MiB 100% +parted -s /dev/vdb mkpart "''" 1MiB 100% +parted -s /dev/vdb mkpart '""' ext3 1MiB 100% +parted -s /dev/vdb name 1 "''" -This does not break any other parts as these all check if the -provided string is a valid value. +The quoting is required as in interactive mode the command +"mkpart " (with a trailing space) would set the partition name to +an empty string already. Signed-off-by: Sebastian Parschauer --- - parted/ui.c | 11 +++++------ - 1 file changed, 5 insertions(+), 6 deletions(-) + parted/ui.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/parted/ui.c b/parted/ui.c -index 752860baa087..b7e593bf12da 100644 +index 752860baa087..9991596a3a5a 100644 --- a/parted/ui.c +++ b/parted/ui.c -@@ -712,8 +712,8 @@ _str_is_spaces (const char* str) - * In single-word mode, only one word is parsed per line. - * Leading and trailing spaces are removed. For example: " a b c " - * is a single word "a b c". The motivation for this mode is partition -- * names, etc. In single-word mode, the empty string is a word. -- * (but not in multi-word mode). -+ * names, etc. The empty string is always a word to allow empty -+ * partition names in non-interactive mode. - */ - void +@@ -719,6 +719,7 @@ void command_line_push_line (const char* line, int multi_word) -@@ -755,10 +755,9 @@ command_line_push_line (const char* line, int multi_word) + { + int quoted = 0; ++ int quotes_empty = 0; + char quote_char = 0; + char this_word [256]; + int i; +@@ -746,6 +747,9 @@ command_line_push_line (const char* line, int multi_word) + if (quoted && *line == quote_char) { + quoted = 0; ++ /* allow empty partition name in script mode */ ++ if (!i) ++ quotes_empty = 1; + continue; + } + +@@ -753,9 +757,11 @@ command_line_push_line (const char* line, int multi_word) + if (quoted && line[0] == '\\' && line[1]) + line++; + ++ quotes_empty = 0; this_word [i++] = *line; } - if (i || !multi_word) { -- this_word [i] = 0; -- command_line_push_word (this_word); -- } -+ this_word [i] = 0; -+ command_line_push_word (this_word); -+ - } while (*line && multi_word); - } - ++ if (i || !multi_word || quotes_empty) { ++ quotes_empty = 0; + this_word [i] = 0; + command_line_push_word (this_word); + } diff --git a/parted.changes b/parted.changes index a0247b3..73d3846 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Aug 11 16:15:08 CEST 2017 - sparschauer@suse.de + +- Amend parsing of empty GPT partition names to require quoted + empty strings '""' or "''" (bsc#1023818, boo#1032562) + - amend: parted-mkpart-allow-empty-gpt-part-name.patch + ------------------------------------------------------------------- Thu Aug 10 16:44:57 CEST 2017 - sparschauer@suse.de From d2638b4319d451adedac2b913d19411da29adf65279e2d9094020c073339d638 Mon Sep 17 00:00:00 2001 From: Sebastian Parschauer Date: Tue, 15 Aug 2017 15:31:07 +0000 Subject: [PATCH 3/3] - Fix s390x --wipesignatures regression caused by fate#320525 (bsc#1047031) - amend: parted-implement-wipesignatures-option.patch - refresh: 0002-dasd-enhance-device-probing.patch OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=131 --- 0002-dasd-enhance-device-probing.patch | 2 +- parted-implement-wipesignatures-option.patch | 47 +++++++++----------- parted.changes | 8 ++++ 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/0002-dasd-enhance-device-probing.patch b/0002-dasd-enhance-device-probing.patch index 2e1cb7c..f1c2a2d 100644 --- a/0002-dasd-enhance-device-probing.patch +++ b/0002-dasd-enhance-device-probing.patch @@ -141,7 +141,7 @@ Acked-by: Sebastian Parschauer +#elif USE_BLKID get_minimum_alignment: linux_get_minimum_alignment, get_optimum_alignment: linux_get_optimum_alignment, - wipe_signatures: linux_wipe_signatures, + #endif --- a/libparted/device.c +++ b/libparted/device.c @@ -550,16 +550,10 @@ ped_device_get_optimum_alignment(const P diff --git a/parted-implement-wipesignatures-option.patch b/parted-implement-wipesignatures-option.patch index 348f952..0354650 100644 --- a/parted-implement-wipesignatures-option.patch +++ b/parted-implement-wipesignatures-option.patch @@ -1,13 +1,14 @@ -From f5216170b98e0c28dfee717fb03b6a06bcc2a3ee Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Thu, 28 Apr 2016 17:18:44 +0200 Subject: [PATCH] parted: implement --wipesignatures option +References: bsc#943623, fate#319893, bsc#980834 +Patch-mainline: no, custom extension With this option, parted uses libblkid to wipe superblock signatures from a disk region where it is about to create a new partition. -References: bsc#943623 -References: fate#319893 +[sparschauer: Use own #if USE_BLKID block in linux_dev_ops (bsc#1047031)] +Signed-off-by: Sebastian Parschauer --- doc/C/parted.8 | 4 ++++ include/parted/device.in.h | 2 ++ @@ -16,10 +17,8 @@ References: fate#319893 parted/parted.c | 16 ++++++++++++++++ 5 files changed, 78 insertions(+) -Index: parted-3.2/doc/C/parted.8 -=================================================================== ---- parted-3.2.orig/doc/C/parted.8 -+++ parted-3.2/doc/C/parted.8 +--- a/doc/C/parted.8 ++++ b/doc/C/parted.8 @@ -30,6 +30,10 @@ never prompts for user intervention .B -v, --version displays the version @@ -31,10 +30,8 @@ Index: parted-3.2/doc/C/parted.8 .B -a \fIalignment-type\fP, --align \fIalignment-type\fP Set alignment for newly created partitions, valid alignment types are: .RS -Index: parted-3.2/include/parted/device.in.h -=================================================================== ---- parted-3.2.orig/include/parted/device.in.h -+++ parted-3.2/include/parted/device.in.h +--- a/include/parted/device.in.h ++++ b/include/parted/device.in.h @@ -119,6 +119,7 @@ struct _PedDeviceArchOps { /* These functions are optional */ PedAlignment *(*get_minimum_alignment)(const PedDevice *dev); @@ -51,11 +48,9 @@ Index: parted-3.2/include/parted/device.in.h /* private stuff ;-) */ -Index: parted-3.2/libparted/arch/linux.c -=================================================================== ---- parted-3.2.orig/libparted/arch/linux.c -+++ parted-3.2/libparted/arch/linux.c -@@ -3297,6 +3297,44 @@ linux_get_optimum_alignment(const PedDev +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -3298,6 +3298,44 @@ linux_get_optimum_alignment(const PedDev blkid_topology_get_alignment_offset(tp) / dev->sector_size, blkid_topology_get_optimal_io_size(tp) / dev->sector_size); } @@ -100,18 +95,18 @@ Index: parted-3.2/libparted/arch/linux.c #endif static PedDeviceArchOps linux_dev_ops = { -@@ -3316,6 +3354,7 @@ static PedDeviceArchOps linux_dev_ops = - #if USE_BLKID +@@ -3318,6 +3356,9 @@ static PedDeviceArchOps linux_dev_ops = get_minimum_alignment: linux_get_minimum_alignment, get_optimum_alignment: linux_get_optimum_alignment, -+ wipe_signatures: linux_wipe_signatures, #endif ++#if USE_BLKID ++ wipe_signatures: linux_wipe_signatures, ++#endif }; -Index: parted-3.2/libparted/device.c -=================================================================== ---- parted-3.2.orig/libparted/device.c -+++ parted-3.2/libparted/device.c + PedDiskArchOps linux_disk_ops = { +--- a/libparted/device.c ++++ b/libparted/device.c @@ -565,4 +565,21 @@ ped_device_get_optimum_alignment(const P return align; } @@ -134,10 +129,8 @@ Index: parted-3.2/libparted/device.c +} + /** @} */ -Index: parted-3.2/parted/parted.c -=================================================================== ---- parted-3.2.orig/parted/parted.c -+++ parted-3.2/parted/parted.c +--- a/parted/parted.c ++++ b/parted/parted.c @@ -76,6 +76,7 @@ static int MEGABYTE_SECTORS (PedDevice* enum { diff --git a/parted.changes b/parted.changes index 73d3846..d9c2e86 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Tue Aug 15 17:21:02 CEST 2017 - sparschauer@suse.de + +- Fix s390x --wipesignatures regression caused by fate#320525 + (bsc#1047031) + - amend: parted-implement-wipesignatures-option.patch + - refresh: 0002-dasd-enhance-device-probing.patch + ------------------------------------------------------------------- Fri Aug 11 16:15:08 CEST 2017 - sparschauer@suse.de