Hello community, here is the log from the commit of package parted for openSUSE:Factory checked in at 2019-07-22 12:17:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/parted (Old) and /work/SRC/openSUSE:Factory/.parted.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "parted" Mon Jul 22 12:17:03 2019 rev:127 rq:714064 version:3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/parted/parted.changes 2018-08-06 11:51:52.104993491 +0200 +++ /work/SRC/openSUSE:Factory/.parted.new.4126/parted.changes 2019-07-22 12:17:04.891716851 +0200 @@ -1,0 +2,34 @@ +Mon Jul 1 14:14:36 UTC 2019 - Anna Maresova <ani...@suse.com> + +- port fixes for various bugs from upstream (bsc#1136245) + - add: libparted-dasd-correct-the-offset-where-the-first-pa.patch + 4126d02, correct the offset where the first partition begins. + This patch implements libparted-dasd-do-not-use-first-tracks.patch + - remove: libparted-dasd-do-not-use-first-tracks.patch + - add: parted-fix-crash-due-to-improper-partition-number-in.patch + 149f009, fix crash due to improper partition number input, + changed call to strtol, use base 0 to fit our parted-type.patch + - modify: parted-type.patch (removed ui.c part) + - add: parted-check-the-name-of-partition-first-when-to-nam.patch + d7a2ff1, check the name of partition first when to name a partition + - add: libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch + c11f5c0, 571e078, add test cases for the new fdasd functions + - add: libparted-dasd-add-an-exception-for-changing-DASD-LD.patch + ee2c0c2, add an exception for changing DASD-LDL partition table + - add: libpartd-dasd-improve-flag-processing-for-DASD-LDL.patch + 1545d6d, improve flag processing for DASD-LDL + - add: clean-the-disk-information-when-commands-fail-in-int.patch + 5a61f15, clean the disk information when commands fail in + interactive mode + - add: parted-ui-remove-unneccesary-information-of-command.patch + 0b7946a, remove unneccesary information of command line + - add: parted-fix-wrong-error-label-jump-in-mkpart.patch + af150f6, fix wrong error label jump in mkpart + - refresh: libparted-dasd-unify-vtoc-handling-for-cdl-ldl.patch + 4f25d54, unify vtoc handling for cdl/ldl + - refresh: libparted-dasd-update-and-improve-fdasd-functions.patch + db37c8c, update and improve fdasd functions + - refresh: libparted-dasd-add-new-fdasd-functions.patch + b9e1281, add new fdasd functions + +------------------------------------------------------------------- Old: ---- libparted-dasd-do-not-use-first-tracks.patch New: ---- clean-the-disk-information-when-commands-fail-in-int.patch libpartd-dasd-improve-flag-processing-for-DASD-LDL.patch libparted-dasd-add-an-exception-for-changing-DASD-LD.patch libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch libparted-dasd-correct-the-offset-where-the-first-pa.patch parted-check-the-name-of-partition-first-when-to-nam.patch parted-fix-crash-due-to-improper-partition-number-in.patch parted-fix-wrong-error-label-jump-in-mkpart.patch parted-ui-remove-unneccesary-information-of-command.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ parted.spec ++++++ --- /var/tmp/diff_new_pack.3s9wfr/_old 2019-07-22 12:17:06.151716509 +0200 +++ /var/tmp/diff_new_pack.3s9wfr/_new 2019-07-22 12:17:06.155716507 +0200 @@ -1,7 +1,7 @@ # # spec file for package parted # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,7 +12,7 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # @@ -40,7 +40,6 @@ Patch17: dummy-bootcode-only-for-x86.patch Patch18: parted-type.patch Patch19: parted-mac.patch -Patch20: libparted-dasd-do-not-use-first-tracks.patch Patch21: libparted-use-BLKRRPART-for-DASD.patch.patch Patch22: libparted-allow-bigger-snap-radius-if-cylinders-are-used.patch Patch23: libparted-make-BLKRRPART-more-robust.patch @@ -88,6 +87,18 @@ Patch60: libparted-use-BLKRRPART-only-when-needed.patch Patch61: libparted-canonicalize-dev-md-paths.patch Patch62: libparted-sysmacros.patch + +# bsc#1136245 +Patch63: libparted-dasd-correct-the-offset-where-the-first-pa.patch +Patch64: parted-fix-crash-due-to-improper-partition-number-in.patch +Patch65: parted-fix-wrong-error-label-jump-in-mkpart.patch +Patch66: clean-the-disk-information-when-commands-fail-in-int.patch +Patch67: parted-check-the-name-of-partition-first-when-to-nam.patch +Patch68: parted-ui-remove-unneccesary-information-of-command.patch +Patch69: libpartd-dasd-improve-flag-processing-for-DASD-LDL.patch +Patch70: libparted-dasd-add-an-exception-for-changing-DASD-LD.patch +Patch71: libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch + # Fatresize Patch100: parted-fatresize-autoconf.patch Patch101: fatresize-fix-getting-dev-name.patch @@ -161,7 +172,6 @@ %patch17 -p1 %patch18 -p1 %patch19 -p1 -%patch20 -p1 %patch21 -p1 %patch22 -p1 %patch23 -p1 @@ -203,6 +213,15 @@ %patch60 -p1 %patch61 -p1 %patch62 -p1 +%patch63 -p1 +%patch64 -p1 +%patch65 -p1 +%patch66 -p1 +%patch67 -p1 +%patch68 -p1 +%patch69 -p1 +%patch70 -p1 +%patch71 -p1 %patch100 -p1 %patch101 -p1 %patch150 -p1 ++++++ clean-the-disk-information-when-commands-fail-in-int.patch ++++++ >From 5a61f15b7003cba73e6517ac22204bafd9a3cb8e Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 23 Dec 2016 06:53:38 +0100 Subject: [PATCH] clean the disk information when commands fail in interactive mode. parted always reads disk information to memory before any operations. The disk that user operates is actually a copy of real one in memory. When the information in memory is changed, it will commit the memory to device to update the disk information. Once the disk information is read, parted will never re-read it again unless another device is loaded or the device is re-read. Above work has been done in commit 7eac058 (parted: don't reload partition table on every command) Each command of parted always commits the memory when it succeeds. Then the disk information on device and in memory are the same. But when it fails, they might be different. User will be confused by this, and sometimes get undesired result with the contaminated memory. This memory should be cleaned if some command fails. Then the command followed will re-read the disk. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- parted/parted.c | 14 ++++++++++---- parted/ui.c | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) Index: parted-3.2/parted/parted.c =================================================================== --- parted-3.2.orig/parted/parted.c +++ parted-3.2/parted/parted.c @@ -1501,8 +1501,12 @@ _rescue_add_partition (PedPartition* par default: break; } - ped_partition_set_system (part, fs_type); - ped_disk_commit (part->disk); + if (!ped_partition_set_system (part, fs_type)) + return 0; + + if (!ped_disk_commit (part->disk)) + return 0; + return 1; } @@ -1727,8 +1731,10 @@ do_rm (PedDevice** dev, PedDisk** diskp) if (!_partition_warn_busy (part, danger_if_busy)) goto error; - ped_disk_delete_partition (*diskp, part); - ped_disk_commit (*diskp); + if (!ped_disk_delete_partition (*diskp, part)) + goto error; + if (!ped_disk_commit (*diskp)) + goto error; if ((*dev)->type != PED_DEVICE_FILE) disk_is_modified = 1; Index: parted-3.2/parted/ui.c =================================================================== --- parted-3.2.orig/parted/ui.c +++ parted-3.2/parted/ui.c @@ -1614,8 +1614,14 @@ interactive_mode (PedDevice** dev, PedDi cmd = command_get (commands, word); free (word); if (cmd) { - if (!command_run (cmd, dev, disk)) + if (!command_run (cmd, dev, disk)) { command_line_flush (); + + if (*disk) { + ped_disk_destroy (*disk); + *disk = 0; + } + } } else print_commands_help (); } ++++++ libpartd-dasd-improve-flag-processing-for-DASD-LDL.patch ++++++ >From 1545d6d4db29fa20f0c611786a094521e8974d4a Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 24 Mar 2017 03:11:12 +0100 Subject: [PATCH] libpartd/dasd: improve flag processing for DASD-LDL DASD-LDL does not support flag now, so all the flags are unavailable to it. Signed-off-by: Andre Wild <w...@linux.vnet.ibm.com> Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- libparted/labels/dasd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Index: parted-3.2/libparted/labels/dasd.c =================================================================== --- parted-3.2.orig/libparted/labels/dasd.c +++ parted-3.2/libparted/labels/dasd.c @@ -788,10 +788,24 @@ dasd_partition_get_flag (const PedPartit } } +/* + * The DASD-LDL does not support flags now. + * So just return 0. +*/ static int dasd_partition_is_flag_available (const PedPartition* part, PedPartitionFlag flag) { + DasdDiskSpecific* disk_specific; + PED_ASSERT (part != NULL); + PED_ASSERT (part->disk != NULL); + PED_ASSERT (part->disk->disk_specific != NULL); + + disk_specific = part->disk->disk_specific; + + if (disk_specific->format_type == 1) + return 0; + switch (flag) { case PED_PARTITION_SWAP: return 1; ++++++ libparted-dasd-add-an-exception-for-changing-DASD-LD.patch ++++++ >From ee2c0c20fb215af43b12195e8cd645cc1a0bd96e Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 24 Mar 2017 11:20:09 +0100 Subject: [PATCH] libparted/dasd: add an exception for changing DASD-LDL partition table The partition table of DASD-LDL device with the dasd disk label should not be changed according to its character in Linux. When the user tries to modify the partition table, an exception will be raised to inform user of this character. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- libparted/labels/dasd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) Index: parted-3.2/libparted/labels/dasd.c =================================================================== --- parted-3.2.orig/libparted/labels/dasd.c +++ parted-3.2/libparted/labels/dasd.c @@ -617,8 +617,12 @@ dasd_write (const PedDisk* disk) PDEBUG; /* If not formated in CDL, don't write anything. */ - if (disk_specific->format_type == 1) + if (disk_specific->format_type == 1) { + ped_exception_throw (PED_EXCEPTION_ERROR, + PED_EXCEPTION_CANCEL, + _("The partition table of DASD-LDL device cannot be changed.\n")); return 1; + } /* Ensure the device is open RW */ char dummy[10]; /* to avoid assertion in ped_device_write */ ++++++ libparted-dasd-add-new-fdasd-functions.patch ++++++ --- /var/tmp/diff_new_pack.3s9wfr/_old 2019-07-22 12:17:06.271716476 +0200 +++ /var/tmp/diff_new_pack.3s9wfr/_new 2019-07-22 12:17:06.275716475 +0200 @@ -1,9 +1,7 @@ +From b9e12819ecef30087753b967bebc9809120593a6 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Wed, 26 Oct 2016 04:22:48 +0200 -Subject: libparted/dasd: add new fdasd functions -References: fate#321531 -Patch-mainline: v3.3 -Git-commit: b9e12819ecef30087753b967bebc9809120593a6 +Subject: [PATCH] libparted/dasd: add new fdasd functions Introduce a set of new functions from the fdasd utility of the s390-tools to keep the code base in parted and s390-tools in sync. @@ -17,15 +15,16 @@ Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <b...@redhat.com> -Acked-by: Sebastian Parschauer <sparscha...@suse.de> --- include/parted/fdasd.in.h | 4 ++ libparted/labels/fdasd.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) +diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h +index 09a35a0..9e5d7d1 100644 --- a/include/parted/fdasd.in.h +++ b/include/parted/fdasd.in.h -@@ -293,5 +293,9 @@ void fdasd_recreate_vtoc(fdasd_anchor_t +@@ -293,5 +293,9 @@ void fdasd_recreate_vtoc(fdasd_anchor_t *anc); partition_info_t * fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, unsigned int stop); int fdasd_prepare_labels (fdasd_anchor_t *anc, int fd) ; @@ -35,9 +34,11 @@ +void fdasd_reuse_vtoc(fdasd_anchor_t *anc); #endif /* FDASD_H */ +diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c +index e5df5cf..713ed6b 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c -@@ -1320,4 +1320,127 @@ fdasd_add_partition (fdasd_anchor_t *anc +@@ -1320,4 +1320,127 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, return p; } @@ -165,3 +166,6 @@ +} + /* vim:set tabstop=4 shiftwidth=4 softtabstop=4: */ +-- +2.16.4 + ++++++ libparted-dasd-add-test-cases-for-the-new-fdasd-func.patch ++++++ >From c11f5c005270d24bc3905ab3b743e96fc1a9a507 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Thu, 20 Apr 2017 10:20:07 +0200 Subject: [PATCH] libparted/dasd: add test cases for the new fdasd functions The test case uses a temporary file in libparted/tests under Check framwork.It can be issued by "make check" in the test dir. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- libparted/tests/t4000-volser.sh | 20 +++++ libparted/tests/volser.c | 188 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 208 insertions(+) create mode 100755 libparted/tests/t4000-volser.sh create mode 100644 libparted/tests/volser.c diff --git a/libparted/tests/t4000-volser.sh b/libparted/tests/t4000-volser.sh new file mode 100755 index 0000000..89688ba --- /dev/null +++ b/libparted/tests/t4000-volser.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +. "${top_srcdir=../..}/tests/init.sh"; path_prepend_ . + +volser || fail=1 + +Exit $fail diff --git a/libparted/tests/volser.c b/libparted/tests/volser.c new file mode 100644 index 0000000..9063821 --- /dev/null +++ b/libparted/tests/volser.c @@ -0,0 +1,188 @@ +/* + * Author: Wang Dong <dongd...@cn.ibm.com> + */ + +#include <config.h> +#include <unistd.h> +#include <check.h> + +#include <parted/vtoc.h> +#include <parted/device.h> +#include <parted/fdasd.h> +#include <parted/vtoc.h> +#include "../arch/linux.h" +#include "common.h" +#include "progname.h" + +/* set dasd first */ +static char vol_devno[7] = {0}; +static char *tmp_disk; +static int fd; + +static PedDisk *disk; +static struct fdasd_anchor anc; +static fdasd_anchor_t *anchor = &anc; +static LinuxSpecific *arch_specific; + +/* set the enviroment */ +static void set_test (void) +{ + PedDevice *dev; + PedDiskType *type; + type = ped_disk_type_get ("dasd"); + + tmp_disk = _create_disk (20*1024*1024); + fail_if (tmp_disk == NULL, "Failed to create temporary disk"); + dev = ped_device_get (tmp_disk); + if (dev == NULL) + return; + + disk = _create_disk_label (dev, type); + if (!ped_device_open (disk->dev)) + return; + + fdasd_initialize_anchor (anchor); + arch_specific = LINUX_SPECIFIC (disk->dev); + fd = arch_specific->fd; + if (!fdasd_get_geometry (dev, anchor, fd)) + return; + + fdasd_check_volume (anchor, fd); + sprintf (vol_devno, "0X%04x", anchor->devno); + ck_assert (strlen (vol_devno) == VOLSER_LENGTH); +} + +static void free_test (void) +{ + ped_device_close (disk->dev); + ped_device_destroy (disk->dev); + unlink (tmp_disk); + free (tmp_disk); + fdasd_cleanup (anchor); +} + +/* Test with default volser */ +START_TEST (test_get_volser) +{ + char volser[7] = {0}; + fdasd_change_volser (anchor, vol_devno); + fdasd_write_labels (anchor, fd); + + fdasd_get_volser (anchor, volser, fd); + ck_assert (!strcmp (volser, vol_devno)); +} +END_TEST + +START_TEST (test_check_volser) +{ + char vol[7] = {0}; + char vol_long[] = "abcdefg"; + char vol_short[] = "ab_c "; + char vol_null[] = " "; + char *vol_input = NULL; + + vol_input = vol_long; + fdasd_check_volser (vol_input, anchor->devno); + ck_assert(!strcmp (vol_input, "ABCDEF")); + + vol_input = vol_short; + fdasd_check_volser (vol_input, anchor->devno); + ck_assert (!strcmp (vol_input, "ABC")); + + vol_input = vol_null; + fdasd_check_volser (vol_input, anchor->devno); + ck_assert (!strcmp (vol_input, vol_devno)); +} +END_TEST + +START_TEST (test_change_volser) +{ + + char vol[] = "000000"; + char volser[7] = {0}; + + fdasd_change_volser (anchor, vol); + fdasd_write_labels (anchor, fd); + + fdasd_get_volser (anchor, volser, fd); + ck_assert (!strcmp (volser, vol)); +} +END_TEST + +/* + * fdsad_recreate_vtoc recreate the VTOC with existing one. + * So the partition information should be not changed after recreating + * VTOC. +*/ +START_TEST (test_reuse_vtoc) +{ + ds5ext_t before; + ds5ext_t after; + + memcpy (&before, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t)); + + if (anchor->fspace_trk) { + fdasd_reuse_vtoc (anchor); + memcpy (&after, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t)); + if ((before.t != after.t) && (before.fc != after.fc) && (before.ft != after.ft)) + ck_abort (); + } else { + fdasd_reuse_vtoc (anchor); + memcpy (&after, &anchor->f5->DS5AVEXT, sizeof(ds5ext_t)); + if ((before.t != after.t) && (before.fc != after.fc) && (before.ft != after.ft)) + ck_abort (); + } +} +END_TEST + +int main (int argc, char **argv) +{ + + set_program_name (argv[0]); + +#if defined __s390__ || defined __s390x__ + + int number_failed = 0; + + Suite *suite = suite_create ("Volser"); + + TCase *tcase_get = tcase_create ("Get"); + TCase *tcase_check = tcase_create ("Check"); + TCase *tcase_change = tcase_create ("Change"); + TCase *tcase_vtoc = tcase_create ("Vtoc"); + + ped_exception_set_handler (_test_exception_handler); + + tcase_add_checked_fixture (tcase_check, set_test, free_test); + tcase_add_test (tcase_check, test_check_volser); + tcase_set_timeout (tcase_check, 0); + suite_add_tcase (suite, tcase_check); + + tcase_add_checked_fixture (tcase_change, set_test, free_test); + tcase_add_test (tcase_change, test_change_volser); + tcase_set_timeout (tcase_change, 0); + suite_add_tcase (suite, tcase_change); + + tcase_add_checked_fixture (tcase_get, set_test, free_test); + tcase_add_test (tcase_get, test_get_volser); + tcase_set_timeout (tcase_get, 0); + suite_add_tcase (suite, tcase_get); + + tcase_add_checked_fixture (tcase_vtoc, set_test, free_test); + tcase_add_test (tcase_vtoc, test_reuse_vtoc); + tcase_set_timeout (tcase_vtoc, 0); + suite_add_tcase (suite, tcase_vtoc); + + SRunner *srunner = srunner_create (suite); + /* When to debug, uncomment this line */ + /* srunner_set_fork_status (srunner, CK_NOFORK); */ + + srunner_run_all (srunner, CK_VERBOSE); + + number_failed = srunner_ntests_failed (srunner); + srunner_free (srunner); + return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; + +#endif + return 0; +} -- 2.16.4 >From 571e078406b59e8dcf02db3e8fe28d8eb4d2cef0 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Wed, 26 Oct 2016 04:22:49 +0200 Subject: [PATCH] libparted/dasd: add test cases for the new fdasd functions The test case uses a temporary file in libparted/tests under Check framwork. It can be issued by "make check" in the test dir. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <b...@redhat.com> --- libparted/tests/Makefile.am | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libparted/tests/Makefile.am b/libparted/tests/Makefile.am index c7c10a9..9689fb3 100644 --- a/libparted/tests/Makefile.am +++ b/libparted/tests/Makefile.am @@ -3,9 +3,9 @@ # # This file may be modified and/or distributed without restriction. -TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh +TESTS = t1000-label.sh t2000-disk.sh t2100-zerolen.sh t3000-symlink.sh t4000-volser.sh EXTRA_DIST = $(TESTS) -check_PROGRAMS = label disk zerolen symlink +check_PROGRAMS = label disk zerolen symlink volser AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) LDADD = \ @@ -23,6 +23,7 @@ label_SOURCES = common.h common.c label.c disk_SOURCES = common.h common.c disk.c zerolen_SOURCES = common.h common.c zerolen.c symlink_SOURCES = common.h common.c symlink.c +volser_SOURCES = common.h common.c volser.c # Arrange to symlink to tests/init.sh. CLEANFILES = init.sh -- 2.16.4 ++++++ libparted-dasd-correct-the-offset-where-the-first-pa.patch ++++++ >From 4126d0292c75cf7d50a2f4e9d485a52b5beafccc Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Tue, 14 Jun 2016 12:19:40 +0200 Subject: [PATCH] libparted/dasd: correct the offset where the first partition begins The start point of first partition must start at least from the third track of DASD, due to the existence of metadata in the first two track. The previous constraint just sets all the device to be partitioned. So when the start point of the first partition start before the third track, (For example if it starts from.0) parted will exit abruptly. And this kind of job must be done with constraint explicitly. Then the constraint is modified to exclude the first two tracks and to make the first partition start from the third track by default. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Reviewed-by: Viktor Mihajlovski <mihaj...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <b...@redhat.com> --- libparted/labels/dasd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c index f79a867..4e68512 100644 --- a/libparted/labels/dasd.c +++ b/libparted/labels/dasd.c @@ -829,6 +829,7 @@ _primary_constraint (PedDisk* disk) PedSector sector_size; LinuxSpecific* arch_specific; DasdDiskSpecific* disk_specific; + PedSector start; PDEBUG; @@ -842,7 +843,12 @@ _primary_constraint (PedDisk* disk) if (!ped_alignment_init (&end_align, -1, disk->dev->hw_geom.sectors * sector_size)) return NULL; - if (!ped_geometry_init (&max_geom, disk->dev, 0, disk->dev->length)) + + start = (FIRST_USABLE_TRK * (long long) disk->dev->hw_geom.sectors + * (long long) arch_specific->real_sector_size + / (long long) disk->dev->sector_size); + + if (!ped_geometry_init (&max_geom, disk->dev, start, disk->dev->length)) return NULL; return ped_constraint_new(&start_align, &end_align, &max_geom, -- 2.16.4 ++++++ libparted-dasd-unify-vtoc-handling-for-cdl-ldl.patch ++++++ --- /var/tmp/diff_new_pack.3s9wfr/_old 2019-07-22 12:17:06.311716465 +0200 +++ /var/tmp/diff_new_pack.3s9wfr/_new 2019-07-22 12:17:06.311716465 +0200 @@ -1,9 +1,7 @@ +From 4f25d54d4d2bd6ae12d56b5a97ed2b7f60f753e9 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Wed, 26 Oct 2016 04:22:46 +0200 -Subject: libparted/dasd: unify vtoc handling for cdl/ldl -References: fate#321531 -Patch-mainline: v3.3 -Git-commit: 4f25d54d4d2bd6ae12d56b5a97ed2b7f60f753e9 +Subject: [PATCH] libparted/dasd: unify vtoc handling for cdl/ldl Merge volume label cdl and ldl. It is convenient to manipulate the same structure. Also remove unused arguments in the functions. @@ -11,13 +9,14 @@ Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <b...@redhat.com> -Acked-by: Sebastian Parschauer <sparscha...@suse.de> --- include/parted/vtoc.in.h | 34 +++++++++++++++++++--------------- libparted/labels/dasd.c | 8 +++----- libparted/labels/vtoc.c | 38 +++++++++++++++++--------------------- 3 files changed, 39 insertions(+), 41 deletions(-) +diff --git a/include/parted/vtoc.in.h b/include/parted/vtoc.in.h +index 499c2d3..b9da23a 100644 --- a/include/parted/vtoc.in.h +++ b/include/parted/vtoc.in.h @@ -62,7 +62,6 @@ typedef struct cchh cchh_t; @@ -28,7 +27,7 @@ typedef struct extent extent_t; typedef struct dev_const dev_const_t; typedef struct format1_label format1_label_t; -@@ -94,6 +93,19 @@ struct __attribute__ ((packed)) labeldat +@@ -94,6 +93,19 @@ struct __attribute__ ((packed)) labeldate { u_int16_t day; }; @@ -48,7 +47,7 @@ struct __attribute__ ((packed)) volume_label { char volkey[4]; /* volume key = volume label */ char vollbl[4]; /* volume label ("VOL1" in EBCDIC) */ -@@ -107,15 +119,8 @@ struct __attribute__ ((packed)) volume_l +@@ -107,15 +119,8 @@ struct __attribute__ ((packed)) volume_label { char labperci[4]; /* no of labels per CI (FBA), blanks for CKD */ char res2[4]; /* reserved */ char lvtoc[14]; /* owner code for LVTOC */ @@ -66,7 +65,7 @@ u_int64_t formatted_blocks; /* valid when ldl_version >= "2" (in EBCDIC) */ }; -@@ -335,11 +340,10 @@ void vtoc_write_label (int fd, unsigned +@@ -335,11 +340,10 @@ void vtoc_write_label (int fd, unsigned long position, format7_label_t const *f7, format9_label_t const *f9); @@ -79,7 +78,7 @@ unsigned int compat_cylinders, unsigned int real_cylinders, unsigned int tracks, -@@ -352,11 +356,11 @@ void vtoc_update_format4_label (format4_ +@@ -352,11 +356,11 @@ void vtoc_update_format4_label (format4_label_t *f4, cchhb_t *highest_f1, void vtoc_init_format5_label (format5_label_t *f5); @@ -93,7 +92,7 @@ int trk, u_int16_t a, u_int16_t b, u_int8_t c); -@@ -368,7 +372,7 @@ void vtoc_update_format7_label_add (form +@@ -368,7 +372,7 @@ void vtoc_update_format7_label_add (format7_label_t *f7, int verbose, void vtoc_update_format7_label_del (format7_label_t *f7, int verbose, u_int32_t a, u_int32_t b); @@ -102,9 +101,11 @@ extent_t *part_extent, format1_label_t *f1); void vtoc_update_format8_label (cchhb_t *associated_f9, format1_label_t *f8); +diff --git a/libparted/labels/dasd.c b/libparted/labels/dasd.c +index 4e68512..7594e96 100644 --- a/libparted/labels/dasd.c +++ b/libparted/labels/dasd.c -@@ -345,13 +345,12 @@ dasd_read (PedDisk* disk) +@@ -330,13 +330,12 @@ dasd_read (PedDisk* disk) DasdPartitionData* dasd_data; union vollabel { @@ -120,7 +121,7 @@ int partition_start_block; disk_specific->format_type = 1; -@@ -375,8 +374,7 @@ dasd_read (PedDisk* disk) +@@ -360,8 +359,7 @@ dasd_read (PedDisk* disk) * (long long) cms_ptr->disk_offset; if (is_ldl) @@ -130,6 +131,8 @@ end = (long long) arch_specific->real_sector_size / (long long) disk->dev->sector_size * (long long) ldl_ptr->formatted_blocks - 1; +diff --git a/libparted/labels/vtoc.c b/libparted/labels/vtoc.c +index fdfa94f..d47b791 100644 --- a/libparted/labels/vtoc.c +++ b/libparted/labels/vtoc.c @@ -150,7 +150,7 @@ enum failure { @@ -150,7 +153,7 @@ vtoc_ebcdic_enc(buffer, buffer, sizeof *vlabel); memcpy(vlabel, buffer, sizeof *vlabel); } -@@ -348,8 +348,8 @@ vtoc_read_volume_label (int f, unsigned +@@ -348,8 +348,8 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start, typedef union vollabel vollabel_t; union __attribute__((packed)) vollabel { @@ -160,7 +163,7 @@ cms_volume_label_t cms; }; -@@ -373,9 +373,7 @@ vtoc_read_volume_label (int f, unsigned +@@ -373,9 +373,7 @@ vtoc_read_volume_label (int f, unsigned long vlabel_start, } rc = read(f, vlabel, sizeof(volume_label_t)); @@ -171,7 +174,7 @@ vtoc_error(unable_to_read, "vtoc_read_volume_label", _("Could not read volume label.")); return 1; -@@ -427,10 +425,8 @@ vtoc_write_volume_label (int f, unsigned +@@ -427,10 +425,8 @@ vtoc_write_volume_label (int f, unsigned long vlabel_start, vtoc_error(unable_to_seek, "vtoc_write_volume_label", _("Could not write volume label.")); @@ -184,7 +187,7 @@ vtoc_error(unable_to_write, "vtoc_write_volume_label", _("Could not write volume label.")); -@@ -632,7 +628,7 @@ vtoc_write_label (int f, unsigned long p +@@ -632,7 +628,7 @@ vtoc_write_label (int f, unsigned long position, * initializes a format4 label */ void @@ -193,7 +196,7 @@ unsigned int compat_cylinders, unsigned int real_cylinders, unsigned int tracks, unsigned int blocks, unsigned int blksize, -@@ -740,7 +736,7 @@ vtoc_init_format7_label (format7_label_t +@@ -740,7 +736,7 @@ vtoc_init_format7_label (format7_label_t *f7) * format1 or format 8 label, all but the field DS1FMTID */ void @@ -202,7 +205,7 @@ extent_t *part_extent, format1_label_t *f1) { PDEBUG -@@ -794,18 +790,18 @@ vtoc_init_format_1_8_label (char *volid, +@@ -794,18 +790,18 @@ vtoc_init_format_1_8_label (char *volid, unsigned int blksize, } void @@ -225,7 +228,7 @@ f8->DS1FMTID = 0xf8; } -@@ -886,7 +882,7 @@ vtoc_reorganize_FMT5_extents (format5_la +@@ -886,7 +882,7 @@ vtoc_reorganize_FMT5_extents (format5_label_t *f5) * add a free space extent description to the VTOC FMT5 DSCB */ void @@ -234,7 +237,7 @@ int trk, u_int16_t a, u_int16_t b, u_int8_t c) { PDEBUG -@@ -974,7 +970,7 @@ vtoc_update_format5_label_add (format5_l +@@ -974,7 +970,7 @@ vtoc_update_format5_label_add (format5_label_t *f5, int verbose, int cyl, * remove a free space extent description from the VTOC FMT5 DSCB */ void @@ -243,7 +246,7 @@ int trk, u_int16_t a, u_int16_t b, u_int8_t c) { PDEBUG -@@ -1054,7 +1050,7 @@ vtoc_update_format5_label_del (format5_l +@@ -1054,7 +1050,7 @@ vtoc_update_format5_label_del (format5_label_t *f5, int verbose, int cyl, ext->ft = (a - ext->t) % trk; vtoc_update_format5_label_add(f5, verbose, @@ -252,7 +255,7 @@ if (verbose) puts ("FMT5 del extent: 2 pieces"); -@@ -1322,9 +1318,9 @@ vtoc_set_freespace(format4_label_t *f4, +@@ -1322,9 +1318,9 @@ vtoc_set_freespace(format4_label_t *f4, format5_label_t *f5, z = (u_int8_t) ((stop - start + 1) % trk); if (ch == '+') @@ -264,3 +267,6 @@ else puts ("BUG: syntax error in vtoc_set_freespace call"); +-- +2.16.4 + ++++++ libparted-dasd-update-and-improve-fdasd-functions.patch ++++++ --- /var/tmp/diff_new_pack.3s9wfr/_old 2019-07-22 12:17:06.319716463 +0200 +++ /var/tmp/diff_new_pack.3s9wfr/_new 2019-07-22 12:17:06.319716463 +0200 @@ -1,9 +1,7 @@ +From db37c8c017ebef8f241420dda071940957d4bbe5 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Wed, 26 Oct 2016 04:22:47 +0200 -Subject: libparted/dasd: update and improve fdasd functions -References: fate#321531 -Patch-mainline: v3.3 -Git-commit: db37c8c017ebef8f241420dda071940957d4bbe5 +Subject: [PATCH] libparted/dasd: update and improve fdasd functions Update the fdasd_anchor_t data structure and the fdasd_cleanup() function. Also correct vtoc_changed and vlabel_changed accounting @@ -13,12 +11,13 @@ Hendrik Brueckner <brueck...@linux.vnet.ibm.com> Signed-off-by: Brian C. Lane <b...@redhat.com> -Acked-by: Sebastian Parschauer <sparscha...@suse.de> --- include/parted/fdasd.in.h | 14 +++++------- libparted/labels/fdasd.c | 56 ++++++++++++++++++++++++----------------------- 2 files changed, 35 insertions(+), 35 deletions(-) +diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h +index 4e351c4..09a35a0 100644 --- a/include/parted/fdasd.in.h +++ b/include/parted/fdasd.in.h @@ -186,6 +186,7 @@ typedef struct format_data_t { @@ -68,6 +67,8 @@ }; void fdasd_cleanup (fdasd_anchor_t *anchor); +diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c +index 968b332..e5df5cf 100644 --- a/libparted/labels/fdasd.c +++ b/libparted/labels/fdasd.c @@ -106,28 +106,26 @@ fdasd_cleanup (fdasd_anchor_t *anchor) @@ -115,7 +116,7 @@ } } -@@ -190,6 +188,9 @@ fdasd_error (fdasd_anchor_t *anc, enum f +@@ -190,6 +188,9 @@ fdasd_error (fdasd_anchor_t *anc, enum fdasd_failure why, char const *str) _("Device verification failed"), _("The specified device is not a valid DASD device")); break; @@ -125,7 +126,7 @@ default: sprintf(error, "fdasd: %s: %s\n", _("Fatal error"), str); } -@@ -287,7 +288,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t +@@ -287,7 +288,7 @@ fdasd_write_vtoc_labels (fdasd_anchor_t * anc, int fd) PDEBUG partition_info_t *p; unsigned long b, maxblk; @@ -134,7 +135,7 @@ int i = 0, k = 0; cchhb_t f9addr; format1_label_t emptyf1; -@@ -519,7 +520,6 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc +@@ -519,7 +520,6 @@ fdasd_recreate_vtoc (fdasd_anchor_t *anc) int i; vtoc_init_format4_label(anc->f4, @@ -142,7 +143,7 @@ anc->geo.cylinders, anc->formatted_cylinders, anc->geo.heads, -@@ -767,7 +767,7 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_ +@@ -767,7 +767,7 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc) anc->formatted_cylinders = anc->hw_cylinders; anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - FIRST_USABLE_TRK; @@ -151,7 +152,7 @@ anc->geo.cylinders, anc->formatted_cylinders, anc->geo.heads, anc->geo.sectors, anc->blksize, anc->dev_type); -@@ -781,6 +781,8 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_ +@@ -781,6 +781,8 @@ fdasd_invalid_vtoc_pointer(fdasd_anchor_t *anc) anc->formatted_cylinders, anc->geo.heads); vtoc_set_cchhb(&anc->vlabel->vtoc, VTOC_START_CC, VTOC_START_HH, 0x01); @@ -160,7 +161,7 @@ } /* -@@ -792,7 +794,7 @@ fdasd_process_invalid_vtoc(fdasd_anchor_ +@@ -792,7 +794,7 @@ fdasd_process_invalid_vtoc(fdasd_anchor_t *anc) anc->formatted_cylinders = anc->hw_cylinders; anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads - FIRST_USABLE_TRK; @@ -169,7 +170,7 @@ anc->geo.cylinders, anc->formatted_cylinders, anc->geo.heads, anc->geo.sectors, anc->blksize, anc->dev_type); -@@ -803,6 +805,8 @@ fdasd_process_invalid_vtoc(fdasd_anchor_ +@@ -803,6 +805,8 @@ fdasd_process_invalid_vtoc(fdasd_anchor_t *anc) FIRST_USABLE_TRK, anc->formatted_cylinders * anc->geo.heads - 1, anc->formatted_cylinders, anc->geo.heads); @@ -178,7 +179,7 @@ } -@@ -875,7 +879,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, +@@ -875,7 +879,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd) fdasd_init_volume_label(anc, fd); @@ -187,7 +188,7 @@ anc->geo.cylinders, anc->formatted_cylinders, anc->geo.heads, anc->geo.sectors, anc->blksize, anc->dev_type); -@@ -1286,12 +1290,10 @@ fdasd_add_partition (fdasd_anchor_t *anc +@@ -1286,12 +1290,10 @@ fdasd_add_partition (fdasd_anchor_t *anc, unsigned int start, return 0; if (anc->formatted_cylinders > LV_COMPAT_CYL) { @@ -202,3 +203,6 @@ } PDEBUG; +-- +2.16.4 + ++++++ parted-check-the-name-of-partition-first-when-to-nam.patch ++++++ >From d7a2ff17b15842bf9a3de65ca1ba577bdf568e79 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 24 Mar 2017 03:11:08 +0100 Subject: [PATCH] parted: check the name of partition first when to name a partition The previous function works well for the labels supporting naming partition, but not for these which don't. If the disk label does not support partition naming, two exceptions will be raised. Even after the first error indicates it does not support name, parted yet asks user for name in iteractive mode. First check if the disk label supports partition naming and if it does, it will continue; otherwise, it will stop and raise an exception. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- parted/parted.c | 7 +++++++ 1 file changed, 7 insertions(+) Index: parted-3.2/parted/parted.c =================================================================== --- parted-3.2.orig/parted/parted.c +++ parted-3.2/parted/parted.c @@ -930,6 +930,13 @@ do_name (PedDevice** dev, PedDisk** disk if (!diskp) goto error; + if (!ped_disk_type_check_feature((*diskp)->type, PED_DISK_TYPE_PARTITION_NAME)) { + ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, + _("%s disk labels do not support partition name."), + (*diskp)->type->name); + goto error; + } + if (!command_line_get_partition (_("Partition number?"), *diskp, &part)) goto error; ++++++ parted-fix-crash-due-to-improper-partition-number-in.patch ++++++ >From 149f009c3b4ab6bac8059b48142a1c3f698c8e53 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 23 Dec 2016 06:53:36 +0100 Subject: [PATCH] parted: fix crash due to improper partition number input When the user makes a new partition, if parted fails to add the partition to disk, it jumps to wrong error label. In this situation, this new partition actually is not a node in disk data structure. But in the wrong error label, it pretends this is a node and removes it as a list node, leading to other partition in this disk deleted. This might lead to a memory leak. Because if there are other partitions, it just removes them from list without releasing the resource. And this also leads to different disk information between memory and device. This is confusing. But when the new partition is added to disk successfully and if any operations followed fail, this partition should be removed from disk and destroyed. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- parted/ui.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/parted/ui.c b/parted/ui.c index 505b8ac..5d76c20 100644 --- a/parted/ui.c +++ b/parted/ui.c @@ -29,6 +29,8 @@ #include <unistd.h> #include <setjmp.h> #include <assert.h> +#include <limits.h> +#include <errno.h> #include "command.h" #include "strlist.h" @@ -909,16 +911,30 @@ command_line_get_integer (const char* prompt, int* value) { char def_str [10]; char* input; - int valid; + long ret; snprintf (def_str, 10, "%d", *value); input = command_line_get_word (prompt, *value ? def_str : NULL, NULL, 1); if (!input) return 0; - valid = sscanf (input, "%d", value); + + errno = 0; + ret = strtol (input, (char**) NULL, 0); + if (errno) + goto error; + + if ((ret > INT_MAX) || (ret < INT_MIN)) + goto error; + else + *value = (int) ret; + free (input); - return valid; + return 1; + +error: + free (input); + return 0; } int @@ -1029,6 +1045,7 @@ command_line_get_partition (const char* prompt, PedDisk* disk, PedPartition** value) { PedPartition* part; + int ret; /* Flawed logic, doesn't seem to work?! check = ped_disk_next_partition (disk, part); @@ -1045,7 +1062,8 @@ command_line_get_partition (const char* prompt, PedDisk* disk, */ int num = (*value) ? (*value)->num : 0; - if (!command_line_get_integer (prompt, &num)) { + ret = command_line_get_integer (prompt, &num); + if ((!ret) || (num < 0)) { ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL, _("Expecting a partition number.")); -- 2.16.4 ++++++ parted-fix-wrong-error-label-jump-in-mkpart.patch ++++++ >From af150f6764a08eae4b4cf448c392259c067a1523 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 23 Dec 2016 06:53:37 +0100 Subject: [PATCH] parted: fix wrong error label jump in mkpart When the user makes a new partition, if parted fails to add the partition to disk, it jumps to wrong error label. In this situation, this new partition actually is not a node in disk data structure. But in the wrong error label, it pretends this is a node and removes it as a list node, leading to other partition in this disk deleted. This might lead to a memory leak. Because if there are other partitions, it just removes them from list without releasing the resource. And this also leads to different disk information between memory and device. This is confusing. But when the new partition is added to disk successfully and if any operations followed fail, this partition should be removed from disk and destroyed. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- parted/parted.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Index: parted-3.2/parted/parted.c =================================================================== --- parted-3.2.orig/parted/parted.c +++ parted-3.2/parted/parted.c @@ -796,7 +796,7 @@ do_mkpart (PedDevice** dev, PedDisk** di ped_constraint_destroy (constraint_any); if (!added_ok) - goto error_remove_part; + goto error_destroy_simple_constraints; if (!ped_geometry_test_sector_inside(range_start, part->geom.start) || !ped_geometry_test_sector_inside(range_end, part->geom.end)) { @@ -865,7 +865,7 @@ do_mkpart (PedDevice** dev, PedDisk** di free (part_name); /* avoid double-free upon failure */ part_name = NULL; if (!ped_partition_set_system (part, fs_type)) - goto error; + goto error_remove_part; if (ped_partition_is_flag_available (part, PED_PARTITION_LBA)) ped_partition_set_flag (part, PED_PARTITION_LBA, 1); if (ped_partition_is_flag_available (part, PED_PARTITION_SWAP) && @@ -881,7 +881,7 @@ do_mkpart (PedDevice** dev, PedDisk** di } if (!ped_disk_commit (disk)) - goto error; + goto error_remove_part; /* clean up */ if (range_start != NULL) @@ -904,7 +904,8 @@ error_remove_part: error_destroy_simple_constraints: ped_partition_destroy (part); error: - free (part_name); + if (part_name) + free (part_name); if (range_start != NULL) ped_geometry_destroy (range_start); if (range_end != NULL) ++++++ parted-type.patch ++++++ --- /var/tmp/diff_new_pack.3s9wfr/_old 2019-07-22 12:17:06.419716436 +0200 +++ /var/tmp/diff_new_pack.3s9wfr/_new 2019-07-22 12:17:06.423716434 +0200 @@ -162,17 +162,3 @@ if (!ped_partition_set_flag (part, flag, state)) goto error; -Index: parted-3.2/parted/ui.c -=================================================================== ---- parted-3.2.orig/parted/ui.c -+++ parted-3.2/parted/ui.c -@@ -913,6 +913,9 @@ command_line_get_integer (const char* pr - NULL, 1); - if (!input) - return 0; -+ if (strstr(input, "0x") == input) -+ valid = sscanf (input, "%x", value); -+ else - valid = sscanf (input, "%d", value); - free (input); - return valid; ++++++ parted-ui-remove-unneccesary-information-of-command.patch ++++++ >From 0b7946a095f307e427b81795cbc96028ee179b91 Mon Sep 17 00:00:00 2001 From: Wang Dong <dongd...@linux.vnet.ibm.com> Date: Fri, 24 Mar 2017 03:11:10 +0100 Subject: [PATCH] parted/ui: remove unneccesary information of command line When some command fails, the information still exists in command_line buffer. When in command mode or interactive mode, if an interactive exception prompts, the remained information will be processed as option from user. This will raise some other information or even unexpected results. So before getting option input from user, clean the command line buffer. Example: When the disk label is invalid and user tries to make new partition on the device with command like, mkpart 0 50%. Then parted will raise an exception telling an invalid disk label found and whether to correct it. But at this time 0 as the input of mkpart will be considered as the option input for the exception(yes/no). So one more exception will raised with error information. Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com> --- parted/ui.c | 1 + 1 file changed, 1 insertion(+) diff --git a/parted/ui.c b/parted/ui.c index af0539c..752860b 100644 --- a/parted/ui.c +++ b/parted/ui.c @@ -1288,6 +1288,7 @@ command_line_get_ex_opt (const char* prompt, PedExceptionOption options) PedExceptionOption opt; char* opt_name; + command_line_flush (); for (opt = option_get_next (options, 0); opt; opt = option_get_next (options, opt)) { options_strlist = str_list_append_unique (options_strlist, -- 2.16.4