haskell / haskell/cabal

scope:private executables broken with v2-install

Open
#6,339 10 comments 0 reactions 0 assignees View on GitHub
attention: pr-welcome cabal-install: v2-build system type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

If I use a private executable with `v1-install` (tested inside a `v1-sandbox`) I get the behaviour I'm looking for:
- the private executable is only installed in the `libexec` dir
- I can run the executable from another program in the package with the help of the `Paths_` module

With v2-install (on Linux):

1. `cabal-install` installs a broken symlink in `installdir` for the private executable
2. executables can have different component hashes. Using `getLibexecDir` from the public executable in the package doesn't give me the location of the others.

item 1. seems to be a bug.

I'm not sure about 2. How should I find a private executable if it's not a bug?

For reference, the code that doesn't work (from `Main.hs` in the attached archive):
```
main = do
putStrLn "Hello, Haskell! (public)"
libexec <- getLibexecDir
callProcess (libexec "private") []
```

**To Reproduce**

```
$ cabal v2-install testprivate-0.1.0.0.tar.gz
```

**Expected behavior**

`testprivate` is installed in `installdir`. When run, it should the private executable. The expected output is:

```
Hello, Haskell! (public)
Hello, Haskell! (private)
```
[testprivate-0.1.0.0.tar.gz](https://github.com/haskell/cabal/files/3824182/testprivate-0.1.0.0.tar.gz)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.