You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal v2-install --ignore-project crashes when project file is present #8094
What is my interest in cabal v2-install --ignore-project?
I'd like to develop with -O0 (via optimization: False in a project file), but deploy to my system with default optimization (-O1).
Originally, I would have expected that cabal v2-install ignores the project files by default, because it behaves as if it installs from the sdisted tarball, which does (in my case) not contain any cabal.project* files.
But this does not seem to be the case. There is a long discussion of the complex at:
changed the title [-]`cabal v2-install --ignore-project` crashes when `cabal.project.local` is present[/-][+]`cabal v2-install --ignore-project` crashes when project file is present[/+]on Apr 9, 2022
In #7297 (comment) it is suggested to use --ignore-project to this end, but it does not work as expected...
sorry i did not make it clear in the comment but that was in the context of a hypothetical fix for the bug and that would be a feature to be added to allow opting out the behaviour that fix would set
Add --ignore-project to v2-build #7057 asking to add --ignore-project to v2-build. I think some v2 commands honour --ignore-project, like v2-run, v2-repl, v2-exec?.
I was looking into what it would take to fix #7965 and make the --ignore-project flag in the v2-sdist command work as intended but I'm not sure what the intended functionality is and the code seems to contradict itself.
It looks like there are two ideas competing against each other with the --ignore-project flag. Should the flag:
A) Ignore the cabal.project file in the current directory and look for a project file in the parent directories.
B) Ignore project files all together and create the project config from only the defaults and whatever is set from command line flags.
I assume looking in the parent directories is what it means by "GlobalConfig" in the withProjectOrGlobalConfig function in ProjectConfig.hs but I'm not sure what the intended functionality actually is.
I wasn't sure whether to add this comment to this issue or #7965 but this seemed more appropriate because it's being talked about and still has to do with the --ignore-project flag and the functionality seems to be the same whatever the given command is that supports it.
the globalConfig is not a project file in parent directories -- that's still a "project" config, just one found in another directory. The global config referred to in that function is, as I understand it, the ~/.cabal/config file.
@gbaz ok, the reason I said that is that it looks like if you run cabal sdist --ignore-project on a subdirectory of your project (such as the cabal-install directory of the cabal project) it will load the global config from ~/.cabal but if you do it on the same directory as the cabal.project file it will use that project file. That seems like a bug to me, and I assume the intended functionality is that it --ignore-project would always ignore the local cabal.project file and always use the global one, right?
Activity
[-]`cabal v2-install --ignore-project` crashes when `cabal.project.local` is present[/-][+]`cabal v2-install --ignore-project` crashes when project file is present[/+]jneira commentedon Apr 10, 2022
sorry i did not make it clear in the comment but that was in the context of a hypothetical fix for the bug and that would be a feature to be added to allow opting out the behaviour that fix would set
andreasabel commentedon Apr 11, 2022
Maybe then the concrete fix would be to remove
--ignore-projectfrom the options ofcabal install? Or does it have some use for remote installation?jneira commentedon Apr 11, 2022
Related issues:
--ignore-projectto v2-build. I think some v2 commands honour--ignore-project, like v2-run, v2-repl, v2-exec?.v2-sdistdoes not have suppor for: cabal v2-sdist ignores --ignore-project #7965erinclemmer commentedon Apr 12, 2022
I was looking into what it would take to fix #7965 and make the
--ignore-projectflag in thev2-sdistcommand work as intended but I'm not sure what the intended functionality is and the code seems to contradict itself.It looks like there are two ideas competing against each other with the
--ignore-projectflag. Should the flag:A) Ignore the cabal.project file in the current directory and look for a project file in the parent directories.
B) Ignore project files all together and create the project config from only the defaults and whatever is set from command line flags.
I assume looking in the parent directories is what it means by "GlobalConfig" in the
withProjectOrGlobalConfigfunction inProjectConfig.hsbut I'm not sure what the intended functionality actually is.I wasn't sure whether to add this comment to this issue or #7965 but this seemed more appropriate because it's being talked about and still has to do with the
--ignore-projectflag and the functionality seems to be the same whatever the given command is that supports it.gbaz commentedon Apr 12, 2022
the globalConfig is not a project file in parent directories -- that's still a "project" config, just one found in another directory. The global config referred to in that function is, as I understand it, the
~/.cabal/configfile.erinclemmer commentedon Apr 12, 2022
@gbaz ok, the reason I said that is that it looks like if you run
cabal sdist --ignore-projecton a subdirectory of your project (such as thecabal-installdirectory of the cabal project) it will load the global config from~/.cabalbut if you do it on the same directory as thecabal.projectfile it will use that project file. That seems like a bug to me, and I assume the intended functionality is that it--ignore-projectwould always ignore the localcabal.projectfile and always use the global one, right?gbaz commentedon Apr 12, 2022
That sounds correct to me.