develooper Front page | perl.perl5.porters | Postings from May 2008

Re: [PATCH] File::Copy & permission bits.

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
May 23, 2008 08:53
Subject:
Re: [PATCH] File::Copy & permission bits.
Message ID:
c9ab31fc0805230853r5e974cacp974dcc9e212c6bde@mail.gmail.com
On Wed, May 7, 2008 at 4:16 PM, Abigail <abigail@abigail.be> wrote:
>
> The following patch to File::Copy makes if one copies a file, permission
> bits are handled as POSIX 1003.1 describes the shell utility 'cp' ought
> to behave.

Belatedly following up on this.  If the rationale is that Perl should
act as much as possible like a native utility, then this clearly is
the right thing to do.  If, on the other hand, Perl should have its
own definition of the right thing to do and act the same on all
platforms, then this actually widens the gap between platforms.  I
don't have any strong objection to your change, but I just want you to
be aware you are shifting us from the latter to the former (after
umpteen years of the latter).

> A few points:
>
>  * The patch is probably incomplete. Non-Unix systems may need some
>    special handling, depending on what '(stat $fh) [2]' returns.
>    I neither have knowledge of, nor access to any non-Unix systems
>    to develop this myself.
>
>  * This patch introduces a non-backwards compatible change. Some code
>    somewhere is probably relying on the fact the permission bits of
>    the new file have no relation to the file copied from.

On VMS, and I believe also on Win32 (which closely mimics the VMS file
protection scheme), the absence of a relationship between the source
file permissions and the target file permissions is by design.  The
specifics can get rather complicated, but the gist of it is that a
copy of a file is a new file that is expected to play nice in its new
environment, where "environment" may include previous versions of the
same file, process defaults, directory defaults, ACLs, etc.  Native
utilities can override this behavior (COPY/PROTECTION on VMS, XCOPY /O
on Windows), but it's something you have to ask for explicitly.

>  * The new tests may not work on all non-Unix systems.

I'd say they are unlikely to work at all on any non-Unix system.  I've
checked in change #33916 to skip them on VMS.  Last I saw they were
all failing in the Win32 smokes and they will probably have to be
skipped there as well.

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