[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

portability of pathnames



    Date: Thu, 29 May 86 16:21 EDT
    From: Jonathan A Rees <JAR@MIT-AI.ARPA>
    To: LOOSEMORE@UTAH-20.ARPA

        Date: Tue 27 May 86 11:41:42-MDT
        From: SANDRA <LOOSEMORE@UTAH-20.ARPA>

        1.  You can't count on being able to directly manipulate pathname
        components.  Explicit namestrings generally lose too.

    I can believe that namestrings lose, but I think an explanation of why
    pathnames lose would be very instructive.  Please send a message to
    common-lisp elaborating on this.  Thanks.

    Jonathan

The main problem with pathnames is that not all machines that you might
want to run Common Lisp on have something that corresponds to each of
the various components.  A particularly brain-damaged example is the
Cray, which (as I understand it) has no directories, no file types, and
an 8-character limit on filenames.  IBM's running VM/CMS aren't quite
as bad off; at least there you can have file types and several virtual
devices around, but still no directories, and of course no versions
either.  Unix has directories, of course, but using a "." to delimit
the file type is simply a convention and there are no versions or things
that correspond to devices.  And handling for host names under Unix is
pretty random, depending on which Unix implementation you happen to have.

The problem as I see it is with make-pathname, where you have to
explicitly give it values for each component.  You can't guarantee that
a CL implementation on a brand "x" computer will be able to make sense
out of all the components, or what values are valid for each component
in that implementation or that host.  The manual does say that strings are
valid for most of the components, but most operating systems have some
limitations about the lengths of the components, or what characters are
legal in filenames, or require delimiters around the components that are
totally nonsensical to other operating systems.

Here's an example from the real world.  PCLS was mostly developed under
Unix, which allows the use of hyphens in filenames, which kind of crept
into the names of some of the system modules.  (We use "require" to load
them during the build process; require passes the symbol-name of the
module as the :name argument to make-pathname.)  When we took the code
over to VMS, we were stuck with all these references to filenames with
hyphens in them, which aren't allowed in VMS (yet -- this is supposed
to change soon).  There is currently a very grody piece of code in there
that looks for hyphens in filenames and translates them to underscores.  

Is make-pathname supposed to signal errors if you feed it components
that don't make sense for the given (or default) host?  Or is it supposed
to try to "patch up" the problem components in some way that makes sense
for that host, such as removing or translating illegal characters or
converting a Unix directory specification with slashes into a VMS
directory specification with square brackets?  Or do we just asssume
"it is an error" to supply pathname components that are illegal for the
given host?

-Sandra Loosemore
-------