On Thu, Jul 07, 2005 at 12:56:52PM -0400, Alex Aminoff wrote:
> I havent seen any response to my post... I suppose I will take the deafening 
> silence as evidence that there is nothing so flawed about my reasoning as to 
> leap out at the casual observer...

Hi Alex,

perl hasn't changed, File::Copy.pm has changed. Between v2.06 and v2.07,
corresponding to perl v5.8.2 and perl v5.8.3, respectively,

Note the following deletions in the diff:

-no warnings 'io'; # don't warn if -l on filehandle
-if ((-e $from && -l $from) || (-e $to && -l $to)) {

...

 }

--- perl-5.8.2-lib-File-Copy.pm 2003-09-30 13:10:50.000000000 -0400
+++ perl-5.8.3-lib-File-Copy.pm 2003-12-04 08:11:49.000000000 -0500
@@ -24,7 +24,7 @@
 # package has not yet been updated to work with Perl 5.004, and so it
 # would be a Bad Thing for the CPAN module to grab it and replace this
 # module.  Therefore, we set this module's version higher than 2.0.
-$VERSION = '2.06';
+$VERSION = '2.07';
 
 require Exporter;
 @ISA = qw(Exporter);
@@ -77,13 +77,12 @@
        croak("'$from' and '$to' are identical (not copied)");
     }
 
-    if ($Config{d_symlink} && $Config{d_readlink} &&
-       !($^O eq 'Win32' || $^O eq 'os2' || $^O eq 'vms')) {
-       no warnings 'io'; # don't warn if -l on filehandle
-       if ((-e $from && -l $from) || (-e $to && -l $to)) {
+    if ((($Config{d_symlink} && $Config{d_readlink}) || $Config{d_link}) &&
+       !($^O eq 'MSWin32' || $^O eq 'os2' || $^O eq 'vms')) {
            my @fs = stat($from);
+       if (@fs) {
            my @ts = stat($to);
-           if (@fs && @ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) {
+           if (@ts && $fs[0] == $ts[0] && $fs[1] == $ts[1]) {
                croak("'$from' and '$to' are identical (not copied)");
            }
        }


> 
>  - Alex Aminoff
>    BaseSpace.net
> 
> ----- Original Message ----- 
> From: "Alex Aminoff" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Cc: <[EMAIL PROTECTED]>
> Sent: Thursday, June 23, 2005 8:28 AM
> Subject: [Boston.pm] possible bug in File::Copy?
> 
> 
> >
> > Hi folks. I use File::Copy in a backup system to copy to and from things
> > that are sometimes filenames and sometimes IO::Gzip filehandles.
> > Everything was OK until sometime in the past year or so when I started
> > seeing a lot of messages like
> >
> > stat() on unopened filehandle GEN0 at /usr/lib/perl5/5.8.5/File/Copy.pm
> > line 84.
> >
> > I did some investigation and found that my files were being copied just
> > fine. Some more investigation and I concluded that File::Copy was
> > calling stat() on something, which might be a file name or a filehandle
> > object, but ignoring the result unless it happened to be a file name, so
> > operating correctly. I surmise that an upgrade to perl 5.8.5 or so added a
> > check for stat() on an unopened filehandle as a helpful warning, and that
> > upgrading perl started these messages.
> >
> > The warnings, while harmless, were landing in folks' email inboxes and
> > they were being annoyed, so I ended up putting a SIG{__WARN__} = sub{...}
> > and SIG{__WARN__} = undef around the copy command, just to suppress the
> > warning messages. This seems inelegant.
> >
> > Could I have found a bug, or rather a formerly acceptable but now less so
> > formulation, that I found in File::Copy? I dove in and modified
> > File::Copy, replacing lines 82-84 with the following:
> >
> >         my @fs = $from_a_handle ? () : stat($from); # TEST BY ALEX
> >         if (@fs) {
> >             my @ts = $to_a_handle ? () : stat($to); # TEST BY ALEX
> >
> > and in fact the warnings were gone.
> >
> > So my question is, am I correct? And if so, can I submit a patch or
> > something to the maintainers of File::Copy? I wanted to ask here first,
> > fairly confident that if my reasoning was flawed you would spot it.
> >
> > Thanks,
> >
> >  - Alex Aminoff
> >    BaseSpace.net
> >
> > _______________________________________________
> > Boston-pm mailing list
> > [email protected]
> > http://mail.pm.org/mailman/listinfo/boston-pm
> > 
> 
>  
> _______________________________________________
> Boston-pm mailing list
> [email protected]
> http://mail.pm.org/mailman/listinfo/boston-pm

 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to