Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: bryon.noeske [...] alcatel-lucent.com
Cc:
AdminCc:

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



Subject: Issues with block and character special device files and with pipes
Date: Tue, 3 Jan 2012 15:48:10 -0600
To: "bug-File-Copy-Recursive [...] rt.cpan.org" <bug-File-Copy-Recursive [...] rt.cpan.org>
From: "Noeske, Bryon R (Bryon)" <bryon.noeske [...] alcatel-lucent.com>
When using dirmove, I encounter the following: if directory contains a block device, dirmove issues error if directory contains a character device, dirmove issues error if directory contains a pipe, dirmove hangs (during read) of course, with "normal" files, all works fine. I'm wondering if dirmove is expected to work with such device files. I tried with (my) original Recursive.pm and also with the new version. It appears that move() is able to move such files but dirmove() is not able. Show quoted text
> ls -l
total 64 -r--r--r-- 2 root bin 20143 Jan 3 15:22 Recursive.pm -rw-r--r-- 1 root root 22545 Jan 3 15:24 Recursive.pm.new -r--r--r-- 1 root bin 20143 Sep 12 12:44 Recursive.pm.orig Show quoted text
> perl -v
This is perl, v5.8.4 built for x86_64-linux (with 1 registered patch, see perl -V for more detail) Show quoted text
> perl -V
Summary of my perl5 (revision 5 version 8 subversion 4) configuration: Platform: osname=linux, osvers=2.4.20_hhl, archname=x86_64-linux uname='' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='em64t-gcc -g', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.3.1 (MontaVista 3.3.1-3.0.9.0300452 2003-12-02)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='em64t-gcc -g', ldflags =' ' libpth=/lib64 /usr/lib64 libs=-lgdbm -ldb -ldl -lm -lc -lcrypt perllibs=-ldl -lm -lc -lcrypt libc=/lib64/libc-2.5.90.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.5.90' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared ' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Locally applied patches: SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962 Built under linux Compiled at Mar 25 2010 07:58:26 %ENV: PERL5LIB=":/flx/lib:/usr/local/lib/perl5/site_perl/5.8.4/x86_64-linux" @INC: /flx/lib/5.8.4/x86_64-linux /flx/lib/5.8.4 /flx/lib /usr/local/lib/perl5/site_perl/5.8.4/x86_64-linux /usr/lib64/perl5/5.8.4 /usr/lib/perl5/5.8.4 /usr/local/lib64/perl/5.8.4 /usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl . Show quoted text
> uname -a
Linux flx207 2.6.21_mvlcge510-pc_target-x86_em64t-Linux-cge5 #1 SMP PREEMPT RT Mon Nov 28 12:52:07 CST 2011 x86_64 GNU/Linux Thanks for any and all help! Bryon
it is intended to work wi file, dirs, and symlinks. An upcoming modern version will allow you to register handlers for other types. It weird the pipe is hanging, can you send a least-case test example I can use to reproduce it? thanks On Tue Jan 03 16:48:21 2012, bryon.noeske@alcatel-lucent.com wrote: Show quoted text
> When using dirmove, I encounter the following: > > if directory contains a block device, dirmove issues error > if directory contains a character device, dirmove issues error > if directory contains a pipe, dirmove hangs (during read) > > of course, with "normal" files, all works fine. > > I'm wondering if dirmove is expected to work with such device files. I > tried with (my) original Recursive.pm and also with the new > version. It appears that move() is able to move such files but > dirmove() is not able. >
> > ls -l
> total 64 > -r--r--r-- 2 root bin 20143 Jan 3 15:22 Recursive.pm > -rw-r--r-- 1 root root 22545 Jan 3 15:24 Recursive.pm.new > -r--r--r-- 1 root bin 20143 Sep 12 12:44 Recursive.pm.orig >
> > perl -v
> > This is perl, v5.8.4 built for x86_64-linux > (with 1 registered patch, see perl -V for more detail) >
> > perl -V
> Summary of my perl5 (revision 5 version 8 subversion 4) configuration: > Platform: > osname=linux, osvers=2.4.20_hhl, archname=x86_64-linux > uname='' > config_args='-de' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef > usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='em64t-gcc -g', ccflags ='-fno-strict-aliasing > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', > optimize='-O2', > cppflags='-fno-strict-aliasing -I/usr/local/include > -I/usr/include/gdbm' > ccversion='', gccversion='3.3.1 (MontaVista 3.3.1-3.0.9.0300452 > 2003-12-02)', gccosandvers='' > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, > longdblsize=16 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='em64t-gcc -g', ldflags =' ' > libpth=/lib64 /usr/lib64 > libs=-lgdbm -ldb -ldl -lm -lc -lcrypt > perllibs=-ldl -lm -lc -lcrypt > libc=/lib64/libc-2.5.90.so, so=so, useshrplib=false, > libperl=libperl.a > gnulibc_version='2.5.90' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' > cccdlflags='-fpic', lddlflags='-shared ' > Characteristics of this binary (from libperl): > Compile-time options: USE_LARGE_FILES > Locally applied patches: > SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962 > Built under linux > Compiled at Mar 25 2010 07:58:26 > %ENV: > PERL5LIB=":/flx/lib:/usr/local/lib/perl5/site_perl/5.8.4/x86_64- > linux" > @INC: > /flx/lib/5.8.4/x86_64-linux > /flx/lib/5.8.4 > /flx/lib > /usr/local/lib/perl5/site_perl/5.8.4/x86_64-linux > /usr/lib64/perl5/5.8.4 > /usr/lib/perl5/5.8.4 > /usr/local/lib64/perl/5.8.4 > /usr/local/lib/perl5/site_perl/5.8.4 > /usr/local/lib/perl5/site_perl > . >
> > uname -a
> Linux flx207 2.6.21_mvlcge510-pc_target-x86_em64t-Linux-cge5 #1 SMP > PREEMPT RT Mon Nov 28 12:52:07 CST 2011 x86_64 GNU/Linux > > Thanks for any and all help! > > Bryon
Subject: RE: [rt.cpan.org #73712] Issues with block and character special device files and with pipes
Date: Tue, 3 Jan 2012 19:13:39 -0600
To: "bug-File-Copy-Recursive [...] rt.cpan.org" <bug-File-Copy-Recursive [...] rt.cpan.org>
From: "Noeske, Bryon R (Bryon)" <bryon.noeske [...] alcatel-lucent.com>
[flx207]-> id uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),4(adm) [flx207]-> cd /home/bryon [flx207]-> mkdir temp [flx207]-> mknod temp/pipe p [flx207]-> ls -l temp/pipe prw-r--r-- 1 root root 0 Jan 3 18:56 temp/pipe [flx207]-> cat xxx #!/usr/bin/perl use strict; use warnings; use File::Basename; use File::Copy; use File::Copy::Recursive qw (dirmove); use File::Path; my $quarantine_dir = '/var/tmp/q'; my $file = "$ARGV[0]"; print "I'm working with $file\n"; # Move cannot be used to move directories across FS boundaries. # Therefore we use dirmove, to move the entire directory structure. my $dirname = dirname ( $file ); if ( -d $file ) { if ( ! dirmove ( "$file", "$quarantine_dir/$file" )) { # If the directory contains block or character special # device files, dirmove may fail. If the directory # contains pipe files, dirmove may hang. my $ret = $? >> 8; print STDERR "Error $ret: could not quarantine directory $file\n"; } else { print STDERR "Directory $file now quarantined\n"; } } else { if ( ! -d "$quarantine_dir/$dirname" ) { if ( ! mkpath ( "$quarantine_dir/$dirname" )) { print "Warning: Could not create $quarantine_dir/$dirname\n"; } } if ( ! move ( "$file", "$quarantine_dir/$file" )) { my $ret = $? >> 8; print STDERR "Error $ret: could not quarantine file $file\n"; } else { print STDERR "File $file now quarantined\n"; } } ./xxx /home/bryon/temp [flx207]-> ps -ef | grep xxx root 9699 9660 0 18:59 pts/1 00:00:00 /usr/bin/perl ./xxx /home/bryon/temp root 10056 17119 0 19:00 pts/0 00:00:00 grep xxx [flx207]-> strace -p 9699 Process 9699 attached - interrupt to quit open("/home/bryon/temp/pipe", O_RDONLY <unfinished ...> Process 9699 detached # Something earlier allowed file arguments to work; now they are (perhaps as expected) not working. [flx207]-> mknod temp/block b 100 100 [flx207]-> ls -l temp/block brw-r--r-- 1 root root 100, 100 Jan 3 19:05 temp/block [flx207]-> ./xxx /home/bryon/temp/block I'm working with /home/bryon/temp/block Error 0: could not quarantine file /home/bryon/temp/block Show quoted text
-----Original Message----- From: Daniel Muey via RT [mailto:bug-File-Copy-Recursive@rt.cpan.org] Sent: Tuesday, January 03, 2012 5:37 PM To: Noeske, Bryon R (Bryon) Subject: [rt.cpan.org #73712] Issues with block and character special device files and with pipes <URL: https://rt.cpan.org/Ticket/Display.html?id=73712 > it is intended to work wi file, dirs, and symlinks. An upcoming modern version will allow you to register handlers for other types. It weird the pipe is hanging, can you send a least-case test example I can use to reproduce it? thanks On Tue Jan 03 16:48:21 2012, bryon.noeske@alcatel-lucent.com wrote:
> When using dirmove, I encounter the following: > > if directory contains a block device, dirmove issues error > if directory contains a character device, dirmove issues error > if directory contains a pipe, dirmove hangs (during read) > > of course, with "normal" files, all works fine. > > I'm wondering if dirmove is expected to work with such device files. I > tried with (my) original Recursive.pm and also with the new > version. It appears that move() is able to move such files but > dirmove() is not able. >
> > ls -l
> total 64 > -r--r--r-- 2 root bin 20143 Jan 3 15:22 Recursive.pm > -rw-r--r-- 1 root root 22545 Jan 3 15:24 Recursive.pm.new > -r--r--r-- 1 root bin 20143 Sep 12 12:44 Recursive.pm.orig >
> > perl -v
> > This is perl, v5.8.4 built for x86_64-linux > (with 1 registered patch, see perl -V for more detail) >
> > perl -V
> Summary of my perl5 (revision 5 version 8 subversion 4) configuration: > Platform: > osname=linux, osvers=2.4.20_hhl, archname=x86_64-linux > uname='' > config_args='-de' > hint=recommended, useposix=true, d_sigaction=define > usethreads=undef use5005threads=undef useithreads=undef > usemultiplicity=undef > useperlio=define d_sfio=undef uselargefiles=define usesocks=undef > use64bitint=undef use64bitall=undef uselongdouble=undef > usemymalloc=n, bincompat5005=undef > Compiler: > cc='em64t-gcc -g', ccflags ='-fno-strict-aliasing > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', > optimize='-O2', > cppflags='-fno-strict-aliasing -I/usr/local/include > -I/usr/include/gdbm' > ccversion='', gccversion='3.3.1 (MontaVista 3.3.1-3.0.9.0300452 > 2003-12-02)', gccosandvers='' > intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=1234 > d_longlong=define, longlongsize=8, d_longdbl=define, > longdblsize=16 > ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', > lseeksize=8 > alignbytes=8, prototype=define > Linker and Libraries: > ld='em64t-gcc -g', ldflags =' ' > libpth=/lib64 /usr/lib64 > libs=-lgdbm -ldb -ldl -lm -lc -lcrypt > perllibs=-ldl -lm -lc -lcrypt > libc=/lib64/libc-2.5.90.so, so=so, useshrplib=false, > libperl=libperl.a > gnulibc_version='2.5.90' > Dynamic Linking: > dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' > cccdlflags='-fpic', lddlflags='-shared ' > Characteristics of this binary (from libperl): > Compile-time options: USE_LARGE_FILES > Locally applied patches: > SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962 > Built under linux > Compiled at Mar 25 2010 07:58:26 > %ENV: > PERL5LIB=":/flx/lib:/usr/local/lib/perl5/site_perl/5.8.4/x86_64- > linux" > @INC: > /flx/lib/5.8.4/x86_64-linux > /flx/lib/5.8.4 > /flx/lib > /usr/local/lib/perl5/site_perl/5.8.4/x86_64-linux > /usr/lib64/perl5/5.8.4 > /usr/lib/perl5/5.8.4 > /usr/local/lib64/perl/5.8.4 > /usr/local/lib/perl5/site_perl/5.8.4 > /usr/local/lib/perl5/site_perl > . >
> > uname -a
> Linux flx207 2.6.21_mvlcge510-pc_target-x86_em64t-Linux-cge5 #1 SMP > PREEMPT RT Mon Nov 28 12:52:07 CST 2011 x86_64 GNU/Linux > > Thanks for any and all help! > > Bryon
his will be in the upcoming modern interface: https://github.com/drmuey/p5-File-Copy-Recursive/issues/2
This will be in the upcoming modern interface: https://github.com/drmuey/p5-File-Copy-Recursive/issues/2