[Haskell-cafe] getSymbolicLinkStatus completely broken on some 6.8.2 systems

Adam Langley agl at imperialviolet.org
Wed Feb 13 02:45:41 EST 2008


On Feb 12, 2008 11:04 PM, Adam Langley <agl at imperialviolet.org> wrote:
> structure filled in. HsUnix.h has a wrapper around lstat for exactly
> this reason, however ltrace shows it calling the wrong one.

So (finally!) the real issue:

hsc2hs has a C preprocessor prelude (utils/hsc2hs/template-hsc.h)
which includes some GHC header files. As a result, hsc processes files
in 64-bit mode:
% cpp -I../../includes -dM template-hsc.h | grep FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64

However, when building HsUnix.c (or any c file with cabal), the
environment is different and it's built in 32-bit mode. Thus the lstat
wrapper called the 32-bit glibc function, but the structure sizes and
offsets in Files.hs (from Files.hsc) are all for 64-bit mode.

The fix is not quite obvious. Probably hsc2hs should try harder not to
change the environment so much. I'm not quite sure why the hsc2hs
template pulls in the HsFFI header - it doesn't seem to need it.

Although you can remove the #include and rebuild the unix package, I
can safely say that you'll be reinstalling ghc if you do. What might
work is changing hsc2hs and then rebuilding all of GHC. However,
that's an overnight build so I don't know yet.


AGL

-- 
Adam Langley                                      agl at imperialviolet.org
http://www.imperialviolet.org                       650-283-9641


More information about the Haskell-Cafe mailing list