Drafted by GitHub Copilot CLI while reviewing PR #132.
internal/rpm/spec/spec.go::GetPackageNameFromSectionHeader does not handle the -l (language) flag pair. It falls through the default: index++ arm in the option switch, which consumes -l but not its argument. The argument is then incorrectly picked up as the package name suffix.
Reproduction
GetPackageNameFromSectionHeader([]string{"%description", "-l", "fr", "devel"})
// returns: "fr"
// expected: "devel"
Impact
Affects every overlay that relies on the parser's package classification, including the existing spec-remove-section overlay and the new spec-remove-subpackage overlay (PR #132). For a sub-package with a localized description, RemoveSubpackage("devel") will remove the main %package devel and English %description devel but leave behind %description -l fr devel, producing a spec that references a sub-package whose preamble is gone — an invalid build.
This is not net-new behavior introduced by PR #132; it was latent in GetPackageNameFromSectionHeader and surfaced by the new overlay's whole-sub-package semantics.
Proposed fix
Add -l to the option-pair switch in GetPackageNameFromSectionHeader so it consumes both the flag and its language argument:
Add fixture tests for %description -l fr devel and %description -l fr -n test-devel.
internal/rpm/spec/spec.go::GetPackageNameFromSectionHeaderdoes not handle the-l(language) flag pair. It falls through thedefault: index++arm in the option switch, which consumes-lbut not its argument. The argument is then incorrectly picked up as the package name suffix.Reproduction
Impact
Affects every overlay that relies on the parser's package classification, including the existing
spec-remove-sectionoverlay and the newspec-remove-subpackageoverlay (PR #132). For a sub-package with a localized description,RemoveSubpackage("devel")will remove the main%package develand English%description develbut leave behind%description -l fr devel, producing a spec that references a sub-package whose preamble is gone — an invalid build.This is not net-new behavior introduced by PR #132; it was latent in
GetPackageNameFromSectionHeaderand surfaced by the new overlay's whole-sub-package semantics.Proposed fix
Add
-lto the option-pair switch inGetPackageNameFromSectionHeaderso it consumes both the flag and its language argument:Add fixture tests for
%description -l fr develand%description -l fr -n test-devel.