André Warnier wrote:
Caldarale, Charles R wrote:
From: peter.crowth...@googlemail.com [mailto:peter.crowth...@googlemail.com] On Behalf Of Peter Crowther
Subject: Re: Can't move files using symbolic links (allowLinking=true)

Maybe a guess : under Unix/Linux, "move" (mv) is a "rename",
and it is not the same as "copy + delete original".  And a
"move" (rename) works as long as the source and target are
inside the same filesystem, but not if they are on different
filesystems.

Nice one André!  I'd completely missed that.

Except... I have no problem issuing a shell mv command across filesystems; the shell recognizes that this is not just a simple rename() operation, and acts accordingly. Note that there is no move() API (for filesystems); the concept is a figment of the shell's imagination.

And me thinking I'd had a brilliant insight. There's always got to be someone to spoil it..
;-)

The perl documentation for rename() though, has this to say :
rename OLDNAME,NEWNAME

Changes the name of a file; an existing file NEWNAME will be clobbered. Returns true for success, false otherwise.

Behavior of this function varies wildly depending on your system implementation. For example, it will usually not work across file system boundaries, even though the system mv command sometimes compensates for this. Other restrictions include whether it works on directories, open files, or pre-existing files. Check the perlport manpage and either the rename(2) manpage or equivalent system documentation for details.

perl itself being written in C, is usually pretty close to the C library. But maybe the above is a bit dated.


Well, maybe my idea had something to it anyway.  I find this :

14.7 Renaming Files

The rename function is used to change a file's name.

— Function: int rename (const char *oldname, const char *newname)

The rename function renames the file oldname to newname. The file formerly accessible under the name oldname is afterwards accessible as newname instead. (If the file had any other names aside from oldname, it continues to have those names.)

The directory containing the name newname must be on the same file system as the directory containing the name oldname.
...

Re: http://www.gnu.org/s/libc/manual/html_node/Renaming-Files.html


What I am getting at is : what if, for reasons of efficiency (but not to the benefit of portability obviously) the developer of this C application of which the OP does not have the source, used a rename() call in order to move a file from one directory to the other, instead of a copy-and-delete sequence ?

That would at least have the benefit of keeping my earlier guess on the clever 
side.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to