Issue 2674 moving unadded files

Title moving unadded files
Priority urgent Status resolved
Milestone Resolved in
Superseder Nosy List bfrk
Assigned To

Created on 2021-03-09.15:39:52 by bfrk, last changed 2022-04-10.11:23:12 by bfrk.

msg22649 (view) Author: bfrk Date: 2021-03-09.15:39:48
Henning Thielemann <lemming@henning-thielemann.de> reported:

I am able to move unadded files if I do this in one go with moving 
an added file:

$ darcs init
Finished initializing repository.
$ echo added >added.txt
$ echo unadded >unadded.txt
$ mkdir newdir
$ darcs add added.txt newdir/
Adding './added.txt'
Adding './newdir'
Finished adding:
$ darcs mv added.txt unadded.txt newdir/
Finished moving: ./added.txt ./unadded.txt to: ./newdir
$ darcs whatsnew -s
A ./newdir/
 ./unadded.txt -> ./newdir/unadded.txt
A ./newdir/added.txt

I can even record those changes and 'darcs test' does not complain.
msg22650 (view) Author: bfrk Date: 2021-03-09.15:45:46
I can reproduce it. This is a serious bug!
msg22651 (view) Author: bfrk Date: 2021-03-09.15:53:52
It is even simpler to reproduce: we merely need to move two unadded 
files to a directory. It seems in teh case of three or more arguments 
we completely fail to check if the source files are know to darcs.
msg22652 (view) Author: bfrk Date: 2021-03-09.16:12:27
It should at least have crashed when we try to apply pending to 
pristine. But the code in Darcs.Util.Tree.Monad does not have a check 
for renaming non-existent paths either!
msg22653 (view) Author: bfrk Date: 2021-03-09.19:15:27
Fixing the bug in the frontend was easy. But I also wanted to fix 
the missing internal failure in the TreeMonad. Fixing that revealed 
another problem in Darcs.Repository.State where we wrongly apply 
auto-detected moves not only to the pending state, but also to the 
working state. Note that these moves are by definition already 
"applied" in the working tree which makes all tests with --look-for-
moves fail. Fixing that was not too difficult but also not 
completely trivial.
Will send a patch and also prepare a new bugfix release on the 2.16 
msg22959 (view) Author: bfrk Date: 2022-04-10.11:23:12
Resolved by

patch 46bb7acd45b236920abf807efeef7544de76d7d0
Author: Ben Franksen <ben.franksen@online.de>
Date:   Tue Mar  9 17:39:18 CET 2021
  * resolve issue2674: moving unadded files
Date User Action Args
2021-03-09 15:39:53bfrkcreate
2021-03-09 15:45:48bfrksetpriority: urgent
status: unknown -> needs-diagnosis/design
messages: + msg22650
2021-03-09 15:53:55bfrksetmessages: + msg22651
2021-03-09 16:12:30bfrksetmessages: + msg22652
2021-03-09 19:15:30bfrksetmessages: + msg22653
2022-04-10 11:23:12bfrksetstatus: needs-diagnosis/design -> resolved
messages: + msg22959