haskell/cabal

data-files with --prefix is inconsistent between Windows and Linux

Opened this issue · 0 comments

I tried reading #462 and #459 but I could not decipher what was going on in the bug discussion. So here is a report of my own. It appears that the behavior of Paths getDataFile when --prefix is passed is inconsistent between Linux and Windows, in the following way:

Suppose I build but do not install an executable dist/build/myexe/myexe, configured using --prefix=/usr to be installed into usr, which attempts to retrieve a data file. When I run this executable on Linux, it will attempt to retrieve the data file from the directory /usr/share/ARCH-linux-ghc-VERSION/packagename-VERSION. However, on Windows, it will attempt to retrieve the data file from the directory dist/build/ARCH-windows-ghc-VERSION\packagename-VERSION.

The Windows behavior is especially puzzling, because I don't believe we ever install libraries at the location we're probing. Looking at the source code, it appears that in the Windows case, --prefix is still triggering some sort of "relocatable" behavior (not --enable-relocatable, which is something different, but the codepath that occurs when reloc and absolute are false) which is causing it to be doing something different. It is very puzzling.