diff options
author | Petr Uzel <petr.uzel@suse.cz> | 2011-10-22 15:22:09 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2011-11-02 16:17:09 +0100 |
commit | 961abca12d1766264651dbe08284aeec3c0396c6 (patch) | |
tree | 080a34331b7c5c6a4114909cf57317c03056b1e9 /bootstrap.conf | |
parent | c2306bc44d2309d1acd011c156295f95d2de819c (diff) | |
download | parted-961abca12d1766264651dbe08284aeec3c0396c6.tar.gz |
parted: mkpart: DWIM for IEC ending sector numbers like 2MiB and 9GiB
Before, if the user specified start and end in mkpart command using
IEC units, parted created a partition that starts and ends exactly on
these positions. With such behavior, it is impossible to create
partitions as follows: 1MiB-2MiB, 2MiB-3MiB - parted would complain
that it cannot create the second partition, because the first one
occupied sectors 2048-4096 and the second one sectors 4096-3072,
so they would overlap at sector 4096.
With this patch, if the user uses IEC units to specify end of the
partition, parted creates the partition which ends one sector before
the specified position.
See also
https://lists.gnu.org/archive/html/bug-parted/2011-10/msg00009.html
* parted/ui.c (command_line_get_sector): Add parameter to retrieve
raw input from user.
* parted/ui.h (command_line_get_sector): Adjust prototype of function.
* parted/parted.c (_adjust_end_if_iec): New function.
(_strip_trailing_spaces): New function.
(_string_ends_with_iec_unit): New function.
(do_mkpart): Call _adjust_end_if_iec(). Use new parameter of
command_line_get_sector function.
(do_rescue): Adjust call to command_line_get_sector.
* bootstrap.conf (gnulib_modules): Add these: c-ctype, c-strcase.
* tests/t0207-IEC-binary-notation.sh: Adjust to new semantics.
* NEWS: Mention the changed behavior.
Notable adjustments:
- s/isspace/c_isblank/ so that parsing is locale-independent
- avoid an array-bounds error:
* parted/parted.c (_strip_trailing_spaces): Don't deref str[-1]
for an empty string.
Diffstat (limited to 'bootstrap.conf')
-rw-r--r-- | bootstrap.conf | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index 7c79d50..14123a2 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -28,6 +28,8 @@ gnulib_modules=" announce-gen argmatch assert + c-ctype + c-strcase calloc-gnu canonicalize-lgpl close |