John E. Malmberg wrote:
Craig A. Berry wrote:
On 9/10/07, David Landgren <[EMAIL PROTECTED]> wrote:

Craig A. Berry wrote:

[...]

The number of test failures in blead on VMS went from about 20 to
about 40 after this, mostly in CPANPLUS and Module::Build, which make
heavy use of rmtree.  I'm working on it, but not done yet.

I had 32 test failures as of this morning. Three new ones for me including Path.t.

[...]

With this patch, I am still failing on the following test:

What are the other two failing tests?

not ok 23 - removed directory (old style 2)
#   Failed test 'removed directory (old style 2)'
#   at [-.lib.file]path.t line 105.
#          got: '0'
#     expected: '1'

What is happening is that it is checking the permission of a directory using VMS::Filespec::candelete($root) and discovering that it does not have delete permission, so is skipping it. Normally directories on VMS are created with out delete permission granted.

And the code will only escalate privileges to attempt the delete if the client code has explicitly switched off the 'safe' attribute. Otherwise if the code is interrupted by any external means, filesystem objects may be left in a more permissive state than they were previously.

Previously it had verified that it had write permission, so did not do a chmod() on it to add write permission.

Unfortunately on VMS if you want to add delete permission using chmod(), the way to do it is to explicitly add write permission.

Hang on, you've lost me. It verifies that it had write permission... but you have to chmod anyway to raise the permissions sufficiently?

So really the VMS::Filespec::candelete test needs to be done where code is decided if to call chmod() to add write privilege or not.

I see what you mean... I think. I'll try to come up with some pseudo-code tonight and post that. One thing that I don't like is how the code unixifies at the top and ends up filifying at the end. Seems to me I should just have two variables $entry_as_dir and $entry_as_file that are the same on all OS'es, but special-cased on VMS.

I think I shall not escape the need to dust off my testdrive account and go and play with this on VMS.

Also, on the special case to handle '.' returned by readdir() on VMS, it will always be the first file or $file[0] if it exists, so there is no need to look through the entire array for it. Unless you are anticipating something changing the way that readdir() on VMS may be implemented.

No. Just being paranoid. On the other hand, the '.' -> '.;' remapping could be deferred to take place later on, rather than in the slightly obfuscatory C<map {...} readdir>.

Since it's all recursive, this just means the top of the foreach $root loop of _rmtree() becomes:

        if ($Is_MacOS) {
            $root  = ":$root" unless $root =~ /:/;
            $root .= ":"      unless $root =~ /:\z/;
        }
+       elsif ($Is_VMS) {
+           $root  = ".;" if $root eq '.';
+       }
        else {
            $root =~ s{/\z}{};
        }

This pleases me greatly, because it puts it the make-work code in one place, instead of having it scattered through the routine. Which is the type of simplification I'm striving for.

Thanks,
David

Reply via email to