darcs

Issue 1488 fromJust error in WhatsNew (apply_to_slurpy)

Title fromJust error in WhatsNew (apply_to_slurpy)
Priority bug Status resolved
Milestone 2.5.0 Resolved in 2.4.x
Superseder Nosy List byorgey, darcs-devel, dmitry.kurochkin, ertai, kowey, marnix, thorkilnaur
Assigned To
Topics

Created on 2009-07-09.19:58:58 by byorgey, last changed 2010-07-23.18:55:59 by tux_rocker.

Files
File name Uploaded Type Edit Remove
zshrc byorgey, 2009-09-08.15:19:23 application/octet-stream
Messages
msg7940 (view) Author: byorgey Date: 2009-07-09.19:58:54
I have darcs 2.2.1 (just built yesterday with ghc-6.10.3 via 'cabal install
darcs').  As you can see, after issuing 'darcs init' and then trying to add
files to the repository, I got an error when trying to tab-complete the file to add:

[brent@euclid:~/hacking/species]$ darcs init
[brent@euclid:~/hacking/species]$ darcs add Math/Combinatorics/darcs: bug in darcs!
fromJust error at src/Darcs/Commands/WhatsNew.lhs:120 compiled Jul  8 2009
20:38:28 at src/Darcs/Commands/WhatsNew.lhs:120 compiled Jul  8 2009 20:38:28
I'm unable to check http://darcs.net/maintenance to see if this version is
supported.
If it is supported, please report this to bugs@darcs.net
If possible include the output of 'darcs --exact-version'.

[exact same error repeated 9 more times]

[brent@euclid:~/hacking/species]$ darcs --exact-version
darcs compiled on Jul  8 2009, at 20:38:26

Context:

[TAG 2.2.1
Petr Rockai <me@mornfall.net>**20090214071133
 Ignore-this: f4a1d192bc93490e498eed18c1165d8d
]
msg7968 (view) Author: kowey Date: 2009-07-15.16:39:56
Hi Brent,

On Thu, Jul 09, 2009 at 19:58:59 -0000, Brent Yorgey wrote:
> I have darcs 2.2.1 (just built yesterday with ghc-6.10.3 via 'cabal install
> darcs').  As you can see, after issuing 'darcs init' and then trying to add
> files to the repository, I got an error when trying to tab-complete the file to add:

Do you know what tab-completion script you're using by any chance?
It'd be interesting to see what exact darcs command is being called here

> [brent@euclid:~/hacking/species]$ darcs init
> [brent@euclid:~/hacking/species]$ darcs add Math/Combinatorics/darcs: bug in darcs!
> fromJust error at src/Darcs/Commands/WhatsNew.lhs:120 compiled Jul  8 2009

Also, we'd appreciate it if you send us a sample repo that lets us
reproduce this.

Thanks,
msg8198 (view) Author: kowey Date: 2009-08-17.06:55:49
Hi Brent,

Thanks again for the report!  I think you may have helped us find an interesting
bug.  Just seeing if I might be able to get a repository out of you or something
we can use to reproduce this :-)

Darcs developers: OK, so I've had another look at this and I don't think
--list-options is the issue here (since add just uses list_unregistered_files),
so I'm guessing that this is a tab-completion script that uses darcs whatsnew to
figure out what files to add.  I wonder which.

Here's the offending bit of code in Darcs/Commands/Whatsnew.lhs

    chold <- get_unrecorded_no_look_for_adds repository (map sp2fn files)
    s <- slurp_recorded repository
    ftf <- filetype_function
    cho_adds :> _ <- return $ partitionRL is_hunk $ reverseFL chold
    cha :> _ <- return $ partitionRL is_hunk $ reverseFL all_changes
    let chn    = unsafeDiff [LookForAdds,Summary] ftf
                            (fromJust $ apply_to_slurpy (reverseRL cho_adds) s)
                            (fromJust $ apply_to_slurpy (reverseRL cha) s)

It's the second apply_to_slurpy that's going wrong here, but why?  We're trying
to apply some set of patches to our in-memory representation of the recorded
state.  Why does this fail?
msg8710 (view) Author: byorgey Date: 2009-09-05.21:42:35
OK, I've now got a minimal way to reproduce this.  I'm now using darcs 2.3.0
which also seems to exhibit the bug.

[brent@archimedes:~/hacking]$ mkdir darcstest
[brent@archimedes:~/hacking]$ cd darcstest
[brent@archimedes:~/hacking/darcstest]$ mkdir -p Foo/Bar
[brent@archimedes:~/hacking/darcstest]$ darcs init
[brent@archimedes:~/hacking/darcstest]$ darcs add Foo/Bar/darcs: bug at
src/Darcs/Commands/WhatsNew.lhs:130 compiled Aug  3 2009 10:17:23
fromJust error at src/Darcs/Commands/WhatsNew.lhs:130 compiled Aug  3 2009 10:17:23
See http://wiki.darcs.net/index.html/BugTrackerHowto for help on bug reporting.

I just create an empty repo with some nested directories Foo/Bar, and then type
'darcs add Foo/Bar' and then hit tab twice.  I would expect it to tell me there
are no files there to add, but instead it gives me this error.  Interestingly, I
do NOT get the error if I just do 'darcs add Foo' and then hit tab.  I'm also
unable to reproduce the error just by calling 'darcs whatsnew X', where X is
either empty, 'Foo', or 'Foo/Bar'.  I'm not exactly sure what the tab completion
is doing, but I'm using zsh if that helps at all.
msg8715 (view) Author: kowey Date: 2009-09-06.08:41:18
Great! Now we've got consistent reproducibility on Brent's side.  Unfortunately,
I tried the same thing and did not get this error.  Can somebody else please
reproduce this?  It takes all of 10 seconds to do.
msg8716 (view) Author: kowey Date: 2009-09-06.08:43:39
I just noticed Brent saying that he was using Zsh (big clue!).  I'm also using
Zsh but probably not any of the completion scripts.  Brent: is there any chance
you could work out which completion script zsh is using?  It seems pretty clear
that the bug is ours, but how do we trigger it?
msg8717 (view) Author: byorgey Date: 2009-09-06.13:21:36
I'm not even sure how to tell.  I cargo-culted most of my .zshrc from someone
else.  What do I look for?
msg8718 (view) Author: kowey Date: 2009-09-06.19:30:19
Perhaps you could send us your .zshrc?
msg8755 (view) Author: byorgey Date: 2009-09-08.15:19:23
Sure thing.  It's attached.
Attachments
msg8756 (view) Author: kowey Date: 2009-09-08.15:25:05
On Tue, Sep 08, 2009 at 15:19:25 +0000, Brent Yorgey wrote:
> Sure thing.  It's attached.

Thanks! I notice that there are no mentions of 'darcs' in there
so I assume it's some sort of stock completion tool.

What version of zsh, please?
msg8757 (view) Author: byorgey Date: 2009-09-08.16:02:00
On Tue, Sep 08, 2009 at 03:25:07PM +0000, Eric Kow wrote:
>  
> Thanks! I notice that there are no mentions of 'darcs' in there
> so I assume it's some sort of stock completion tool.

Right, I never put in anything darcs-specific, but whatever completion
machinery darcs provides usually works (e.g. if I do 'darcs push' and
then hit tab, I get a list of repos I've pushed to before, and so on.)

> What version of zsh, please?

I have 4.3.6 on this computer.  On my laptop (which also exhibits the
bug) I have zsh 4.3.10.
msg8758 (view) Author: marnix Date: 2009-09-08.18:57:17
By logging all executions of the darcs binary, I found out that zsh completion
(on my Ubuntu 9.04 system implemented in script
/usr/share/zsh/functions/Completion/Unix/_darcs) does a 'whatsnew -sl .' command
in the not-yet-added Foo/Bar directory, which triggers the bug.  So a simple
reproduction scenario is:

  rm -fr darcstest
  mkdir -p darcstest/Foo/Bar
  cd darcstest
  darcs init
  cd Foo/Bar
  darcs whatsnew -sl .

And also with my current darcs version...

  $ darcs --exact-version
  darcs compiled on Jul 25 2009, at 07:50:22
  
  Context:
  
  [TAG 2.3.0
  Petr Rockai <me@mornfall.net>**20090723115125
   Ignore-this: e326d4ddff92c578e8fe8a3c23d00193
  ] 
  
  $

...this results in the reported error message:

  WARNING: File 'Foo/Bar' not in repository!
  What's new in "Foo/Bar":
  
  darcs: bug at src/Darcs/Commands/WhatsNew.lhs:130 compiled Jul 25 2009 07:50:26
  fromJust error at src/Darcs/Commands/WhatsNew.lhs:130 compiled Jul 25 2009
07:50:26
  See http://wiki.darcs.net/index.html/BugTrackerHowto for help on bug reporting.
msg8759 (view) Author: kowey Date: 2009-09-08.19:12:21
On Tue, Sep 08, 2009 at 18:57:21 +0000, Marnix Klooster wrote:
>   rm -fr darcstest
>   mkdir -p darcstest/Foo/Bar
>   cd darcstest
>   darcs init
>   cd Foo/Bar
>   darcs whatsnew -sl .

Oh so simple!  I feel silly for not trying the obvious thing.

Could I ask you for just a little more?
Could you submit that as a test?
  http://wiki.darcs.net/RegressionTests

I'm surprised that something so straightforward could be tripping
Darcs up since 2.2.1.  It would also be nice if we could have
somebody check to see how far back this bug goes.  Does darcs-1.0.9
misbehave similarly?
msg8779 (view) Author: kowey Date: 2009-09-09.20:07:02
We now have a regression test thanks to Marnix.  

I think the clues (two levels of directories) should be strong enough that it's
fairly straightforward from here to just go trace this down and implement a fix.

At the risk of abusing Target-2.4, I'll bet this is easy enough that we can just
bang it out for the next release.
msg8940 (view) Author: kowey Date: 2009-10-09.16:30:02
This is resolved with the recent hashed-storage work.  The fix should appear in
the upcoming Darcs 2.4.
History
Date User Action Args
2009-07-09 19:58:58byorgeycreate
2009-07-15 16:39:58koweysetstatus: unread -> unknown
nosy: kowey, simon, thorkilnaur, dmitry.kurochkin, byorgey
messages: + msg7968
2009-08-17 06:55:52koweysetstatus: unknown -> waiting-for
nosy: kowey, simon, thorkilnaur, dmitry.kurochkin, byorgey
assignedto: byorgey
messages: + msg8198
title: fromJust error in WhatsNew -> fromJust error in WhatsNew (apply_to_slurpy)
2009-08-25 17:45:56adminsetnosy: + darcs-devel, - simon
2009-08-27 14:25:12adminsetnosy: kowey, darcs-devel, thorkilnaur, dmitry.kurochkin, byorgey
2009-09-05 21:42:38byorgeysetnosy: kowey, darcs-devel, thorkilnaur, dmitry.kurochkin, byorgey
messages: + msg8710
2009-09-06 08:41:21koweysetstatus: waiting-for -> needs-reproduction
nosy: kowey, darcs-devel, thorkilnaur, dmitry.kurochkin, byorgey
messages: + msg8715
assignedto: byorgey -> (no value)
2009-09-06 08:43:41koweysetstatus: needs-reproduction -> waiting-for
nosy: + ertai
messages: + msg8716
assignedto: byorgey
2009-09-06 13:21:38byorgeysetnosy: kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey
messages: + msg8717
2009-09-06 19:30:21koweysetnosy: kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey
messages: + msg8718
2009-09-08 15:19:25byorgeysetfiles: + zshrc
nosy: kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey
messages: + msg8755
2009-09-08 15:25:07koweysetnosy: kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey
messages: + msg8756
2009-09-08 16:02:03byorgey1setnosy: + byorgey1
messages: + msg8757
2009-09-08 18:57:21marnixsetnosy: + marnix
messages: + msg8758
2009-09-08 19:12:23koweysetnosy: marnix, kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey, byorgey1
messages: + msg8759
2009-09-09 20:07:07koweysetstatus: waiting-for -> needs-implementation
nosy: marnix, kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey, byorgey1
topic: + Target-2.4
messages: + msg8779
assignedto: byorgey ->
2009-09-14 10:45:30koweysettopic: + Target-2.5, - Target-2.4
nosy: marnix, kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey, byorgey1
2009-10-09 16:30:05koweysetstatus: needs-implementation -> resolved
nosy: marnix, kowey, darcs-devel, thorkilnaur, ertai, dmitry.kurochkin, byorgey, byorgey1
messages: + msg8940
2009-10-23 22:40:26adminsetnosy: + nicolas.pouillard, - ertai
2009-10-24 00:05:26adminsetnosy: + ertai, - nicolas.pouillard
2009-10-24 00:43:12adminsetnosy: - byorgey1
2010-02-19 10:19:05koweylinkissue1748 superseder
2010-06-15 20:51:46adminsetmilestone: 2.5.0
2010-06-15 20:58:58adminsettopic: - Target-2.5
2010-07-23 18:55:59tux_rockersetresolvedin: 2.4.x