darcs

Issue 366 unrevert => "Bug in Darcs" (Darcs2)

Title unrevert => "Bug in Darcs" (Darcs2)
Priority urgent Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, markstos, robertdamien, thorkilnaur, tommy
Assigned To
Topics Confirmed, Conflicts, Darcs2

Created on 2006-12-15.17:40:09 by robertdamien, last changed 2009-08-27.14:05:53 by admin.

Files
File name Uploaded Type Edit Remove
unrevert.sh kowey, 2007-07-17.19:18:18 application/octet-stream
Messages
msg1327 (view) Author: robertdamien Date: 2006-12-15.17:39:59
Hello everyone.

When i revert to a previous patch, make a conflicting change, unrevert, and then cancel the conflicting unrevert, darcs tells me there is a bug. I don't think this is a really serious bug. Here is a minimal exemple:

---
Feanor ~/essai/darcs $ darcs initialize
Feanor ~/essai/darcs $ touch plim
Feanor ~/essai/darcs $ touch ploum
Feanor ~/essai/darcs $ darcs add *
Skipping boring file _darcs
Feanor ~/essai/darcs $ darcs record
Darcs needs to know what name (conventionally an email address) to use as the
patch author, e.g. 'Fred Bloggs <fred@bloggs.invalid>'.  If you provide one
now it will be stored in the file '_darcs/prefs/author' and used as a default
in the future.  To change your preferred author address, simply delete or edit
this file.

What is your email address? Ploum.plim@plam.plom
addfile ./plim
Shall I record this change? (1/?)  [ynWsfqadjkc], or ? for help: a
What is the patch name? Version 0
Do you want to add a long comment? [yn]n
Finished recording patch 'Version 0'
Feanor ~/essai/darcs $ echo ploum >> ploum
Feanor ~/essai/darcs $ darcs revert 
hunk ./ploum 1
+ploum
Shall I revert this change? (1/?)  [ynWsfqadjkc], or ? for help: y
Do you really want to revert these changes? y
Finished reverting.
Feanor ~/essai/darcs $ echo plam >> ploum 
Feanor ~/essai/darcs $ darcs unrevert 
merger 0.0 (
hunk ./ploum 1
+plam
hunk ./ploum 1
+ploum
)
Shall I unrevert this change? (1/?)  [ynWsfqadjkc], or ? for help: n
darcs: bug in darcs!
fromJust error at PatchViewing.lhs:69 compiled 01:54:51 Oct 31 2006
Please report this to bugs@darcs.net,
If possible include the output of 'darcs --exact-version'.
---

Feanor ~/essai $ uname -a
Linux Feanor 2.6.17-2-amd64 #1 SMP Wed Sep 13 17:49:33 CEST 2006 xFeanor ~/essai $ darcs --version
1.0.9rc1 (release candidate 1)
Feanor ~/essai $ darcs --exact-version
darcs compiled on Oct 31 2006, at 01:58:00
# configured Mon Oct  9 15:12:44 EDT 2006
./configure --no-create --no-recursion

Context:

[TAG 1.0.9rc1
Tommy Pettersson <ptp@lysator.liu.se>**20061008175207] 
86_64 GNU/Linux

[I use a debian testing]

____________________________________________________________________________________
Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.
msg1335 (view) Author: kowey Date: 2006-12-17.12:38:16
[Resending to please the bug tracker]

I can reproduce this on both stable (1.0.9rc2) and unstable.  Note that
file plim is not needed for this case.

Thanks for the minimal test case, Damien.  This should ought to become
part of the test suite.
msg1858 (view) Author: kowey Date: 2007-07-17.19:18:18
Ok, I've had a look at this.  The scenario involves a situation where by some
combination of reverts, you manage to produce a merger for unrevert.  Here
things go wrong when you choose NOT to unrevert the merger.

It may not be worth trying to fix this, as we are going to be replacing mergers
with something else anyway.

If you are interested, the problem occurs in the call to make_bundle, where
darcs tries to save a copy of the patches you did not unrevert into
_darcs/patches/unrevert.  For some reason, this involves applying these patches
to a slurpy representing the pristine tree (why?).  This fails, but the fact
that it could fail comes as a total surprise to the Darcs.Patch.Viewer code.

The failure in question is an error applying a hunk to a file.  With some
liberal sprinkling of traces, the attached script (basically Damien's 
example) produces this merger:
merger 0.0 (
hunk ./a 1
+ploum
hunk ./a 1
+plim
)

... which merger_equivalent translates into

hunk ./a 1
-ploum

(HUH?)

I'm guessing that it is this hunk which it fails to apply to the file, which is
normal, because normally, that file is supposed to be empty.

I don't know enough of how darcs works (1) why we want to apply things to
pristine [well, a slurpy, not pristine proper] and (2) why merger_equivalent
does this, but hopefully this will be an easy answer for David.

If not, well, we could just wait for the new conflicts stuff and make this moot.
Attachments
msg2954 (view) Author: markstos Date: 2008-01-31.04:30:13
I confirmed this bug with Darcs2 and just "sent" a cleaned up version of the
test script to the bugs/ directory. The reported failure is:

darcs: bug in darcs!
fromJust errorsrc/Darcs/Patch/Viewing.lhs:84 compiled Jan 30 2008 21:28:11 at
src/Darcs/Patch/Viewing.lhs:84 compiled Jan 30 2008 21:28:11

##

I'm upgrading this to the urgent status since it's an explicit bug failure message.
msg2993 (view) Author: droundy Date: 2008-01-31.18:05:22
I'm just now pushing a patch that fixes this.  The bug turned out to be
unrelated to conflicts, just a bog standard got-the-wrong-context-for-a-patch bug.

David
History
Date User Action Args
2006-12-15 17:40:09robertdamiencreate
2006-12-17 12:38:23koweysetstatus: unread -> unknown
nosy: droundy, tommy, kowey, robertdamien
messages: + msg1335
2007-07-17 19:18:21koweysettopic: + Conflicts
nosy: + beschmi
messages: + msg1858
files: + unrevert.sh
2008-01-31 04:30:17markstossetstatus: unknown -> has-patch
priority: bug -> urgent
title: bug" when cancelling darcs unrevert -> unrevert => "Bug in Darcs" (Darcs2)
nosy: + markstos
messages: + msg2954
topic: + Confirmed, Darcs2
2008-01-31 18:05:26droundysetstatus: has-patch -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, markstos, robertdamien
messages: + msg2993
2008-09-04 21:30:04adminsetstatus: resolved-in-unstable -> resolved
nosy: + dagit
2009-08-06 17:41:23adminsetnosy: + jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, robertdamien
2009-08-06 20:38:33adminsetnosy: - beschmi
2009-08-10 21:59:39adminsetnosy: + robertdamien, - darcs-devel, zooko, jast, Serware, mornfall
2009-08-10 23:58:34adminsetnosy: - dagit
2009-08-25 17:54:59adminsetnosy: + darcs-devel, - simon
2009-08-27 14:05:53adminsetnosy: tommy, kowey, markstos, darcs-devel, robertdamien, thorkilnaur, dmitry.kurochkin