Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: BRUNORC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.36
Fixed in: (no value)



Subject: Error from dircopy while copying to non-existent dir (Windows only)
Hello I'm perfectly happy with F::C::R in Unix environment, although I noted some strange behaviour under Windows. Running the code like below: my $x = dircopy( $from, $where ); $self->util->exception("FSI: Cannot copy from $from to $where: $!") if $!; print "\tCopied $x files\n"; I get output: Copied 3 files Copied 5 files Program encountered the following problems: FSI: Cannot copy from C:/source/default_files/wsdl to C:/dest/resources/wsdl: No such file or directory FSI: Cannot copy from C:/source/default_files/xslt to C:/dest/resources/templates/xslt: No such file or directory To clarify - source dir exists, and the dest dir is created & populated with files. Everything works OK, the only problem is that dircopy sets $! with error, that shouldn't be reported, because directories are created when needed. I'm using version 0.36 under ActiveState Perl 5.8.8 (I attached the full output of perl -V) under Windows XP Professional version 2002 SP2. Thank you Bruno
Subject: perl_win_info.txt
Summary of my perl5 (revision 5 version 8 subversion 8) configuration: Platform: osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread uname='' config_args='undef' hint=recommended, useposix=true, d_sigaction=undef usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cl', ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DNO_HASH_SEED -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX', optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='12.00.8804', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\eBDAS\system\perl\lib\CORE" -machine:x86' libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.libws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib gnulibc_version='' Dynamic Linking: dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -libpath:"c:\eBDAS\system\perl\lib\CORE" -machine:x86' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS PERL_MALLOC_WRAP PL_OP_SLAB_ALLOC USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_SITECUSTOMIZE Locally applied patches: ActivePerl Build 820 [274739] Iin_load_module moved for compatibility with build 806 PerlEx support in CGI::Carp Less verbose ExtUtils::Install and Pod::Find Patch for CAN-2005-0448 from Debian with modifications Rearrange @INC so that 'site' is searched before 'perl' Partly reverted 24733 to preserve binary compatibility 29930 win32.c typo in #define MULTIPLICITY 29868 win32_async_check() can still loop indefinitely 29690,29732 ANSIfy the PATH environment variable on Windows 29689 Add error handling to win32_ansipath 29675 Use short pathnames in $^X and @INC 29607,29676 allow blib.pm to be used for testing Win32 module 29605 Implement killpg() for MSWin32 29598 cwd() to return the short pathname 29597 let readdir() return the alternate filename 29590 Don't destroy the Unicode system environment on Perl startup 29528 get ext/Win32/Win32.xs to compile on cygwin 29509,29510,29511 Move Win32::* functions into Win32 module 29483 Move Win32 from win32/ext/Win32 to ext/Win32 29481 Makefile.PL changes to compile Win32.xs using cygwin 28671 Define PERL_NO_DEV_RANDOM on Windows 28376 Add error checks after execing PL_cshname or PL_sh_path 28305 Pod::Html should not convert "foo" into ``foo'' 27833 Change anchor generation in Pod::Html for '=item item 2' 27832,27847 fix Pod::Html::depod() for multi-line strings 27719 Document the functions htmlify() and anchorify() in Pod::Html 27619 Bug in Term::ReadKey being triggered by a bug in Term::ReadLine 27549 Move DynaLoader.o into libperl.so 27528 win32_pclose() error exit doesn't unlock mutex 27527 win32_async_check() can loop indefinitely 27515 ignore directories when searching @INC 27359 Fix -d:Foo=bar syntax 27210 Fix quote typo in c2ph 27203 Allow compiling swigged C++ code 27200 Make stat() on Windows handle trailing slashes correctly 27133 Initialise lastparen in the regexp structure 27061 L<PerlIO> and Pod::Html 27034 Avoid "Prototype mismatch" warnings with autouse 26970 Make Passive mode the default for Net::FTP 26921 Avoid getprotobyname/number calls in IO::Socket::INET 26897,26903 Make common IPPROTO_* constants always available 26670 Make '-s' on the shebang line parse -foo=bar switches 26637 Make Borland and MinGW happy with change 26379 26536 INSTALLSCRIPT versus INSTALLDIRS 26379 Fix alarm() for Windows 2003 26087 Storable 0.1 compatibility 25861 IO::File performace issue 25084 long groups entry could cause memory exhaustion 24699 ICMP_UNREACHABLE handling in Net::Ping Built under MSWin32 Compiled at Jan 23 2007 15:57:46 %ENV: PERL5LIB="C:/eBDAS/app/modules/" @INC: C:/eBDAS/app/modules/ C:/eBDAS/system/perl/site/lib C:/eBDAS/system/perl/lib .
Thanks for the report. That is an interesting case. After review $! is only specifically set to 20 ('Not a directory' at least on unix) if the source is not a directory or if the target exists but is not a directory. So it appears to be happening by something else at a lower level. Out of curiosity, could you dump the numeric version of $! at this point? print "Error number -" . int($!) . "- $!\n"; Basically I think the right way to do it is check the return value of the function to see if it failed: if (my @rc = dircopy($from, $to)) { # do whatever w/ @rc } else { throw_exception("whatever: $!"); } the reason being is that $! can be set at any point by anything. Unlike, say, $@ with an eval eval {}; # $@ guaranteed to reflect the eval above vs. whatever() # $! could have been set by anything before or during the the call to whatever
Subject: Re: [rt.cpan.org #38433] Error from dircopy while copying to non-existent dir (Windows only)
Date: Thu, 14 Aug 2008 10:10:58 +0200
To: bug-File-Copy-Recursive [...] rt.cpan.org
From: Bruno <brunorc [...] gmail.com>
Hello Thanks for your quick response. I provide you with the information you asked for. 2008/8/13 Daniel Muey via RT <bug-File-Copy-Recursive@rt.cpan.org>: Show quoted text
> After review $! is only specifically set to 20 ('Not a directory' at least on unix) if the source is > not a directory or if the target exists but is not a directory. So it appears to be happening by > something else at a lower level. > > Out of curiosity, could you dump the numeric version of $! at this point? > print "Error number -" . int($!) . "- $!\n";
Copying templates Error number -2- No such file or directory Copied 3 files Error number -2- No such file or directory Copied 5 files Show quoted text
> Basically I think the right way to do it is check the return value of the function to see if it > failed: > > if (my @rc = dircopy($from, $to)) { > # do whatever w/ @rc > } > else { > throw_exception("whatever: $!"); > }
I used this attitude and now it runs perfectly. Thank you for your time :) Best Regards, Bruno
On Thu Aug 14 04:11:46 2008, brunorc@gmail.com wrote: Show quoted text
> > Basically I think the right way to do it is check the return value
> of the function to see if it
> > failed: > > > > if (my @rc = dircopy($from, $to)) { > > # do whatever w/ @rc > > } > > else { > > throw_exception("whatever: $!"); > > }
> > I used this attitude and now it runs perfectly. Thank you for your > time :) > > Best Regards, > > Bruno
No problem, have a good one Bruno