Fix panic on cabal.project.freeze installed constraints dropping all Haskell packages#5040
Open
Synvoya wants to merge 1 commit into
Open
Fix panic on cabal.project.freeze installed constraints dropping all Haskell packages#5040Synvoya wants to merge 1 commit into
cabal.project.freeze installed constraints dropping all Haskell packages#5040Synvoya wants to merge 1 commit into
Conversation
GHC boot-lib constraints (any.base installed) have no ' ==', so fields[1] panicked with index out of range and the recover dropped all Haskell packages. Skip constraint lines without a version. Signed-off-by: Synvoya <16019863+Synvoya@users.noreply.github.com>
wagoodman
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
syftpanics on realcabal.project.freezefiles and drops all Haskell packages from the scan.Every
cabal freezeemitsany.<pkg> installed,constraints for GHC boot libraries (base,array,ghc-prim, ...).parseCabalFreezesplits each constraint on" =="and unconditionally readsfields[1]; aninstalledline has no" ==", sofieldshas length 1 andfields[1]panics withindex out of range [1]. The per-catalogerrecoverthen swallows the panic and yields zero Haskell packages for the entire scan.Reproducible on any real freeze file (e.g.
cabal init -n && cabal freeze), which is the same repro from the previously-closed #1362 — that fix guarded a different index and the panic simply moved tofields[1].Fix
Skip constraint lines without a version (
len(fields) < 2) soinstalledboot-lib lines are ignored and the remaining== versionpackages parse normally.Test
Extended
testdata/cabal.project.freezewithany.array installed,/any.base installed,. The existing exact-set assertion inparse_cabal_freeze_test.gois now a regression guard: it passes only if theinstalledlines are skipped and every real package still parses. Before the fix the fixture panicked.