commercialhaskell / commercialhaskell/stack
Changes in c-sources aren't always reflected in final binaries
- Dominant language
- Haskell
- Stars
- 4.1k
- Forks
- 850
- Avg merge
- 10h 37m
- Merged PRs (30d)
- 4
Description
```
Version 1.9.0.1, Git revision 4dee68538c3f6305d9531f4ad997d8c15b7f4434 (6125 commits) x86_64 hpack-0.31.0
```
In my library https://github.com/nh2/lz4-frame-conduit, I have a symlinked directory `lz4` that either points at `lz4.new` or `lz4.old`, which two different versions of the lz4 library.
The `lz4` directory's contents are picked up by this in my cabal file:
```
include-dirs: lz4/lib
c-sources: lz4/lib/lz4.c
lz4/lib/lz4frame.c
lz4/lib/lz4hc.c
lz4/lib/xxhash.c
```
When I switch the symlink from one to the other, and `stack test`, some changes are not picked up:
Let's say `lz4.new` has a bug inside, is the currently used version (`lz4 -> lz4.new`), and `stack test` fails as expected. Then when I `rm lz4 && ln -s lz4.old lz4 && stack test`, which should fix the failure, the failure still exists. Only after `stack clean && stack test` does the failure go away. This means something wasn't recompiled/linked when it should have been.
I can see that it does notice that something changed about the C files:
```
% stack test --ta --match=18
lz4-frame-conduit-0.1.0.0: unregistering (local file changes: /home/niklas/src/lz4/lib/lz4.c /home/niklas/src/lz4/lib/lz4.h /home/niklas/src/lz4/lib/lz4frame.c...)
lz4-frame-conduit-0.1.0.0: build (lib + exe + test)
Preprocessing library for lz4-frame-conduit-0.1.0.0..
Building library for lz4-frame-conduit-0.1.0.0..
Preprocessing test suite 'lz4-frame-conduit-test' for lz4-frame-conduit-0.1.0.0..
Building test suite 'lz4-frame-conduit-test' for lz4-frame-conduit-0.1.0.0..
Preprocessing executable 'haskell-lz4c' for lz4-frame-conduit-0.1.0.0..
Building executable 'haskell-lz4c' for lz4-frame-conduit-0.1.0.0..
lz4-frame-conduit-0.1.0.0: copy/register
Installing library in /home/niklas/src/haskell/lz4-frame-conduit/.stack-work/install/x86_64-linux/lts-11.22/8.2.2/lib/x86_64-linux-ghc-8.2.2/lz4-frame-conduit-0.1.0.0-QPJWsGUXHxFbgXRh6715R
Installing executable haskell-lz4c in /home/niklas/src/haskell/lz4-frame-conduit/.stack-work/install/x86_64-linux/lts-11.22/8.2.2/bin
Registering library for lz4-frame-conduit-0.1.0.0..
lz4-frame-conduit-0.1.0.0: test (suite: lz4-frame-conduit-test, args: --match=18)
```
But apparently it isn't enough.
Perhaps it doesn't notice when the _number of files_ changes, or something like that?
Contributor guide
Assessment
This issue has not been assessed yet.