fjaenale has asked for the wisdom of the Perl Monks concerning the following question:
Hello Wise Monks:
Let me explain a situation I am having a problem on a perl module. This module sends via FTP a file to a directory and then moves (rename) that file to another directory with another name, this last step is also done via ftp.
In order to do this I use the FTP.pm module. However once in a while I received an error message from the rename operation when doing the move part, I wrote down logs in the code to see what happens and I get 550 FTP code Error. The code I use is the followinig:
unless ($returncode = $self->{ftp}->rename($oldName, $newName)) { $msg=$self->{ftp}->message(); $code=$self->{ftp}->code(), MercMsg::RtrReportInfo(10001,"error el rename del fichero", "ft +p message",$code.": ".$msg,"10005"); return 0; }
In my case the rename returns an error code (see bellow) but the file has been move correctly, the error message is:
Run Time Desc: 550: rename: No such file or directory.
My question is: Does anyone know why this happen? Is the rename operation atomic like a transaction? This has happen a couple of times and the file has been moved in both ocasions correctly but the ftp rename has return error.
EDIT: -----------
The target directory exists for sure due to fact that there are anothter 3 instances running at the same time (moving other files) and didn't have that problem. The files in the target directory are being taken away once in a while, it may be that the target file is taken after the rename is done but before the file handle is closed (I am not sure about this) by thte rename. Also the file hasa been correctly moved in any case. Thanks for answer bart. :-)
EDIT2: -----------
This has happen also on a NFS copy a couple of months ago.
The original file is not there anymore after the error has been return.
Our system is mounted on a Digital Tru64 OS
Francisco Jaen
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about FTP.pm rename operation
by bart (Canon) on Oct 29, 2004 at 08:04 UTC | |
|
Re: Question about FTP.pm rename operation
by steves (Curate) on Oct 29, 2004 at 09:25 UTC | |
|
Re: Question about FTP.pm rename operation
by nimdokk (Vicar) on Oct 29, 2004 at 09:55 UTC |