darcs

Issue 589 buggy error message: Impossible case in darcs PatchRead.lhs or Patch/Read.lhs

Title buggy error message: Impossible case in darcs PatchRead.lhs or Patch/Read.lhs
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, ertai, kowey, markstos, michael, thorkilnaur, tommy
Assigned To droundy
Topics

Created on 2008-01-16.15:11:24 by michael, last changed 2009-10-24.00:05:40 by admin.

Files
File name Uploaded Type Edit Remove
yi.tar.bz2 droundy, 2008-01-17.15:48:59 application/x-bzip
Messages
msg2533 (view) Author: michael Date: 2008-01-16.15:11:22
Running
 	darcs get http://code.haskell.org/yi
produces one of the following responses (depending on version).

Running the darcs-1.0.9-i386-linux binary, as downloaded from darcs.net, 
produces the message:

$ darcs get http://code.haskell.org/yi
...
FINISHED --18:23:31--
Downloaded: 5,562,103 bytes in 1370 files
Applying patch 551 of 1370... darcs: bug in darcs!
Impossible case at PatchRead.lhs:58 compiled 18:47:46 Aug 28 2007
Please report this to bugs@darcs.net,
If possible include the output of 'darcs --exact-version'.
$ darcs --exact-version
darcs compiled on Aug 28 2007, at 18:50:44
# configured Sat Jun 16 09:59:48 PDT 2007
./configure /usr/local/share/config.site /usr/local/etc/config.site

Context:

[TAG 1.0.9
Tommy Pettersson <ptp@lysator.liu.se>**20070603213706]
$

Alternatively, after downloading and building darcs from the repository 
using
 	darcs get --verbose --partial http://darcs.net/repos/stable
the error message has moved slightly:

$ darcs get http://code.haskell.org/yi/
Directory '/home/mga83/working/Haskell/yi' already exists, creating 
repository as '/home/mga83/working/Haskell/yi_0'
Copying patch 1370 of 1370... done.
Applying patch 551 of 1370... darcs: bug in darcs!
Impossible case at src/Darcs/Patch/Read.lhs:58 compiled 18:37:35 Jan 15 
2008
Please report this to bugs@darcs.net,
If possible include the output of 'darcs --exact-version'.
$ darcs --version
1.1.0pre1 (unknown)
$ darcs --exact-version | wc -l
1433
$

By the way, the page http://www.darcs.net/manual/node3.html suggests 
downloading the darcs repository from http://abridgegame.org/repos/darcs 
-- this appears to be a case of bit rot!

I hope this report is helpful.  Unfortunately searching bugs.darcs.net 
doesn't seem to work and just hangs.
msg2537 (view) Author: ertai Date: 2008-01-16.19:18:51
Excerpts from bugs's message of Wed Jan 16 15:11:24 UTC 2008:
> 
> New submission from Michael Abbott <michael@araneidae.co.uk>:
> 

[...]

> By the way, the page http://www.darcs.net/manual/node3.html suggests 
> downloading the darcs repository from http://abridgegame.org/repos/darcs 
> -- this appears to be a case of bit rot!

I've  just  sent  a  patch  to  use  http://darcs.net/repos/stable  instead of
http://abridgegame.org/darcs.
msg2538 (view) Author: ertai Date: 2008-01-16.19:19:12
Excerpts from bugs's message of Wed Jan 16 15:11:24 UTC 2008:
> 
> New submission from Michael Abbott <michael@araneidae.co.uk>:
> 

[...]

> By the way, the page http://www.darcs.net/manual/node3.html suggests 
> downloading the darcs repository from http://abridgegame.org/repos/darcs 
> -- this appears to be a case of bit rot!

I've  just  sent  a  patch  to  use  http://darcs.net/repos/stable  instead of
http://abridgegame.org/darcs.
msg2543 (view) Author: droundy Date: 2008-01-17.15:48:59
Michael, could this download be passing through a proxy that might modify the files?

Could you diff the contents of your _darcs/patches directory agains that of the
attached yi.tar.bz2?
Attachments
msg2544 (view) Author: michael Date: 2008-01-17.17:01:22
> Michael, could this download be passing through a proxy that might 
> modify the files?
>
> Could you diff the contents of your _darcs/patches directory agains that of the
> attached yi.tar.bz2?

Absolute, and this was definitely the trigger.  It took me a while to 
figure it out (there are some 1,500 patches in Yi) but, yes, for whatever 
reason our web poxy decided to transform one patch into something 
completely different.

So perhaps this transforms the issue from an outright bug into an 
unfriendly behaviour.  I see two points:

1. The error message implies that the problem is entirely the fault of 
darcs (and so of course gives little hint about identifying the true 
culprit).

