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.

Possible Duplicate:
Hard link not works under Mac OS X in GUI mode

I did a little experiment. First I ran the following in a Terminal:

mkdir test
cd test
echo "A" > a
echo "B" > b
ln a.txt c

Now a and c have the same content, A, and the same inode number. I can then edit c, using vim, to contain C instead of A and a will also contain C, since they are the same file.

However, if I do the same experiment again but use TextEdit instead of vim it seems to create a new file when I save it. c gets a new inode number and a still contains A. Why is this? What's going on?

share|improve this question

marked as duplicate by Svish, akira, Chealion, random Jul 30 '10 at 1:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
true. same question, even same answer :) .. so it must be true, hehe. –  akira Jul 29 '10 at 10:42

1 Answer 1

up vote 1 down vote accepted

maybe the saving routine of TextEdit works like this:

  1. store the content to a file named differently than the original to ensure, everything is written correctly to the disk. if the content was written to the disk successfully, continue.
  2. unlink the old filename
  3. rename the new file to "old filename"
  4. release the file descriptor of the old filename.
share|improve this answer
    
Yeah, from the question I found after asking this one, this seems to be the case :) –  Svish Jul 29 '10 at 10:43

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