Re: Any advantages of Unix formatting
Re: Any advantages of Unix formatting
- Subject: Re: Any advantages of Unix formatting
- From: Jonathan Stimmel <email@hidden>
- Date: Tue, 4 Sep 2001 15:32:37 -0700
- Mail-followup-to: Jonathan Stimmel <email@hidden>, email@hidden
On Tue, Sep 04, 2001 at 11:17:52PM +0200, Ondra Cada wrote:
>
Could please somebody who *DOES* understand HFS+ comment on?
I apologize for creating this confusion; as Finlay has pointed
out, I misinterpreted what I was actually doing. Let me try to
clarify (and hopefully end this subthread!).
First, create the file "aaa" with the text "hello":
$ echo hello > aaa
$ ls -l aaa
-rw-r--r-- 1 jon staff 6 Sep 4 14:55 aaa
$ cat aaa
hello
Now, create (or try, anyway) a new file "AAA" with the text "goodbye"
$ echo goodbye > AAA
$ ls -l AAA
-rw-r--r-- 1 jon staff 8 Sep 4 14:57 AAA
$ cat AAA
goodbye
Now, look at the "two" files:
$ ls -l AAA aaa
-rw-r--r-- 1 jon staff 8 Sep 4 14:57 AAA
-rw-r--r-- 1 jon staff 8 Sep 4 14:57 aaa
$ diff -s AAA aaa
Files AAA and aaa are identical
In reality, there's only one file:
$ ls -l
total 16
-rw-r--r-- 1 jon staff 8 Sep 4 14:57 aaa
$ cat aaa
goodbye
So, what happened is this:
- the first echo command created the file "aaa"
- the ls command looked for a file matching "aaa", and printed
out its details
- when the second echo went to write to "AAA", it found a case
insensitive matching file ("aaa"), which it overwrote
- the ls command looked for a file matching "AAA", and printed
out its details; notice that the filename it prints is the one
I supplied ("AAA"), not the one actually stored in the FS ("aaa");
this is, I believe, a big source of confusion...
For further proof that the files are identical, examine their inodes:
$ ls -i AAA aaa
1153924 AAA 1153924 aaa
Since they have the same inode, they are physically the same file.
For those not familiar with inodes, in the Unix world of filesystems,
an inode uniquely identifies a file within a filesystem. When the OS
opens a file, it really uses the filename to look up the inode, and
then uses *it* to locate the file on disk. I don't know if HFS+ uses
inodes the same way a filesystem like UFS does, but for this proof
it doesn't matter so long as the inodes values it supplies to user
processes don't violate the following rules:
- no two files within a filesystem may share the same inode
- if two directory entries within a filesystem have the same inode,
then they're really the same file
(And yes, a file may exist in multiple places in the filesystem; take
a look at "ls -i /usr/bin/zdiff /usr/bin/zcmp". This is not a symbolic
link or an alias, it's a "hard link" - see the "ln" man page.)
Hmmm... a little bit longer than I intended, but hopefully I've undone
any damage I caused =).