[UFO Chicago] very newbie 'nix question

Sean Neakums sneakums@ufo.chicago.il.us
Sat, 26 Jan 2002 23:01:30 +0000


Please don't Cc me on list mail.  Better still, get a client that
understands the Mail-Followup-To header.

begin  Elliot Shank quotation:

> On Sat, 2002-01-26 at 16:09, Sean Neakums wrote:
>> begin  Elliot Shank quotation:
>> > On Sat, 2002-01-26 at 15:29, Nick Moffitt wrote:
>> >> 	Oh, that's easy!  On Unix/GNU/BSD/Linux/any POSIX system,
>> >> directories *are* files!
>> > Ummm... errmm... while you are quoting ye old platitude about the
>> > "nature" of directories in *NIX filesystems, you are vastly
>> > incorrect in the realm of older *NIX systems.
>> It's not a platitude, it's the truth.  Directories (since they
>> existed as we now know them) have always been files.
>
> But the point is that they're not treated the same.

How is that the point?  When you use mv, it doesn't matter a tu'penny
damn of the source is a file ir a directory.

> One of the problems with the phrase "everything is a file" is it
> necessitates the distinguishing "regular" to be placed in front of
> the term "file" when one is trying to indicate what most people call
> a "file".

Most people assume that "file" means "regular file".  You only need to
say "regular file" in times when you want to be utterly unabiguous,
e.g. in useless discussions like this one.

> Analogously, despite the presence of filesystem entries called
> "/dev/sdd1" and "/dev/lp0", I would not call the things referred to
> by those entries as "files".

Neither would I.  They're "devices".  But they act very much like
files.

> Try explaining "everything is a file" to your grandmother.

I can't think of many grandmothers to whom understanding the concept
would be useful.

> Yes, the API consistency is nice and one of the biggest advantages
> of *NIX, but neither a device, pipe, socket, nor a directory is a
> file.

They occupy inodes on disk that are pointed to by direntries.  They're
files, alright.  And what's more, the file API works just fine on
them.  How about that!

> The implementation of a directory may be via a convenient reuse of
> the "regular file" storage mechanism, but it is not a file as your
> average human being would term it.

Most "average human beings" have no concept of a "file" at all.
Teaching to people how to use a "file" menu and explaining why the
computer doesn't have single level storage (not that they would call
it that) can be a serious challenge.

> Hell, it used to be that you could easily look at the storage for a
> directory (the file names and the binary representations of the
> inode numbers), but now when you try to "cat ."  you get "cat: .: Is
> a directory".

So what?  Do you want cat to produce a listing when used on a
directory or something?

-- 
Sean Neakums - <sneakums@ufo.chicago.il.us> --- --- -- -
Director of International Operations, UFO Chicago - -- -
http://ufo.chicago.il.us/ --- ------ ----- ---- --- -- -