From 367706a80e632cc731bc6fa3c03a3a09666a35a1 Mon Sep 17 00:00:00 2001 From: Joshua Ferguson Date: Wed, 8 Jul 2026 21:42:41 -0500 Subject: [PATCH 1/4] Correct partition index loop in translate.go Fix loop to start from the next partition index. --- config/fcos/v1_5/translate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/fcos/v1_5/translate.go b/config/fcos/v1_5/translate.go index 8628029f..bf0699bd 100644 --- a/config/fcos/v1_5/translate.go +++ b/config/fcos/v1_5/translate.go @@ -76,7 +76,7 @@ func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { + for idx := p + 1; idx < len(disk.Partitions); idx++ { if idx == p { continue } From 8815ea6239331634b1be28fc9ab9623a3761adf3 Mon Sep 17 00:00:00 2001 From: Joshua Ferguson Date: Wed, 8 Jul 2026 21:44:43 -0500 Subject: [PATCH 2/4] Update config/fcos/v1_5/translate.go Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- config/fcos/v1_5/translate.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/fcos/v1_5/translate.go b/config/fcos/v1_5/translate.go index bf0699bd..d96e68c6 100644 --- a/config/fcos/v1_5/translate.go +++ b/config/fcos/v1_5/translate.go @@ -77,9 +77,6 @@ func (c Config) ToIgn3_4Unvalidated(options common.TranslateOptions) (types.Conf if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { for idx := p + 1; idx < len(disk.Partitions); idx++ { - if idx == p { - continue - } if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break From 6f1cfcb7f8f1f944afea2e6d5fe46b32e79661ae Mon Sep 17 00:00:00 2001 From: Joshua Ferguson Date: Sat, 18 Jul 2026 10:50:21 -0400 Subject: [PATCH 3/4] */translate: fix root partition constraint check to only examine subsequent partitions --- config/fcos/v1_3/translate.go | 5 +---- config/fcos/v1_3/translate_test.go | 31 ++++++++++++++++++++++++++ config/fcos/v1_4/translate.go | 5 +---- config/fcos/v1_4/translate_test.go | 31 ++++++++++++++++++++++++++ config/fcos/v1_5/translate_test.go | 31 ++++++++++++++++++++++++++ config/fcos/v1_6/translate.go | 5 +---- config/fcos/v1_6/translate_test.go | 31 ++++++++++++++++++++++++++ config/fcos/v1_7/translate.go | 5 +---- config/fcos/v1_7/translate_test.go | 31 ++++++++++++++++++++++++++ config/fcos/v1_8_exp/translate.go | 5 +---- config/fcos/v1_8_exp/translate_test.go | 31 ++++++++++++++++++++++++++ 11 files changed, 191 insertions(+), 20 deletions(-) diff --git a/config/fcos/v1_3/translate.go b/config/fcos/v1_3/translate.go index c506427d..47b79816 100644 --- a/config/fcos/v1_3/translate.go +++ b/config/fcos/v1_3/translate.go @@ -75,10 +75,7 @@ func (c Config) ToIgn3_2Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { - if idx == p { - continue - } + for idx := p + 1; idx < len(disk.Partitions); idx++ { if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break diff --git a/config/fcos/v1_3/translate_test.go b/config/fcos/v1_3/translate_test.go index 2e96e4a4..444bf5e4 100644 --- a/config/fcos/v1_3/translate_test.go +++ b/config/fcos/v1_3/translate_test.go @@ -1652,6 +1652,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { diff --git a/config/fcos/v1_4/translate.go b/config/fcos/v1_4/translate.go index 8efdaf17..a4dbef21 100644 --- a/config/fcos/v1_4/translate.go +++ b/config/fcos/v1_4/translate.go @@ -75,10 +75,7 @@ func (c Config) ToIgn3_3Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { - if idx == p { - continue - } + for idx := p + 1; idx < len(disk.Partitions); idx++ { if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break diff --git a/config/fcos/v1_4/translate_test.go b/config/fcos/v1_4/translate_test.go index d835d1ce..8e6729fa 100644 --- a/config/fcos/v1_4/translate_test.go +++ b/config/fcos/v1_4/translate_test.go @@ -1652,6 +1652,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { diff --git a/config/fcos/v1_5/translate_test.go b/config/fcos/v1_5/translate_test.go index ba47b0f5..a921861d 100644 --- a/config/fcos/v1_5/translate_test.go +++ b/config/fcos/v1_5/translate_test.go @@ -1734,6 +1734,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { diff --git a/config/fcos/v1_6/translate.go b/config/fcos/v1_6/translate.go index 6ed66c7a..e0a1d942 100644 --- a/config/fcos/v1_6/translate.go +++ b/config/fcos/v1_6/translate.go @@ -76,10 +76,7 @@ func (c Config) ToIgn3_5Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { - if idx == p { - continue - } + for idx := p + 1; idx < len(disk.Partitions); idx++ { if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break diff --git a/config/fcos/v1_6/translate_test.go b/config/fcos/v1_6/translate_test.go index cf9cf07c..8ccd38b1 100644 --- a/config/fcos/v1_6/translate_test.go +++ b/config/fcos/v1_6/translate_test.go @@ -1734,6 +1734,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { diff --git a/config/fcos/v1_7/translate.go b/config/fcos/v1_7/translate.go index 870bf5ab..bb3b0209 100644 --- a/config/fcos/v1_7/translate.go +++ b/config/fcos/v1_7/translate.go @@ -76,10 +76,7 @@ func (c Config) ToIgn3_6Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { - if idx == p { - continue - } + for idx := p + 1; idx < len(disk.Partitions); idx++ { if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break diff --git a/config/fcos/v1_7/translate_test.go b/config/fcos/v1_7/translate_test.go index 29e2fd68..0b145b42 100644 --- a/config/fcos/v1_7/translate_test.go +++ b/config/fcos/v1_7/translate_test.go @@ -1735,6 +1735,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { diff --git a/config/fcos/v1_8_exp/translate.go b/config/fcos/v1_8_exp/translate.go index ceb167a4..6753ba93 100644 --- a/config/fcos/v1_8_exp/translate.go +++ b/config/fcos/v1_8_exp/translate.go @@ -76,10 +76,7 @@ func (c Config) ToIgn3_7Unvalidated(options common.TranslateOptions) (types.Conf if partition.Label != nil { if *partition.Label == "root" { if partition.SizeMiB == nil || *partition.SizeMiB == 0 { - for idx := range disk.Partitions { - if idx == p { - continue - } + for idx := p + 1; idx < len(disk.Partitions); idx++ { if disk.Partitions[idx].StartMiB == nil || *disk.Partitions[idx].StartMiB == 0 { r.AddOnWarn(path.New("json", "storage", "disks", i, "partitions", p, "label"), common.ErrRootConstrained) break diff --git a/config/fcos/v1_8_exp/translate_test.go b/config/fcos/v1_8_exp/translate_test.go index 810b3f22..502f1792 100644 --- a/config/fcos/v1_8_exp/translate_test.go +++ b/config/fcos/v1_8_exp/translate_test.go @@ -1881,6 +1881,37 @@ func TestRootPartitionConstraints(t *testing.T) { }, }, }, + { + name: "root last with sized partitions before", + in: Config{ + Config: base.Config{ + Storage: base.Storage{ + Disks: []base.Disk{ + { + Device: "/dev/vda", + Partitions: []base.Partition{ + { + Label: util.StrToPtr("bios"), + Number: 1, + SizeMiB: util.IntToPtr(1), + }, + { + Label: util.StrToPtr("boot"), + Number: 3, + SizeMiB: util.IntToPtr(2048), + }, + { + Label: util.StrToPtr("root"), + Number: 4, + }, + }, + }, + }, + }, + }, + }, + report: report.Report{}, // no warning expected + }, } for _, test := range tests { From 49ed945aeef2817b0554809dfa262208e475ffa4 Mon Sep 17 00:00:00 2001 From: Joshua Ferguson Date: Mon, 27 Jul 2026 11:00:17 -0400 Subject: [PATCH 4/4] */translate: fix root partition constraint check to only examine subsequent partitions --- docs/release-notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release-notes.md b/docs/release-notes.md index c60a5a56..3cf8d36d 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -12,6 +12,8 @@ nav_order: 9 ### Bug fixes +- fix root partition constraint check to only examine subsequent partitions + ### Misc. changes ### Docs changes @@ -31,6 +33,7 @@ nav_order: 9 ### Bug fixes + ### Misc. changes - Add support for pretty error reporting, can be controlled through