LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-24-2005, 08:43 AM   #1
svar
Member
 
Registered: Jul 2003
Posts: 362

Rep: Reputation: 30
cp fails with no trace. What can go wrong with cp?


I am running a perl script on a new (well, the disks are new)
PC running Slack 10.2 2.6.13. This perl script has been running for over 5 years now on other machines and in fact is also running fine on a Suse 9.3 (2.6.11) machine with the same hardware.

The script says at some point:
my $from=$avfiles{$office_version}. $fileread;
my $to=$doneavfiles{$office_version} .$fileread;
#my $to=$fileread;
my $rc1= 0xffff & system ("cp $from $to");
unless ($rc1==0){print "$fileread copy from AVFILES to DONEAVFILES failed. Maybe took too long?";
sleep 2; #and if it still has not been copied, then...
die "not copied ( cp $from $to ) ! $fileread\n" unless (-e "$to") ;
}#unless rc1==0
##################
which is a simple system call to copy a file,
there is plenty of space left in the disk, but on the Slack system this is erratic, i.e. sometimes the cp fails
I checked the /var/log/messages and there is no hint of something gone wrong. Permissions is not an issue(both directories are 777) , disk space is not an issue, so what could trigger the failure? These are medium-size files, some 70k at most.


calling system cp
not copied ( cp /home/myusr/AVFILES/200512231230.s7nymsc1.0.2.av.gz /home/myusr/DONEAVFILES/200512231230.s7nymsc1.0.2.av.gz ) ! 200512231230.s7nymsc1.0.2.av.gz
200512231230.s7nymsc1.0.2.av.gz copy from AVFILES to DONEAVFILES failed. Maybe took too long?

P.S. I guess I should check(and I will) the rc1 return value..., just need a
general update on what could go wrong with cp if space and
permissions is NOT an issue.
 
Old 12-25-2005, 05:04 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Quote:
Originally Posted by svar
P.S. I guess I should check(and I will) the rc1 return value..., just need a general update on what could go wrong with cp if space and permissions is NOT an issue.
Checking the return value is top priority. The O'Reilly "Camel book" gives good examples of how to check a return value from system(). cp will also fail if the source file is non-existant for some reason. Your script doesn't indicate how the source file was generated. Maybe it's creation step failed previously? Without knowing what return value you're getting, you can't tell if it's a problem that cp is having, or a problem that the shell is having invoking cp (like a bad PATH or something).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
c coding trace bruse Linux - Newbie 2 07-13-2005 04:25 PM
Stack trace ust Linux - General 0 02-27-2004 02:30 AM
loging trace consty Linux - Security 1 02-22-2004 02:49 PM
how to trace e-mail msg? uros678 Linux - Newbie 3 11-13-2003 12:21 AM
Trace hacker? mikeshn Linux - Security 8 04-17-2003 01:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration