[parted-devel] [PATCH] parted: make the warning message more informative

Petr Uzel petr.uzel at suse.cz
Mon Oct 10 13:53:09 UTC 2011


Following parted message is not quite useful:

Error: You requested a partition from 2.00MiB to 3.00MiB.
The closest location we can manage is 2.00MiB to 3.00MiB.

Improve the message by including exact geometry (in sectors):

Error: You requested a partition from 2.00MiB to 3.00MiB (sectors 2048 - 3072).
The closest location we can manage is 2.00MiB to 3.00MiB (sectors 2049 - 3072).

* parted/parted.c (do_mkpart): Include exact partition geometry in
the warning message.
---
 parted/parted.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index bc14322..2af3cbd 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -651,10 +651,14 @@ do_mkpart (PedDevice** dev)
                                 (opt_script_mode
                                  ? PED_EXCEPTION_CANCEL
                                  : PED_EXCEPTION_YES_NO),
-                                _("You requested a partition from %s to %s.\n"
+                                _("You requested a partition from %s to %s "
+                                  "(sectors %llu - %llu).\n"
                                   "The closest location we can manage is "
-                                  "%s to %s.%s"),
-                                start_usr, end_usr, start_sol, end_sol,
+                                  "%s to %s (sectors %llu - %llu).%s"),
+                                start_usr, end_usr,
+                                start, end,
+                                start_sol, end_sol,
+                                part->geom.start, part->geom.end,
                                 (opt_script_mode ? ""
                                  : _("\nIs this still acceptable to you?"))))
                         {
-- 
1.7.3.4




More information about the parted-devel mailing list