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

Re: Recommended file-copying method

Thread Previous | Thread Next
From:
Kent Fredric
Date:
July 9, 2013 03:41
Subject:
Re: Recommended file-copying method
Message ID:
CAATnKFDyXUBA2b=kVSedZHDRE3dj39CGxKCUeGCTOtV83TNovg@mail.gmail.com
On 9 July 2013 15:17, Aristotle Pagaltzis <pagaltzis@gmx.de> wrote:
> * David Golden <xdg@xdg.me> [2013-07-09 03:25]:
>> Even /bin/cp doesn't preserve properties by default and that's what
>> a lot of people think of when they think about file copying semantics.
>
> Uh.
>
>     $ touch foo
>     $ chmod +x foo
>     $ /bin/cp foo bar
>     $ [ -x bar ] && echo 'preserved'
>     preserved
>
> Your allegation is news to me. It won’t preserve much else by default,
> but the file mode, it will. (In fact I don’t even know how to prevent
> a BSDish cp from doing that.)

$ sudo touch foo
$ sudo chmod u+s foo
$ /bin/cp foo bar
$ ls -la foo bar
-rw-r--r-- 1 kent kent 0 Jul  9 15:38 bar
-rwSr--r-- 1 root root 0 Jul  9 15:37 foo

Not all properties can be copied, which is what I think XDG was getting at.


-- 
Kent

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