CC: | Craig Berry <craig.a.berry [...] gmail.com> |
Subject: | Failures on VMS without elevated privileges |
Date: | Fri, 8 Feb 2013 16:30:58 -0500 |
To: | bug-file-temp <bug-file-temp [...] rt.cpan.org> |
From: | David Golden <dagolden [...] cpan.org> |
Forwarding this but report from Craig so we get a ticket for it.
Show quoted text
---------- Forwarded message ----------
From: Craig A. Berry
Date: Fri, Feb 8, 2013 at 3:43 PM
I do see one failure with it in blead and it turns out to be because I
was running with elevated privileges when I tested before. Oops.
Without privileges, tempfile.t fails like:
ok 13 - Close temp file
# TEMPDIR: MDA0:[CRAIG.SCRATCH.lZ4Q3_bDDe]
ok 14 - Temp directory in temp dir
# End of tests. Execute END blocks in directory MDA0:[CRAIG.SCRATCH.lZ4Q3_bDDe]
cannot stat initial working directory for MDA0:[000000]: not owner at
/perl_root/lib/File/Temp.pm line 929.
ok 15 - Dir D0:[CRAIG.BLEAD.CPAN.FILE-TEMP.tmpdiraSxcUC] should not be present
not ok 16 - Dir MDA0:[CRAIG.SCRATCH.lZ4Q3_bDDe] should not be present
# Failed test 'Dir MDA0:[CRAIG.SCRATCH.lZ4Q3_bDDe] should not be present'
# at t/tempfile.t line 30.
The trouble starts with the "cannot stat" message which is the
following code starting at line 924 in Temp.pm:
if (defined $cwd_to_remove) {
# We do need to clean up the current directory, and everything
# else is done, so get out of there and remove it.
my $root = File::Spec->rootdir;
chdir $root or die "cannot chdir to $root: $!";
eval { rmtree($cwd_to_remove, $DEBUG, 0); };
warn $@ if ($@ && $^W);
}
I may be missing something and haven't tried to understand what's
going on from the ground up, but it seems a little scary to me to
chdir to the root of the filesystem (or on Windows and VMS the root of
the volume) and start deleting directories. In fact rmtree is saying
just how crazy that is by telling us we're not the owner of that root
directory. I would think you would want to do something like this
instead:
chdir $cwd_to_remove;
chdir File::Spec->updir;
rmtree $cwd_to_remove ....