Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I restored Mac OS X 10.6.2 today (was 10.6.3 and not booting) by copying the system over from a backup. The data directories were not touched.

In the data directories, I'm seeing some files as 0 bytes, and getting permission-denied errors when copying, even when using sudo cp or the Finder itself. Some programs, differently, take the files at face value and see no permission problems (such as zip), but they see the files as zero bytes, which would be game-over for recovery.

cp: .git/objects/fe/86b676974a44aa7f128a55bf27670f4a1073ca: could not copy extended attributes to /eraseme/blah/.git/objects/fe/86b676974a44aa7f128a55bf27670f4a1073ca: Operation not permitted

I have tried sudo chown, sudo chmod -R 777 and sudo chflags -R nouchg which do not change the end result.

Strangely, this is only affecting my .git directories (perhaps because they start with a period, but renaming them -- which works -- does not change anything).

What else can I do to take ownership of these files?

Edit: This question comes from Stack Overflow because I originally thought it was a Git problem. It's definitely not (just) Git. Anyway, this is to help put some of the comments in context.

share|improve this question

migrated from serverfault.com Mar 31 '10 at 9:27

This question came from our site for professional system and network administrators.

1  
Seems to me that you're more likely to get an answer to this over on ServerFault, as it's probably an issue caused by the restore process, not something specific to GIT. –  Bevan Mar 31 '10 at 0:42
    
It's the same object id in every repository? Are they related to one another in some way? Also, are they clones or just local repos? –  ebneter Mar 31 '10 at 1:00
    
@ebneter, they are not related at all, and it seems that all the objects are showing as 0 bytes. Some are clones, some are local repos... mixed bag. –  Yar Mar 31 '10 at 1:07
    
@Bevan, it's true that it's not exactly related to GIT, but I don't know how else to frame the question. –  Yar Mar 31 '10 at 1:07
1  
The combination of zero-byte files and xattrs sounds like HFS+ compression. arstechnica.com/apple/reviews/2009/08/mac-os-x-10-6.ars/… Is it possible that 10.6.3 introduced a new mode of HFS+ compression that is incompatible with 10.6.2? If so, maybe the files you are noticing were re-compressed with this incompatible method while you were running 10.6.3. You might want to poke around with hfsdebug osxbook.com/software/hfsdebug macosxhints.com/article.php?story=20090902223042255 –  Chris Johnsen Mar 31 '10 at 20:11
show 3 more comments

2 Answers

up vote 2 down vote accepted

It looks as though Git is using an advanced feature of the filesystem (hence the "extended attributes" in the message) which is not supported by the BSD-subsystem commands and, possibly, also by the backup system you're using.

Try using the backup system's own tools to restore these directories, if you used cp before.

If that doesn't work, you will probably need to re-clone these repos and/or switch to a more thorough backup system.

share|improve this answer
    
Thanks @Chromatix. The problem is that THESE DIRECTORIES WERE NEVER MOVED NOR COPIED. It's the system around them that has changed. +1 anyway. –  Yar Mar 31 '10 at 6:26
    
I also adjusted the question to make all of this clearer. –  Yar Mar 31 '10 at 6:41
add comment

Have you tried running fsck (OK, I'm medium old school) or the Mac Disk Utility to ensure the file system is still consistent? It's possible that whatever your 10.6.3 problem was, it affected the data partitions.

share|improve this answer
    
I ran the Disk Utility and "fixed permissions." Can I run fsck on a subtree? –  Yar Mar 31 '10 at 14:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.