FROM : Bob Ippolito
DATE : Mon Nov 18 09:16:05 2002
On Monday, Nov 18, 2002, at 11:59 America/New_York, Troy Goodson wrote:
> Has anyone else noticed that applications like Apple's TextEdit break
> hard links in HFS+ and UFS?
>
> As a newbie to OS X development, I'd like to ask this list for some
> guidance. Should this be OK or not?
>
> If it is not OK, then I'd appreciate it if someone could explain to me
> what TextEdit is doing wrong and show me the right way.
>
> To see what I'm talking about, do this:
>
> In Terminal...
> 1. echo "original text" > hello.txt
> 2. ln hello.txt hello-link.txt
> 3. open -a textedit hello.txt
> 4. (in textedit) change the text "original text" to "altered text"
> 5. (in textedit) save & close hello.txt
> 6. (in terminal) cat hello-link.txt
>
> the file hello-link.txt contains "original text" !!
I think the way that apple stuff writes new files is something like:
(a) write temp file
(b) move old file out of the way
(c) move temp file to old place
(d) trash old file
Which would certainly break any hard links.. but it's pretty much
guaranteed not to trash your file
-bob
DATE : Mon Nov 18 09:16:05 2002
On Monday, Nov 18, 2002, at 11:59 America/New_York, Troy Goodson wrote:
> Has anyone else noticed that applications like Apple's TextEdit break
> hard links in HFS+ and UFS?
>
> As a newbie to OS X development, I'd like to ask this list for some
> guidance. Should this be OK or not?
>
> If it is not OK, then I'd appreciate it if someone could explain to me
> what TextEdit is doing wrong and show me the right way.
>
> To see what I'm talking about, do this:
>
> In Terminal...
> 1. echo "original text" > hello.txt
> 2. ln hello.txt hello-link.txt
> 3. open -a textedit hello.txt
> 4. (in textedit) change the text "original text" to "altered text"
> 5. (in textedit) save & close hello.txt
> 6. (in terminal) cat hello-link.txt
>
> the file hello-link.txt contains "original text" !!
I think the way that apple stuff writes new files is something like:
(a) write temp file
(b) move old file out of the way
(c) move temp file to old place
(d) trash old file
Which would certainly break any hard links.. but it's pretty much
guaranteed not to trash your file
-bob
| Related mails | Author | Date |
|---|---|---|
| Troy Goodson | Nov 18, 09:02 | |
| Bob Ippolito | Nov 18, 09:16 | |
| Troy Goodson | Nov 18, 11:44 | |
| Robert Fischer | Nov 19, 04:05 |






Cocoa mail archive

