[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl5-porters
Subject:    Re: OpenVMS behavior options - (was: [ANNOUNCE] ExtUtils::MakeMaker 6.26_01)
From:       Michael G Schwern <schwern () pobox ! com>
Date:       2005-03-30 3:27:32
Message-ID: 20050330032732.GA25628 () windhund ! schwern ! org
[Download RAW message or body]

On Tue, Mar 29, 2005 at 09:34:09PM -0500, John E. Malmberg wrote:
> The behavior of the OpenVMS C runtime library is dependent on feature 
> logicals which control how many things work.
> 
> But with these feature logicals set, which perl scripts can check 
> through the ENV{} operator, the C RTL features of OpenVMS can change to 
> behaving more like UNIX and less like traditional OpenVMS.
> 
> The way that Perl is currently implemented, changing these feature 
> logicals from their default is almost certainly guaranteed to have bad 
> results.  This is because in many cases some of the C filename parsing 
> is bypassed  for the support of older versions of OpenVMS.

Thanks for all that information.

The problem effects not only VMS but Unixen as well.  It stems from the
problem of Perl programs assuming that because you are on Operating System
X you will be using Filesystem Y.  For example, most programs assume that
when you run on Unix you're going to have case-sensitive filenames.  Run
the Perl test script on Linux in a FAT filesystem and things will go
awry.

The issue is to not assume operating system or file system attributes
based solely on the value of $^O or even %Config options.  You also don't
want to user to have to look at %ENV and be an expert in VMS esoteria to
figure out what the right thing is to do.

To that end I've devised a strategy which does platform-independent "probes"
to figure out what works and what doesn't.  For example, figuring out if
you're on a case sensitive or insensitive filesystem is pretty easy.  

1.  Write out SoMeFiLe with the contents "foo"
2.  Write out sOmEfIlE with the contents "bar"
3.  If SoMeFiLe contains "foo" you are case sensitive.

To determine if you're case preserving...

4.  Do a readdir and look for /^somefile$/i.  
4a. If you get back "sOmEfIlE" you are case preserving.  
4b. If you get back "somefile" you are non-case preserving with downcasing.  
4c. If you gete "SOMEFILE" you are non-case preserving with upcasing.

You can devise these sorts of probes for all sorts of different attributes.
How long can a filename be?  Is the dot special?  How many directories
deep can I go?  How long a command can I execute?  Do I have symlinks?
Hard links?  Can I fork?

There are various optimization techniques and ways to deal with multiple
mounted partition types as well as when they change, but the basic technique
of probing the actual runtime system rather than make assumptions based
on the OS or %Config from when Perl was built is the important part.  Then
the user can simply query a FileSystem object to find out this information.

I've wanted this sort of thing for MakeMaker for a very long time and
someday I'll get around to coding it.




[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic