develooper Front page | perl.perl5.porters | Postings from September 2013

[perl #116451] File::Copy::syscopy doesn't preserve attrs as intended on Linux

Thread Previous | Thread Next
From:
Linda Walsh via RT
Date:
September 6, 2013 02:41
Subject:
[perl #116451] File::Copy::syscopy doesn't preserve attrs as intended on Linux
Message ID:
rt-3.6.HEAD-1873-1378435311-878.116451-15-0@perl.org
On Thu Sep 05 19:06:15 2013, rjbs wrote:
> I have re-visited this ticket and had a look at the documentation for
> syscopy, which reads like
> this:
> 
>            File::Copy also provides the "syscopy" routine, which
> copies the
>            file specified in the first parameter to the file specified
> in the
>            second parameter, preserving OS-specific attributes and
> file
>            structure.  For Unix systems, this is equivalent to the
> simple
>            "copy" routine, which doesn't preserve OS-specific
> attributes.  
>            For
> Win32
>            systems, this calls "Win32::CopyFile" [which does preserve
attributes].
----

> 
> I don't think I have a change to suggest that is worth making.  The
> "For Unix systems" bit is so
> close to the previous statement that I'm not sure any clarification is
> needed. 
====
The difference being -- that on Mac & Win32, the file attribute are
preserved (include ACL's and extended data and times).

If you even just wanted to preserve the time, all the platforms except 
unix do this.   But ACL's, Extended attr's and ownership are just as
important on Unix as on Win/Mac.

As for changing Unix to be consistent with Mac & Win -- that would seem
to make the call more reliable.  As it is now, the behavior is not
reliable between OS's.  So it can't be used, reliably, in a program to
get the same effect across OS's.  

But that seemed to be the whole point of File::Copy -- to provide an
architecture-agnostic method to "clone" or make an exact copy of a file.

If it does something different for each platform -- especially in not
preserving permissions/access lists and data-forks/alternate data
streams, then yes -- might as well use cp -a (-p only preserves
ownership and permission bits) not ACL's or extended attr's.

I think the point abagail might be making is that this module is
basically broken for Unix -- but works for Mac and Win in making full
copies of the file....




 We could change
> the "Unix systems" to "systems other than OS/2, VMS, and Win32."
> 
> I worry that considering changing the behavior of syscopy, in the
> future, is going to make it less
> and less reliable, rather than suddenly doing what people want.
> 
> Abigail has, if I recall correctly, been recommending just executing
> `cp -p` for years.  I think
> this may be the best advice for people seeking the behavior they know
> on their platform.




---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=116451

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About