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

Re: [MacPerl] Porting File::PathConvert




Barrie Slaymaker wrote Wed, 03 Feb 1999:


> Thanks for your reply.
> 
> Chris Nandor wrote:
> > 
> > Also, the details of paths on Mac OS are specified in the Mac section of
> > perlport.pod, in a perl5.005 or CPAN site near you.  :)
> 
> Already been there... it's too vague. For instance, is 
> volume1:folder1:::volume2:folder2:file legal? I assume 
> so, but it doesn't say. The reason I ask is that, under Win32
> and VMS and for URLs, my routines don't allow you to 'back up'
> in to the volume portion and switch volumes, since this is
> not legal (or possible) on them. It can also be a security 
> hole that lets users get out of the volume they're supposed
> to be in, in a cgi script, for instance.

It depends on what is to be done with the path you are working with: do you 
intend to attempt to stat, read, write to, or execute files on volumes that 
you do not have access to?  If so then the file system's ideas of permissions 
(or ACLS) ought to provide sufficient policy.  It need not necessarily be in 
a perl module.  (BTW on VMS it is possible to set up a logical name that 
points to all volumes (er, "devices" in VMSpeak[tm]) simultaneously.  File 
specs written in terms of such logical names let you specify all over all
file systems though the case of identical names is resolved by the order of 
devices in the logical name (known as a "search list" in VMSpeak[tm])).

[snip]

> > >And another one for subtracting two absolute
> > >paths to get the relative path from one to the other.
> > 
> > Hm, that one's a bit trickier.  Especially since Mac OS has
> > case-insensitive filenames.  
> 
> I've got that already done. (File::PathConvert handles
> Win32, and VMS, too).  That's actually the
> easy part. The hard part is making '' (the vacuum between two
> colons) look like '..' does under Unix. VMS is very similar
> in that respect, though, and I think I'm very close on it.

FWIW I have (still!) not yet had time to play with the File::Spec*
modules on VMS.  I do know that someone on the vmsperl list ran into 
trouble with Makemaker in 5.005_54 because of a bug in File::Spec::VMS*.

To illustrate a bit that might (?) be helpful, if I had two 
paths on unix:

    /a/b/c/d
    /a/b/e/f

then /a/b/c/../e/f points to the second of these.  On VMS the - character
serves the place of the .. characters on UNIX so that if I have:

    DKA100:[A.B.C.D]
    DKA100:[A.B.E.F]

Then DKA100:[A.B.C.-.E.F]  points to DKA100:[A.B.E.F]
(Note that within perl and the C/C++ RTLs either path may be specified 
in unix format as well, e.g.:

    /dka100/a/b/c/d/
    /dka100/a/b/e/f/

that is, the leading device portion maps to what looks like a 
filesystem spec.)

Helpful?  

Peter Prymmer


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch