[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: design question, why not always use 'cp --remove-destination'?
From: |
Eric Blake |
Subject: |
Re: design question, why not always use 'cp --remove-destination'? |
Date: |
Tue, 22 Aug 2006 08:36:08 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.5) Gecko/20060719 Thunderbird/1.5.0.5 Mnenhy/0.7.4.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Frederik Eaton on 8/22/2006 8:12 AM:
> Dear bug-coreutils,
>
> We are trying to decide what the semantics of the Haskell standard
> library function 'copyFile' should be. The first incarnation behaved
> roughly like 'cp', i.e. overwriting destination files without
> unlinking them first. This isn't suitable for installing stuff, for
> example, since if an executable is running and we try to overwrite it
> then there is a "Text file busy" error. We could change the semantics
> to be the same as 'cp --remove-destination', i.e. unlinking
> pre-existing destination files.
cp follows POSIX semantics unless you add the flag --remove-destination.
>
> The question is, is there a reason why users wouldn't always want a
> "copyFile" function to remove the destination first? If there is, then
> maybe we should have two separate functions, for both situations. The
> only drawback I can think of for removing the destination first, is a
> race condition when someone else is trying to create the same file,
> but how often does that actually become a problem?
One reason is permissions. Editing an existing file preserves the owner,
group, and inode; whereas unlinking and creating a new file does not.
- --
Life is short - so eat dessert first!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFE6xZX84KuGfSFAYARAsIvAKCVEHZa/klU3GKR5gcXA0BRO+GFHQCfV6hJ
qI4+d9FEO6yj2HYWUK4bROE=
=+aWu
-----END PGP SIGNATURE-----
- design question, why not always use 'cp --remove-destination'?, Frederik Eaton, 2006/08/22
- Re: design question, why not always use 'cp --remove-destination'?, Krasimir Angelov, 2006/08/22
- Re: design question, why not always use 'cp --remove-destination'?,
Eric Blake <=
- Re: design question, why not always use 'cp --remove-destination'?, Jim Meyering, 2006/08/22
- Re: design question, why not always use 'cp --remove-destination'?, Andreas Schwab, 2006/08/22
- Re: design question, why not always use 'cp --remove-destination'?, Paul Eggert, 2006/08/22