Skip to content

cabal install does not accept relative dirs in --store-dir (but cabal build does) #7812

@andreasabel

Description

@andreasabel

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 #7130 (comment); in #7130 (comment) @phadej invites PRs. A systematic fix has been started in #6667 but is unfinished.

UPDATE: looks like I duplicated #7760.

Metadata

Metadata

Assignees

No one assigned

    Labels

    can-workaroundThere is a (maybe partial) workaround for the issue or missing featurere: store-dirOn local nix store (option `--store-dir`)type: enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions