Unix file extensions (Was: make apache2 serve file as htmL...)

John Macdonald john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org
Fri Jan 12 23:34:11 UTC 2007


On Fri, Jan 12, 2007 at 09:46:10PM +0000, Christopher Browne wrote:
> On 1/12/07, John Macdonald <john-Z7w/En0MP3xWk0Htik3J/w at public.gmane.org> wrote:
> >On Fri, Jan 12, 2007 at 04:40:24PM +0000, Christopher Browne wrote:
> >> [...]  (Aside: People seem to keep forgetting that
> >> Unix has NO SUCH THING as a "file extension."  It's not MS-DOS.  It's
> >> not VMS.  It's not MVS.  All of those systems had special portions of
> >> filenames known as an "extension."  Unix doesn't do that.)
> >
> >Unix, the operating system kernel, has no special meaning or
> >support for file extensions.  It does, however, permit users
> >to use any conventions they like to organize their files.  The
> >only rules enforced by the operating system about file names are:
> >
> >- no slash in a file name (reserved for directory separator)
> >- no null in a file name (reserved for string terminator in system calls)
> >- "." and ".." are reserved for directory layout
> >- each type of file system has its own additional limitations, in 
> >particular
> >    the maximum length of a file name is a property of the particular file
> >    system type
> >
> >On the other hand, Unix, the programming environment, has always
> >made use of file extensions to manage files.  The compiler,
> >linker, and make, for example, all use extensions in a
> >consistant way to specify types of files used for programming.
> >The ls program uses file names that begin with . (i.e. contain
> >only an extension) to denote files that are, by default,
> >not listed.
> 
> I'm afraid my copy of Lion's Commentary is at home, so I can't do the
> pedantic "see, extensions have *never* been supported," but I believe
> I've checked that...
> 
> The Unix programming environment has *never* used file extensions.  It
> can't, because the filesystems don't support them.
> 
> >The concept "you have no NEED to use extensions in Unix"
> >is useful for people to know.  However, any phrasing of that
> >concept that implies "you should not use extensions in Unix"
> >is just plain wrong.  So, be careful about how urgently you
> >present that message.
> 
> No, it's not "plain wrong."
> 
> If you examine filesystem code, you'll find that there Is No Such
> Thing As A File Extension.  They don't exist.  They aren't supported.
> (Well, they are in msdosfs and ISO9660, which, respectively, emulate
> FSes from Microsoft and DEC.  But not in the *usual* Unixy
> filesystems...)

If you examine filesystem code, you're looking in the kernel.
I stated above:

    Unix, the operating system kernel, has no special meaning or
    support for file extensions.  [...]

> Unix programming tools don't use them, either.

Of course they do.  Take a look at all of the default rules
used by the make program - virtualy all of the actions it takes
are based on existance of files with varying extensions matching
the specified or required filenames.

> Unix programming tools often use file suffixes to infer information
> about file type, but a suffix is not the same thing as an "extension."

Just because extensions on Unix are voluntary and only supported
by programming tools does not mean they do not exist.  If you
want to call them something else, you'll just end up with
confusing discussions,  If you convince others that Unix does
not have extensions, they'll have difficulties reading the
man pages for programs like gcc and make.


> http://en.wikipedia.org/wiki/Filename_extension

Quoting from there:

(1) A filename extension is a suffix to the name of a computer
    file applied to show its format.

The initial definition does not restrict itself only to
suffices that are managed by the kernel/file system.

There is a suggestion of that a bit later, but then the
entry finishees off with:

(2) Mac OS X, however, uses filename extensions as a consequence
    of being derived from the Unix-like NEXTSTEP, which didn't
    have type or creator code support in its file system.

So, Unix file system suffices are still considerd "extensions"
in the context of the definition you refer to (presumably intended
as a counter=statement).

-- 
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list