[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Fri Oct 14 16:30:28 UTC 2011
parted/parted.c | 10 +++++++---
tests/t-lib-helpers.sh | 6 +++---
tests/t7000-scripting.sh | 12 ++++++------
3 files changed, 16 insertions(+), 12 deletions(-)
New commits:
commit 959d4c2875216d26b2d113cc7119dd8623493e34
Author: Petr Uzel <petr.uzel at suse.cz>
Date: Mon Oct 10 15:53:09 2011 +0200
parted: make a warning message more informative
The following parted message is not very 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):
...requested a partition from 2.00MiB to 3.00MiB (sectors 2048..3072).
... 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.
* tests/t-lib-helpers.sh (normalize_part_diag_): Adapt to
handle the new form of the diagnostic.
* tests/t7000-scripting.sh: Adapt and change the name
of a temporary file.
diff --git a/parted/parted.c b/parted/parted.c
index bc14322..b381768 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?"))))
{
diff --git a/tests/t-lib-helpers.sh b/tests/t-lib-helpers.sh
index d56a111..bb41139 100644
--- a/tests/t-lib-helpers.sh
+++ b/tests/t-lib-helpers.sh
@@ -337,8 +337,8 @@ mdadm_create_linear_device_()
# Often, when parted cannot use the specified size or start/endpoints
# of a partition, it outputs a warning or error like this:
#
-# Error: You requested a partition from 512B to 50.7kB.
-# The closest location we can manage is 17.4kB to 33.8kB.
+# Error: You requested a partition from 512B to 50.7kB (...).
+# The closest location we can manage is 17.4kB to 33.8kB (...).
#
# But those numbers depend on sector size, so
# replace the specific values with place-holders,
@@ -346,7 +346,7 @@ mdadm_create_linear_device_()
normalize_part_diag_()
{
local file=$1
- sed 's/ [0-9.k]*B to [0-9.k]*B\.$/ X to Y./' $file > $file.t \
+ sed 's/ [0-9.k]*B to [0-9.k]*B (sectors .*$/ X to Y./' $file > $file.t \
&& mv $file.t $file && return 0
return 1
}
diff --git a/tests/t7000-scripting.sh b/tests/t7000-scripting.sh
index 4473cb6..20b7d9f 100755
--- a/tests/t7000-scripting.sh
+++ b/tests/t7000-scripting.sh
@@ -29,15 +29,15 @@ grep '^#define HAVE_LIBREADLINE 1' $CONFIG_HEADER > /dev/null \
|| skip_ "configured without readline support"
# The failure messages.
-cat << EOF > errS || fail=1
-Error: You requested a partition from 512B to 50.7kB.
-The closest location we can manage is 17.4kB to 33.8kB.
+cat << EOF > err.expected || fail=1
+Error: You requested a partition from 512B to 50.7kB (sectors 0..0).
+The closest location we can manage is 17.4kB to 33.8kB (sectors 0..0).
EOF
-normalize_part_diag_ errS || fail=1
+normalize_part_diag_ err.expected || fail=1
{ emit_superuser_warning
- sed s/Error/Warning/ errS
+ sed s/Error/Warning/ err.expected
printf 'Is this still acceptable to you?\nYes/No?'; } >> errI || fail=1
for mkpart in mkpart; do
@@ -52,7 +52,7 @@ for mkpart in mkpart; do
# Compare the real error and the expected one
normalize_part_diag_ out || fail=1
- compare out errS || fail=1
+ compare out err.expected || fail=1
# Test mkpart interactive mode.
# Create the test file
More information about the Parted-commits
mailing list