`cabal install` does not accept relative dirs in `--store-dir` (but `cabal build` does)
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Installation aborts in the middle when a relative path is passed to `--store-dir`:
```
$ cabal --store-dir=. install hello
...
In order, the following will be built (use -v for more details):
- hello-1.0.0.2 (exe:hello) (requires build)
...
Configuring hello-1.0.0.2...
Error: cabal: expected an absolute directory name for --prefix:
./ghc-9.2.1/hll-1.0.0.2-1e2f3837
Error: cabal: Failed to build hello-1.0.0.2. The failure occurred during the
configure step.
$ tree
.
└── ghc-9.2.1
└── package.db
├── package.cache
└── package.cache.lock
```
In contrast.
```
$ cabal --store-dir=$PWD install hello
```
succeeds.
Would a simple fix be to turn the `--store-dir` into an absolute path just after parsing this command line argument?
This issue came up before, see https://github.com/haskell/cabal/issues/7130#issuecomment-715611796; in https://github.com/haskell/cabal/issues/7130#issuecomment-715903180 @phadej invites PRs. A systematic fix has been started in #6667 but is unfinished.
UPDATE: looks like I duplicated #7760.
Contributor guide
Research direction
Reproduce the issue with `cabal --store-dir=. install hello` and compare it with `cabal build` and an absolute store directory. Read the discussion in issues #7130, #6667, and the superseding duplicate #7760; done means relative `--store-dir` works for install without the configure-step absolute-directory error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100