Skip Menu |

This queue is for tickets about the File-Copy-Recursive CPAN distribution.

Report information
The Basics
Id: 35357
Status: resolved
Priority: 0/
Queue: File-Copy-Recursive

People
Owner: Nobody in particular
Requestors: drew [...] marold.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.35
Fixed in: 0.36



Subject: Error 'closedir() attempted on invalid dirhandle PTH_DH' when deleting empty directory
When calling pathrmdir($path,1) on a path that includes a directory whose sole child is an empty directory, you will receive the error: closedir() attempted on invalid dirhandle PTH_DH at {path/to/Recursive.pm} line 318. It appears to be caused by not localizing PTH_DH. I added the line local(*PTH_DH); to pathempty() and the problem went away. Perl version ActivePerl 5.8.8 build 822, F::C::Recursive version 0.35, running under windows. Had the problem on both XP and W2K3 64 bit. Patch attached
Subject: Recursive.pm.patch
300a301 > local(*PTH_DH);
From: drew [...] marold.org
I just looked at 0.36 and it looks like you have already fixed this issue. Disregard this bug.
Show quoted text
> It appears to be caused by not localizing PTH_DH. I added the line > local(*PTH_DH); to pathempty() and the problem went away.
We can't use local() or lexical variable for handles on old perl's. FCR tries to fit in with old perl's to :) 0.36 chnages it to work with old perl's and 5.10 (the one that didn;t like the filehandle issue) 0.37 is coming out soon that does it even better Show quoted text
> Perl version ActivePerl 5.8.8 build 822, F::C::Recursive version 0.35, > running under windows. Had the problem on both XP and W2K3 64 bit. > > Patch attached
thanks for the info
Show quoted text
> It appears to be caused by not localizing PTH_DH. I added the line > local(*PTH_DH); to pathempty() and the problem went away.
We can't use local() or lexical variable for handles on old perl's. FCR tries to fit in with old perl's to :) 0.36 chnages it to work with old perl's and 5.10 (the one that didn;t like the filehandle issue) 0.37 is coming out soon that does it even better Show quoted text
> Perl version ActivePerl 5.8.8 build 822, F::C::Recursive version 0.35, > running under windows. Had the problem on both XP and W2K3 64 bit. > > Patch attached
thanks for the info
Subject: Re: [rt.cpan.org #35357] Error 'closedir() attempted on invalid dirhandle PTH_DH' when deleting empty directory
Date: Thu, 24 Apr 2008 09:00:20 -0400
To: bug-File-Copy-Recursive [...] rt.cpan.org
From: Andrew Marold <drew [...] marold.org>
Thanks, for the reply, I look forward to your next version. FCR has been a huge help in some tools I wrote for work. I can't remember if I ever sent this to you, so apologies if it's a duplicate. I added an extra feature to fcopy that lets you set a flag to only copy files that are newer at the source than the ones at the destination. For my particular application, the cost of the stats was a lot less than copying a ton of files that hadn't changed. Attached is a diff patch against 0.36 of Recursive.pm. Thanks, Drew -- Drew Marold - Drew@marold.org Perl programmer, bass player, luthier, Gentleman Adventurer Photography: http://www.flickr.com/photos/unstoppabledrew/ Nothing looks worse on your outdoors resume than a list of the possible locations of your remains.
17c17 < $CondCopy $BdTrgWrn $SkipFlop --- > $CondCopy $BdTrgWrn $SkipFlop $NewOnly 38a39 > $NewOnly = 0; 75a77,95 > my $newercheck = sub { > my ($src, $dst) = @_; > # Normalize slashes > $src =~ tr|\\|/|; > $dst =~ tr|\\|/|; > # if destination is a directory, tack on filename for doing stat > chop $dst if $dst =~ m|.*/$|; > my $srclast = (split m|/|, $src)[-1]; > my $dstlast = (split m|/|, $dst)[-1]; > if ( $srclast ne $dstlast ) > { $dst = join '/', ($dst, $srclast); } > return 1 unless ( -f $dst ); # Not there ? Copy it > if ( (stat $src)[9] <= (stat $dst)[9] ) > { > return 0; #don't copy, dest is newer > } > return 1; > }; > 113a134,137 > if( $NewOnly and ! $newercheck->(@_) ) > { > return wantarray ? (1,0,0) : 1; > }
On Thu Apr 24 09:01:54 2008, drew@marold.org wrote: Show quoted text
> Thanks, for the reply, I look forward to your next version. FCR has been > a huge help in some tools I wrote for work. > > I can't remember if I ever sent this to you, so apologies if it's a > duplicate. I added an extra feature to fcopy that lets you set a flag to > only copy files that are newer at the source than the ones at the > destination. For my particular application, the cost of the stats was a > lot less than copying a ton of files that hadn't changed. Attached is a > diff patch against 0.36 of Recursive.pm.
Thanks Drew, In the next version I plan on adding a roadmap of TODOs, could you look that over when its out and create a new case based on your needs and what 0.37 either implements ormentions in that TODO section? that'd help me keep everything organized and sane :) Ciao