-
Notifications
You must be signed in to change notification settings - Fork 704
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
new-run should cd to the package directory before running the exe #5001
Comments
Please don't! I rely in almost all my uses of for example, I've got lots of shell wrappers in my #!/bin/sh -e
#SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
SCRIPTPATH=/home/hvr/work/GitHub/cabal-plan
EXENAME="exe:$(basename "$0")"
exec cabal new-run -v0 --project-file "$SCRIPTPATH/cabal.project" "$EXENAME" -- "$@" and which rely on the caller's CWD to remain unaffected. |
Where ever this goes, let us please reduce changes to CWD rather than add even more. To stop hacking around this with hadrian and ghc, I had to start working on #4874, which tries to do exactly the opposite and stop relying on the CWD. After all the CWD is some ugly global state. I'm convinced we should try to reduce touching it to the very bare minimum we can. It is also to my understanding the reason cabal has to shell out and call itself for parallel builds, due to the messy global CWD state. |
What about the cabal tests then? Should they get the test directory as an argument? Should we add the test directory as a datadir? (i'm not arguing against not touching CWD, I agree with that too) edit: to reproduce:
|
@fgaz test/benchmarks are a bit of a special case; some random ideas: have a |
I'd prefer to not add more env vars affecting |
@23Skidoo yeah, but how to do we communicate with an exitcode-stdio type benchmark/test-suite if we need to tell it locations or other meta-information of its environment (which is something we're gonna need)? |
I agree with #5001 (comment). I had a bug for a week or so that went unnoticed by my CI because the path used by I wasn't previously aware that I could fix my testing with |
I guess this can be closed? The tests still fail if not ran from within the package directory, but that's a separate issue |
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
I'll just close this. If someone needs tests/exes to have some additional info, they can open a new issue and link this. |
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
cabal repl switches current directory for subpackages of a project, resulting in error paths relative to some subdirectory. This confuses downstream tooling. Related cabal tickets are haskell/cabal#5001 haskell/cabal#1842 Gated behind the newly added flag --force-absolute-paths
Most exes(tests,benchs) expect to be run in the package root, but with the introduction of projects this is no longer always true.
This became evident when trying new-run with the cabal-install tests (using #4861) while being in the project root.
Relevant lines:
cabal/cabal-install/Distribution/Client/CmdRun.hs
Lines 214 to 218 in 0122cf2
The text was updated successfully, but these errors were encountered: