parted does not allow real overlapping partition with constraint mechanism. Everytime overlapping happens, parted will try to find free space to allocate for new partition.If no free space found, it will complain with this exception and exit.
Then for security, when no proper allocation found, it should jump to error. And an exception will be presented. This also correct the bug for DASD for the situation below: root@s35lp11:˜/workspace/TOOL_PARTED# parted /dev/dasde GNU Parted UNKNOWN Using /dev/dasde Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) print Model: IBM S390 DASD drive (dasd) Disk /dev/dasde: 22.2GB Sector size (logical/physical): 512B/4096B Partition Table: dasd Disk Flags: Number Start End Size File system Flags (parted) mkpart 0% 100% (parted) mkpart 33% 66% Error: Can't have overlapping partitions. Ignore/Cancel? i BUG: specified free space extent for deleting not found in FMT7 DSCB! exiting... Signed-off-by: Wang Dong <dongd...@linux.vnet.ibm.com> Reviewed-by: Andre Wild <w...@linux.vnet.ibm.com>¶¶ Signed-off-by: Hendrik Brueckner <brueck...@linux.vnet.ibm.com>¶ --- parted/parted.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parted/parted.c b/parted/parted.c index 6cc9eb4..90d06e0 100644 --- a/parted/parted.c +++ b/parted/parted.c @@ -782,6 +782,11 @@ do_mkpart (PedDevice** dev, PedDisk** diskp) /* undo partition addition */ goto error_remove_part; } + } else { + ped_exception_throw (PED_EXCEPTION_ERROR, + PED_EXCEPTION_CANCEL, + _("No proper space found for the new partition.")); + goto error_remove_part; } char *align_err = NULL; -- 2.8.4