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 /NEWS | |
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 'NEWS')
-rw-r--r-- | NEWS | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -21,6 +21,12 @@ GNU parted NEWS -*- outline -*- cause an MSDOS partition table to be mistakenly identified as pc98. [bug present since the beginning] +** Changes in behavior + + parted: mkpart command has changed semantics with regard to specifying end + of the partition. If the end is specified using MiB, GiB, etc. unit, parted + subtracts one sector from the specified value. With this change, it is now + possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and so on. * Noteworthy changes in release 3.0 (2011-05-30) [stable] |