Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File::Copy move() issue #9377

Open
p5pRT opened this issue Jun 13, 2008 · 4 comments
Open

File::Copy move() issue #9377

p5pRT opened this issue Jun 13, 2008 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 13, 2008

Migrated from rt.perl.org#55730 (status was 'open')

Searchable as RT55730$

@p5pRT
Copy link
Author

p5pRT commented Jun 13, 2008

From Mark.Zealey@webfusion.com

Hi,

The documentation for File​::Copy's move() function says

  If possible, move() will simply rename the file. Otherwise,
it
  copies the file to the new location and deletes the original.
If
  an error occurs during this copy-and-delete process, you may
be
  left with a (possibly partial) copy of the file under the
destina-
  tion name.

However, this does not seem to work all the time. Under some situations
the rename() attempt​:

  return 1 if rename $from, $to;

dies rather than returns false (eg on linux trying to move a directory
from one mount-point to another). This line should probably be wrapped
in an eval block.

Thanks,

Mark

--
Mark Zealey -- Shared Hosting Team Leader
Product Development * Webfusion
123-reg.co.uk, webfusion.co.uk, donhost.co.uk, supanames.co.uk

This mail is subject to http​://www.gxn.net/disclaimer

@p5pRT
Copy link
Author

p5pRT commented Nov 12, 2011

From @jkeenan

I'm somewhat confused about your post. Your subject line suggests your
problem is with File​::Copy​::move(), but the example you cite is with the
Perl builtin 'rename'. You observe​:

" return 1 if rename $from, $to;

"dies rather than returns false (eg on linux trying to move a directory
from one mount-point to another)."

'perldoc -f rename' states​:

"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 perlport and either the rename(2)
manpage or equivalent system documentation for details."

'man 2 rename' on Linux provides this error code​:

"EXDEV
oldpath and newpath are not on the same mounted file system.
(Linux permits a file system to be mounted at multiple points,
but rename() does not work across different mount points, even
if the same file system is mounted on both.)"

So it seems that the problem you cite is already documented. Can you
clarify?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Nov 12, 2011

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2011

From Mark.Zealey@webfusion.com

The code provided is from move() of File​::Copy - as in the original bug report this line sometimes dies which means that the specification provided in the manual of File​::Copy (namely that File​::Copy​::move() will work even when a normal rename() would fail) is not being followed.

Mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants