Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flags in local config do not override flags in freeze file #10439

Open
bgohla opened this issue Oct 8, 2024 · 0 comments
Open

Flags in local config do not override flags in freeze file #10439

bgohla opened this issue Oct 8, 2024 · 0 comments

Comments

@bgohla
Copy link

bgohla commented Oct 8, 2024

Describe the bug

In my project, I have a project freeze file that has flag settings for local packages set to -some-flag. I expect to be able to override this flag in the local project config, following the precedence order given in the documentation: https://cabal.readthedocs.io/en/stable/cabal-project-description-file.html#project-description-cabal-project-file .

But when trying to build, I get a resolution conflict instead.

To Reproduce
Steps to reproduce the behavior:

$ cat cabal-freeze-bug.cabal
cabal-version:      3.0
name:               cabal-freeze-bug
version:            0.1.0.0
synopsis:           n
-- description:
license:            BSD-2-Clause
license-file:       LICENSE
author:             Björn Gohla
maintainer:         bjorn.gohla@scrive.com
-- copyright:
category:           Testing
build-type:         Simple
extra-doc-files:    CHANGELOG.md
-- extra-source-files:

flag some-flag
     description: a flag that does nothing
     default: True
   
common warnings
    ghc-options: -Wall

executable cabal-freeze-bug
    import:           warnings
    main-is:          Main.hs
    -- other-modules:
    -- other-extensions:
    build-depends:    base ^>=4.18.2.1
    hs-source-dirs:   app
    default-language: Haskell2010
$ cat cabal.project.freeze 
active-repositories: hackage.haskell.org:merge
constraints: any.base ==4.18.2.1,
             cabal-freeze-bug +some-flag,
             any.ghc-bignum ==1.3,
             any.ghc-prim ==0.10.0,
             any.rts ==1.0.2
index-state: hackage.haskell.org 2024-06-14T08:17:16Z
$ cat cabal.project.local 
ignore-project: False
flags: -some-flag
$ cabal  build 
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: cabal-freeze-bug-0.1.0.0 (user goal)
[__1] rejecting: cabal-freeze-bug:+some-flag (constraint from config file,
command line flag, or user target requires opposite flag selection)
[__1] rejecting: cabal-freeze-bug:-some-flag (constraint from project config
/home/bgohla/src/scratch/cabal-freeze-bug/cabal.project.freeze requires
opposite flag selection)
[__1] fail (backjumping, conflict set: cabal-freeze-bug,
cabal-freeze-bug:some-flag)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: cabal-freeze-bug:some-flag,
cabal-freeze-bug

Expected behavior

I expect the flags specified in the local project config to override the flags in the freeze file.

System information

$ cabal --version
cabal-install version 3.10.3.0
compiled using version 3.10.3.0 of the Cabal library
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.6.5
$ uname -smprv
Linux 6.8.9 #1-NixOS SMP PREEMPT_DYNAMIC Thu May  2 14:35:35 UTC 2024 x86_64 unknown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant