haskell / haskell/cabal

`source-repository-package` does not seem to support a relative `location`

Open
#8,925 2 comments 0 reactions 0 assignees View on GitHub
cabal-install: source-repository-package type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

I'm trying to depend on another local package by putting a [`source-repository-package` stanza](https://cabal.readthedocs.io/en/3.4/cabal-project.html#specifying-packages-from-remote-version-control-locations) in the `cabal.project` file. The dependency is in a sibling folder, so the natural way would be to specify it with a relative path:

```cabal
packages: .

source-repository-package
type: git
location: ../dependency
tag: master
```

However, this fails with a blatantly false statement:

```
$ cabal build
fatal: repository './../dependency' does not exist
```

I've also tried replacing the location with all the following alternatives

```cabal
location: ./../dependency
location: file://../dependency
location: file://./../dependency
```
but to no avail.

The only way I could make it work is by specifying an absolute path, with either of the following

```cabal
location: /home//code/haskell/dependency
location: file:///home//code/haskell/dependency
```

**Expected behavior**

I would expect relative paths to work in the `location` field of the `source-repository-package` stanza.

**System information**

```
$ uname -srio && cabal --version
Linux 6.2.10-200.fc37.x86_64 x86_64 GNU/Linux
cabal-install version 3.6.2.0
compiled using version 3.6.2.0 of the Cabal library
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with the shown cabal.project source-repository-package stanza and cabal build command, starting from how cabal-install handles the location field. Trace the relative-path behavior against the absolute-path case; done means a sibling dependency builds using a relative location without the false repository-not-found error.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, haskell
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.