It seems that commit bc5c54c987f548505a3877e8a0e460abe0b2a081 introduced some linux specific things...

hsc2hs Touch.hsc
Touch.hsc: In function ‘main’:
Touch.hsc:46: error: ‘UTIME_OMIT’ undeclared (first use in this function)
Touch.hsc:46: error: (Each undeclared identifier is reported only once
Touch.hsc:46: error: for each function it appears in.)
Touch.hsc:48: error: ‘UTIME_NOW’ undeclared (first use in this function)
Touch.hsc:67: error: ‘AT_FDCWD’ undeclared (first use in this function)
Touch.hsc:68: error: ‘AT_SYMLINK_NOFOLLOW’ undeclared (first use in this function)
compiling Touch_hsc_make.c failed
command was: /usr/bin/gcc -c -m32 -I/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/include/ Touch_hsc_make.c -o Touch_hsc_make.o
make: *** [Touch.hs] Error 1

I dug around the OSX documentation and fcntl.h header file and it seems that UTIME_OMIT, UTIME_NOW, AT_FDCWD and AT_SYMLINK_NOFOLLOW aren't defined (at least on OSX). I suspect the BSD's in general will have problems compiling git-annex.

Hmm.. is utimensat available at all?

I've committed an update that may convince at least some compilers to expose this newer POSIX stuff. I don't know if it will help, please let me know.

Comment by joey Wed Mar 16 16:07:26 2011
Just pulled the changes, it still fails to build. utimensat doesn't seem to exist on OSX 10.6.6.
Comment by Jimmy Wed Mar 16 16:49:18 2011
Alright, I've added #idefs and the symlink timestamp mirroring feature will be unavailable on OSX until I get a version that works there.
Comment by joey Wed Mar 16 17:46:40 2011
Just tried it out on my mac and it's working again. I guess this issue could be closed for now.
Comment by Jimmy Wed Mar 16 20:32:01 2011

I'm leaving this bug open because this feature, however minor is not available on OSX and BSD.

I have added a partial implementation using lutimes(3), which should be available on the BSDs. However, it's ifdefed out due to a casting problem: The TimeSpec uses a CTime, while lutimes uses a CLong. These data types may be internally the same on some or all platforms, so if you want this feature you can try changing the "ifdef 0" in Touch.hsc to 1 and try it, see if "git annex add" mirrors file modification time in created symlinks, and let me know.

Comment by joey Sun Mar 20 18:12:59 2011

ok, pulling the latest master and building on OSX now does this...

ghc -O2 -Wall -ignore-package monads-fd --make git-annex
[ 1 of 63] Compiling Touch            ( Touch.hs, Touch.o )

Touch.hsc:24:0:
    The type signature for `touchBoth' lacks an accompanying binding

Touch.hsc:27:26: Not in scope: `touchBoth'
make: *** [git-annex] Error 1

changing the #if 0 to 1 gives this...

ghc -O2 -Wall -ignore-package monads-fd --make git-annex
[ 1 of 63] Compiling Touch            ( Touch.hs, Touch.o )

Touch.hsc:95:43:
    Couldn't match expected type `CLong' against inferred type `CTime'
    In the second argument of `(\ hsc_ptr
                                    -> pokeByteOff hsc_ptr 0)', namely
        `(sec :: CLong)'
    In a stmt of a 'do' expression:
        (\ hsc_ptr -> pokeByteOff hsc_ptr 0) ptr (sec :: CLong)
    In the expression:
        do { (\ hsc_ptr -> pokeByteOff hsc_ptr 0) ptr (sec :: CLong);
             (\ hsc_ptr -> pokeByteOff hsc_ptr 4) ptr (0 :: CLong) }
make: *** [git-annex] Error 1

it seems that commit 6634b6a6b84a924f6f6059b5bea61f449d056eee has broken support for OSX.

Comment by Jimmy Sun Mar 20 20:48:41 2011
Fixed that, and removed the impossible cast so it can be built with #if 1
Comment by joey Sun Mar 20 22:06:25 2011
Just tried building both of the code paths, and they seem to build and somewhat function on OSX. I have yet to confirm the functionality is working correctly, but so far it's looking good. (I somewhat care less about the utimes/mtimes of my files since I care more about the content :) )
Comment by Jimmy Mon Mar 21 08:52:18 2011