darcs

Issue 440 mv => silently overwrites files in working directory

Title mv => silently overwrites files in working directory
Priority bug Status resolved
Milestone Resolved in
Superseder Pull/apply can overwrite files that are not owned by darcs
View: 319
Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, tommy
Assigned To kowey
Topics ProbablyEasy

Created on 2007-04-18.19:47:56 by kowey, last changed 2009-08-27.14:11:43 by admin.

Messages
msg1638 (view) Author: kowey Date: 2007-04-18.19:47:46
Due to the behaviour of renameFile and renameDirectory, which silently
replace things that already exist.  We probably should *not* do this,
the basic principle being not to harm anything that doesn't belong to
us.

 mkdir x 
 cd x; darcs init
 touch a
 darcs add a 
 darcs record -am 'a'
 cd ..

 darcs get x x2
 cd x2
 echo 'hi' > b
 cd ..

 cd x
 darcs mv a b
 darcs record -am 'a -> b'
 cd ..

 cd x2
 darcs pull
 echo 'hi' > good-b
 diff good-b b
 cd ..

Note that not silently renaming the file/directory could also be bad
for darcs (because then maybe it can't apply future patches), but
better for darcs to give up than just overwrite the user's stuff.

Also, this might make more sense within the context of a repaired
issue434, don't want to give darcs any more excuses to just up and
die in the middle of a pull.
msg1640 (view) Author: droundy Date: 2007-04-18.19:53:54
On Wed, Apr 18, 2007 at 07:47:57PM +0000, Eric Kow wrote:
> Due to the behaviour of renameFile and renameDirectory, which silently
> replace things that already exist.  We probably should *not* do this,
> the basic principle being not to harm anything that doesn't belong to
> us.

Agreed.  I would recommend trying to rename the file or directory that's
in the way--but only if we're doing this tolerantly, otherwise we should
exit with an error.  I believe we've got some code already in Lock to
select a new filename based on an existing one, so we could go for
something like "badname.oldversion" or "badname.oldversion.1" etc.

> Also, this might make more sense within the context of a repaired
> issue434, don't want to give darcs any more excuses to just up and
> die in the middle of a pull.

Yes, I agree, the two changes should go in together.
-- 
David Roundy
Department of Physics
Oregon State University
msg2236 (view) Author: kowey Date: 2007-11-04.22:54:01
The unstable branch now has a feature for backing up files in the working
directory before clobbering them.  That should solve the problem.

Tue Aug 21 07:19:42 CEST 2007  Eric Kow <eric.kow@loria.fr>
  * [issue319, issue440] Backup unmanged working dir files as needed.
History
Date User Action Args
2007-04-18 19:47:56koweycreate
2007-04-18 19:53:56droundysetstatus: unread -> unknown
nosy: droundy, tommy, beschmi, kowey
messages: + msg1640
2007-07-16 11:24:02koweysettopic: + ProbablyEasy
nosy: droundy, tommy, beschmi, kowey
2007-08-09 07:21:39koweysetsuperseder: + Pull/apply can overwrite files that are not owned by darcs
2007-11-04 22:54:01koweysetstatus: unknown -> resolved-in-unstable
messages: + msg2236
2007-11-17 11:14:26koweysetstatus: resolved-in-unstable -> resolved-in-stable
2008-09-16 21:30:59adminsetstatus: resolved-in-stable -> resolved
nosy: + dagit
2009-08-06 17:34:11adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy
2009-08-06 20:31:31adminsetnosy: - beschmi
2009-08-10 22:03:19adminsetnosy: - markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:00:19adminsetnosy: - dagit
2009-08-25 17:48:50adminsetnosy: + darcs-devel, - simon
2009-08-27 14:11:43adminsetnosy: tommy, kowey, darcs-devel, thorkilnaur, dmitry.kurochkin