TextEdit not caring about hard links?

2

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?

Svish

Posted 2010-07-29T10:27:53.210

Reputation: 27 731

Question was closed 2010-07-30T01:28:02.817

true. same question, even same answer :) .. so it must be true, hehe. – akira – 2010-07-29T10:42:01.290

Answers

1

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.

akira

Posted 2010-07-29T10:27:53.210

Reputation: 52 754

Yeah, from the question I found after asking this one, this seems to be the case :) – Svish – 2010-07-29T10:43:25.123