[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: cp doesn't overwrite fifos
From: |
Bob Proulx |
Subject: |
Re: cp doesn't overwrite fifos |
Date: |
Fri, 21 Oct 2005 21:04:01 -0600 |
User-agent: |
Mutt/1.5.9i |
Jim Meyering wrote:
> >> In this particular case, using the gnu-specific --remove-destination
> >> option will make it do what you want.
> >
> > Ah, i missed that one. What is the advantage of truncating the existing
> > file instead of removing it first?
>
> For some uses, it's the only approach that works, for example
> if you have write access to a file in a write-protected directory.
Also by copying on top of an existing file all of the existing
permissions are preserved. If you remove the file first and create a
new one then the file will have permissions as specified by umask.
This is not always what you want. I know I count on this behavior.
> If you care about atomicity, you might prefer to use rsync.
I am a great fan of rsync and use it often. Yet when I care about
atomicity I explicitly copy the file off to the side and rename it
into place. That can be done with standard commands and rsync has not
yet made it to that status.
Bob