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

Re: One less File::Copy bug

Thread Previous | Thread Next
From:
Craig A. Berry
Date:
May 1, 2008 12:46
Subject:
Re: One less File::Copy bug
Message ID:
c9ab31fc0805011245l110924eeie322c18d00c6d0d5@mail.gmail.com
On Thu, May 1, 2008 at 1:32 PM, Johan Vromans <jvromans@squirrel.nl> wrote:
> "Craig A. Berry" <craig.a.berry@gmail.com> writes:
>
>  > It's understandable you wouldn't since VMS is probably the only
>  > supported OS that uses them.
>
>  Be careful with what you think -- I've been working quite a lot with
>  VMS

Glad to know I missed the mark.

> and even helped Digital Equipment Corp. (for thos who do not know:
>  VMS was not developed by Compaq nor HP) to get the support for Unix
>  things like stream-LF files and shell globbing right.

Excellent.  Can I report bugs to you? :-)

>  > ------
>  > ...
>
> > For Unix
>  > systems, C<syscopy> is equivalent to the simple C<copy> routine (and
>  > is not exportable) since Unix filesystems have no such attributes.
>  > ------
>
>  Yes, it does.

You snipped the part where I said structure attributes and other
non-portable attributes.

>  > Now, back to what I think you're interested in.  Unix filesystems do
>  > have timestamps and permission bits (anything else worth noting in the
>  > file header?).  Should those be preserved by a file copy operation?
>
>  Yes.

Always?  How do you know that?

>  > Should there be optional parameters to copy() and/or syscopy() to turn
>  > those features on or off?
>
>  No.
>
>
>  >  I would think copy() should do what cp does
>  > (assuming it does the same thing on all unixish systems)
>
>  'cp' does preserve them.

Hmm.  Just did a quick test on OS X and cp does *not* preserve ctime,
mtime, or utime by default.  It does appear to preserve permissions,
including the execute bit, at least when copying within a directory
that I own.  This is consistent with the documentation for C<cp -p>,
so while I could see justification for adding an option equivalent to
the -p flag to copy() and/or syscopy(), it would seem an unfair
surprise to change defaults that are consistent with the defaults of
the utility that is the closest analogue.

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