Nonsensical paths are generated into setup-config
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Originally found in https://github.com/NixOS/nixpkgs/issues/28301
## Issue description
I just had a look at a `dist/setup-config` file generated by `cabal configure` or equivalent `Setup.hs` call, and it contains things like this:
`^@^@^@^@^@^@^@;/nix/store/66znhpqvqyvhgw4wxpl1f2rlfpqrbcsd-lz4-131/bin/tar^@^@^@^@^@^@^@A/nix/store/vmisgqfbqywgsw9php70bbx90czr398i-openssh-7.4p1/bin/tar^@^@^@^@^@^@^@?/nix/store/cjpyvkqqd55s8jgj7c2qv9wwmisw5ayg-rsync-3.1.2/bin/tar^@^@^@^@^@^@^@=/nix/store/2m6v6lnmnf9521ixd5v0x4qrmjkn30ws-gcc-5.4.0/bin/tar`
The same thing happens for `tar`, `alex`, `happy` etc, so I suspect that this is about build-tools called during haskell builds.
The N*M combination of executables and paths they are in isn't anything new when it comes to `stat()`ing or `execve()`ing binaries, but it seems totally nonsensical to me that such paths would be written to a file (this also seems to blow up the file size of `setup-config` quite a bit, e.g. mine is 1.6 MB large).
The Haskell builder in nixpkgs passes in the paths that end up being recorded, but we think it's a cabal bug because it seems that these paths shouldn't be recorded in there.
CC @peti
Contributor guide
Research direction
Reproduce the issue with `cabal configure` or an equivalent `Setup.hs` call, then inspect the generated `dist/setup-config`. Trace how build-tool paths such as `tar`, `alex`, and `happy` are recorded; the fix is complete when nonsensical path combinations are no longer written and the file size is reduced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100