views:

45

answers:

1

I just cloned an old repository containing some linux kernel modules (don't ask). If I clone on a linux machine, everything is fine. On my Mac however, someone (presumably Mac OS X) makes binary changes to the modules. I already disabled autocrlf.

Here's the output of git diff -p --stat directly after clone:

 .../kernel/net/ipv4/netfilter/ipt_ecn.ko           |  Bin 3853 -> 4535 bytes
 .../kernel/net/ipv4/netfilter/ipt_ttl.ko           |  Bin 3458 -> 3904 bytes
 .../kernel/net/netfilter/xt_connmark.ko            |  Bin 4534 -> 5618 bytes
 .../2.6.26-2-686/kernel/net/netfilter/xt_dscp.ko   |  Bin 4378 -> 5217 bytes
 .../2.6.26-2-686/kernel/net/netfilter/xt_mark.ko   |  Bin 3679 -> 4334 bytes
 .../kernel/net/netfilter/xt_rateest.ko             |  Bin 4545 -> 7137 bytes
 .../2.6.26-2-686/kernel/net/netfilter/xt_tcpmss.ko |  Bin 3841 -> 6553 bytes
 7 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ecn.ko b/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ecn.ko
index 76d7d8d..b1470d6 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ecn.ko and b/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ecn.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ttl.ko b/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ttl.ko
index d974dc9..9dcb633 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ttl.ko and b/i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ttl.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_connmark.ko b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_connmark.ko
index d9381a6..14c2a2c 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_connmark.ko and b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_connmark.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_dscp.ko b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_dscp.ko
index 36af201..178adfa 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_dscp.ko and b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_dscp.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_mark.ko b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_mark.ko
index 2dd1a0a..1329162 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_mark.ko and b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_mark.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_rateest.ko b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_rateest.ko
index 8678387..b23e514 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_rateest.ko and b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_rateest.ko differ
diff --git a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_tcpmss.ko b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_tcpmss.ko
index 13e4891..7c3c61c 100644
Binary files a/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_tcpmss.ko and b/i686/modules/2.6.26-2-686/kernel/net/netfilter/xt_tcpmss.ko differ

A git reset --hard doesn't do the trick, either. Something weird does happen, though: Every time, I do the reset, the sizes on the right of git diff switch places and some capitalizations in the filenames change. I do have a case-insensitive filesystem on the Mac, could that be the cause of this? How could I fix this (if possible, without reformatting the Mac)

+1  A: 

The problem is due to the case-insensitive default of HFS+ filesystems.

Take the first problematic file:

i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ipt_ecn.ko

You will find that (as originally recorded) there is also file named ipt_ECN.ko in the same directory:

git ls-tree HEAD -- i686/modules/2.6.26-2-686/kernel/net/ipv4/netfilter/ | 
grep '^ipt_.*\.ko'

Theoretically, you could reformat your boot volume to use case sensitive version of HFS+, but that tends to cause problems with random applications (e.g. those that store/install a file named foo, but later exclusively try to read a file named Foo).

Short of bakup/reformat/restore, you could work in a disk image that is formatted with case sensitive HFS+. Use Disk Utility to create a new disk image (probably a “sparse bundle” image) and put your working tree in that volume (it will be mounted under /Volumes/). You may need to create a default disk image and then reformat it by specifying “Mac OS Extended (Case-sensitive, Journaled)” in Erase tab for the rsulting volume).

Chris Johnsen