2. Evidently darcs fails to do any checking on the patches before 
processing them.  A CRC checksum might be a good thing.

Actually, the fact that darcs fetchs each of 1500 patches as separate http 
requests is itself rather painful: takes much longer than it would if this 
could be done as a single http or https request -- and using https would 
bypass any brain damaged proxy to further benefit!
msg2547 (view) Author: droundy Date: 2008-01-17.17:08:04
On Thu, Jan 17, 2008 at 04:57:52PM +0000, Michael Abbott wrote:
> >Michael, could this download be passing through a proxy that might
> >modify the files?
> >
> >Could you diff the contents of your _darcs/patches directory agains that
> >of the attached yi.tar.bz2?
> 
> Absolute, and this was definitely the trigger.  It took me a while to 
> figure it out (there are some 1,500 patches in Yi) but, yes, for whatever 
> reason our web poxy decided to transform one patch into something 
> completely different.
> 
> So perhaps this transforms the issue from an outright bug into an 
> unfriendly behaviour.  I see two points:
> 
> 1. The error message implies that the problem is entirely the fault of 
> darcs (and so of course gives little hint about identifying the true 
> culprit).

I'd say this is the bug (and will retitle it accordingly).  We should state
what's actually happening here.

> 2. Evidently darcs fails to do any checking on the patches before 
> processing them.  A CRC checksum might be a good thing.

This is handled in the upcoming --darcs-2 and --hashed formats.

> Actually, the fact that darcs fetchs each of 1500 patches as separate http 
> requests is itself rather painful: takes much longer than it would if this 
> could be done as a single http or https request -- and using https would 
> bypass any brain damaged proxy to further benefit!

This is another issue.  You could certainly use https if you like (and if
your libcurl supports it), just change your URL.  We're working on request
pipelining for darcs 2.
-- 
David Roundy
Department of Physics
Oregon State University
msg2730 (view) Author: markstos Date: 2008-01-25.01:43:47
David, 

If this is just a string change to create a better error message, perhaps this
issue could be resolved sooner? 

I still don't understand the issue well enough to even suggest what a better
error message might be.
msg2735 (view) Author: michael Date: 2008-01-25.09:57:59
On Fri, 25 Jan 2008, Mark Stosberg wrote:
> If this is just a string change to create a better error message, perhaps this
> issue could be resolved sooner?
>
> I still don't understand the issue well enough to even suggest what a better
> error message might be.

If we're just talking about improving the error message, then can I 
suggest something along the lines of:

 	Patch blah blah corrupted: unable to apply

where the blah blah bit gives the proper filename of the patch.  Then at 
least I can hunt it out and look inside it to see -- aha! my damned proxy 
again.

The current error message says (1) panic panic darcs is broken and (2) 
just identifies the patch by number.  The problem with this is that 
finding the patch file requires a little guesswork and the lucky fact that 
`ls` lists the patches in the same order as darcs was reading them.
msg2753 (view) Author: droundy Date: 2008-01-25.20:16:16
Micheal, have you still got your repository/proxy combination that corrupts patches?

If so, could you try this test again with the latest darcs 2? I've made a change
that will (I think) improve the error message (by changing to a strict parsing),
but I'd rather close this after hearing from you that it's good enough.

Thanks for your bug report!

David
msg2761 (view) Author: michael Date: 2008-01-25.20:47:24
On Fri, 25 Jan 2008, David Roundy wrote:
> Micheal, have you still got your repository/proxy combination that 
> corrupts patches?
>
> If so, could you try this test again with the latest darcs 2? I've made 
> a change that will (I think) improve the error message (by changing to a 
> strict parsing), but I'd rather close this after hearing from you that 
> it's good enough.

Alas, after I complained, the administrators fixed the problem (by adding 
the web site to an exceptions list, the idiots, but you can't have 
everything), so alas I can't reproduce the problem anymore!

However, come to think of it, I can reproduce it simply by trashing one of 
the patches in place and running `darcs repair`.  Let's see...

Sorry, I'm going to need some advice: I can't figure out how to get your 
latest version.  Running `darcs pull` tells me that I'm up to date, which 
I suspect is because I'm on http://darcs.net/repos/stable ... 
unfortunately a fairly quick search gives me no clue as to where the 
current bleeding edge version of darcs is!  Sorry for being obtuse here.

I'll have a go some time tomorrow if you can point me in the right 
direction.

> Thanks for your bug report!

P.S. The page http://www.darcs.net/manual/node3.html still refers me to 
http://abridgegame.org/repos/darcs which is dormant;  I think ertai 
(message 2538) said they'd made a patch to fix this?
msg2763 (view) Author: markstos Date: 2008-01-25.20:50:03
> Sorry, I'm going to need some advice: I can't figure out how to get your 
> latest version.  Running `darcs pull` tells me that I'm up to date, 
> which I suspect is because I'm on http://darcs.net/repos/stable ... 
> unfortunately a fairly quick search gives me no clue as to where the 
> current bleeding edge version of darcs is!  Sorry for being obtuse here.

