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.

This is something neat that I've discovered today- I was modifying gcov files in a terminal. I had one window open with old gcov files from 11 AM. At 11:15, I ran my program again, and recreated the gcov files (overwriting the old ones). I looked at them in a second terminal window. However, I discovered I could still view the 11 AM gcov files in the first window!

Is this because of how the OS X file system works, that deleted files are still somewhat accessible? It seems to be connected to how one can rename or move files that are already open, unlike in Windows.

share|improve this question

migrated from stackoverflow.com Mar 25 '11 at 7:46

This question came from our site for professional and enthusiast programmers.

1 Answer 1

A directory entry points to an inode, the inode contains metainfo and points to the file data. You can remove the directory entry (this reduces the reference count of the inode), or close the open file (also reduces the reference count of the inode). When the inode reference count is 0, then the actual file is deleted.

On e.g. FAT filesystems, the "inode" and the directory entry are the same entity - so removing a directory entry also removes the file.

share|improve this answer
    
I figured that was the difference, but don't XP and Win7 still have restrictions preventing multiple programs from opening the same file, or moving/deleting a file while it is open for editing? –  Apophenia Overload Mar 24 '11 at 19:32
    
@Apophenia: That's file sharing flags, enforced by the OS, and works on a different level. –  Erik Mar 24 '11 at 19:39
    
Ah. Interesting OS X doesn't seem to have the same set of restrictions for modifying files that Windows has. –  Apophenia Overload Mar 24 '11 at 19:47

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.