File parted-ui-remove-unneccesary-information-of-command.patch of Package parted.15765

From 0b7946a095f307e427b81795cbc96028ee179b91 Mon Sep 17 00:00:00 2001
From: Wang Dong <>
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 <>
Signed-off-by: Hendrik Brueckner <>
 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,
openSUSE Build Service is sponsored by