Commits 178c9337 and 4174f20f introduced the possibility of an IndexError because the last loop in getDiskChunks assumes that disk_free and chunks have the same number of elements. Fixes #1248487.
--- blivet/partitioning.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py index 69e79e5..996e766 100644 --- a/blivet/partitioning.py +++ b/blivet/partitioning.py @@ -1444,7 +1444,7 @@ def getDiskChunks(disk, partitions, free): disk_free = [f for f in free if f.device.path == disk.path]
chunks = [] - for f in disk_free: + for f in disk_free[:]: # Align the geometry so we have a realistic view of the free space. # alignUp and alignDown can align in the reverse direction if the only # aligned sector within the geometry is in that direction, so we have to @@ -1454,11 +1454,13 @@ def getDiskChunks(disk, partitions, free): al_start = disk.format.alignment.alignUp(f, f.start) al_end = disk.format.endAlignment.alignDown(f, f.end) if al_start >= al_end: + disk_free.remove(f) continue geom = parted.Geometry(device=f.device, start=al_start, end=al_end) if geom.length < disk.format.alignment.grainSize: + disk_free.remove(f) continue
chunks.append(DiskChunk(geom))
On Mon, Aug 03, 2015 at 10:50:19AM -0500, David Lehman wrote:
blivet/partitioning.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/blivet/partitioning.py b/blivet/partitioning.py index 69e79e5..996e766 100644 --- a/blivet/partitioning.py +++ b/blivet/partitioning.py @@ -1444,7 +1444,7 @@ def getDiskChunks(disk, partitions, free): disk_free = [f for f in free if f.device.path == disk.path]
chunks = []
- for f in disk_free:
- for f in disk_free[:]: # Align the geometry so we have a realistic view of the free space. # alignUp and alignDown can align in the reverse direction if the only # aligned sector within the geometry is in that direction, so we have to
@@ -1454,11 +1454,13 @@ def getDiskChunks(disk, partitions, free): al_start = disk.format.alignment.alignUp(f, f.start) al_end = disk.format.endAlignment.alignDown(f, f.end) if al_start >= al_end:
disk_free.remove(f) continue geom = parted.Geometry(device=f.device, start=al_start, end=al_end) if geom.length < disk.format.alignment.grainSize:
disk_free.remove(f) continue chunks.append(DiskChunk(geom))
-- 2.4.3
Ack
anaconda-patches@lists.fedorahosted.org