Michael,

darcs get  http://darcs.net/repos/unstable

Should work for you.

   Mark
msg2797 (view) Author: michael Date: 2008-01-26.16:43:18
> darcs get  http://darcs.net/repos/unstable

Works fine (takes forever, but I guess that's the 5,077 separate http 
requests) and build fine.

I reproduces the original message by writing rubbish into one of the Yi 
patch files; now I get the message:

$ ../darcs/unstable/darcs repair
darcs: failed to read patch:
Mon Aug 15 02:25:46 BST 2005  Don Stewart <dons@cse.unsw.edu.au>
   * kill off silly ^M in test data
Couldn't parse file 
/home/mga83/working/Haskell/yi.hack/_darcs/patches/20050815012546-9c5c1-2181b0dfc6b06ff299fa072570ab0c9417ae5715.gz
$

Seems fair enough, and if I delete the offending file I get the extra text 
on the end of the filename:
 	: openBinaryFile: does not exist (No such file or directory)

Seems ok to me.

One oddity I noticed, don't know if it signifies anything: while reading 
the patches it starts counting up reporting:
 	Reading patches from /home/mga83/working/Haskell/yi.hack 14/331
... except there are a good deal more that 331 to read!  When the number 
(14 above) grows above 331 the /331 goes away.
     I don't know if this signifies anything, but it's new behaviour since 
the stable version.
msg2799 (view) Author: markstos Date: 2008-01-26.18:55:50
Michael,

Thank for the additional testing. I know the download/compile/test cycle can be
time consuming. Based on your report, I'm marking this as "resolved-in-unstable".

The numbers you are seeing are part of a new "progress reporting framework" It
is still getting the kinks worked out, but is unrelated to this bug. 

Thanks again for your feedback and help with darcs!

   Mark
History
Date User Action Args
2008-01-16 15:11:25michaelcreate
2008-01-16 19:18:53ertaisetstatus: unread -> unknown
nosy: + darcs-devel, ertai
messages: + msg2537
2008-01-16 19:19:13ertaisetnosy: darcs-devel, michael, droundy, tommy, kowey, beschmi, ertai
messages: + msg2538
2008-01-17 15:41:03droundylinkissue590 superseder
2008-01-17 15:49:01droundysetpriority: bug
nosy: droundy, tommy, beschmi, kowey, darcs-devel, ertai, michael
messages: + msg2543
files: + yi.tar.bz2
2008-01-17 17:01:23michaelsetnosy: droundy, tommy, beschmi, kowey, darcs-devel, ertai, michael
messages: + msg2544
2008-01-17 17:08:06droundysetnosy: droundy, tommy, beschmi, kowey, darcs-devel, ertai, michael
messages: + msg2547
title: Impossible case in darcs PatchRead.lhs or Patch/Read.lhs -> buggy error message: Impossible case in darcs PatchRead.lhs or Patch/Read.lhs
2008-01-25 01:43:48markstossetstatus: unknown -> has-patch
nosy: + markstos
messages: + msg2730
2008-01-25 09:58:00michaelsetnosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2735
2008-01-25 20:16:17droundysetstatus: has-patch -> testing
nosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2753
2008-01-25 20:16:30droundysetnosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
assignedto: droundy
2008-01-25 20:47:26michaelsetnosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2761
2008-01-25 20:50:04markstossetnosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2763
2008-01-26 16:43:21michaelsetnosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2797
2008-01-26 18:55:51markstossetstatus: testing -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, markstos, darcs-devel, ertai, michael
messages: + msg2799
2008-09-04 21:31:57adminsetstatus: resolved-in-unstable -> resolved
nosy: + dagit
2009-08-06 17:35:42adminsetnosy: + jast, Serware, dmitry.kurochkin, zooko, mornfall, simon, thorkilnaur, - droundy, ertai, michael
2009-08-06 20:32:54adminsetnosy: - beschmi
2009-08-10 22:10:51adminsetnosy: + michael, ertai, - zooko, jast, Serware, mornfall
2009-08-11 00:04:36adminsetnosy: - dagit
2009-08-25 17:49:53adminsetnosy: - simon
2009-08-27 14:08:09adminsetnosy: tommy, kowey, markstos, darcs-devel, thorkilnaur, ertai, michael, dmitry.kurochkin
2009-10-23 22:40:41adminsetnosy: + nicolas.pouillard, - ertai
2009-10-24 00:05:40adminsetnosy: + ertai, - nicolas.pouillard