darcs

Issue 2377 darcs amend crashes in src/Darcs/Repository/PatchIndex.hs:246

Title darcs amend crashes in src/Darcs/Repository/PatchIndex.hs:246
Priority Status resolved
Milestone Resolved in 2.10.0
Superseder Nosy List bfrk, ganesh
Assigned To
Topics

Created on 2014-04-12.19:50:56 by bfrk, last changed 2015-06-20.12:42:40 by bfrk.

Files
File name Uploaded Type Edit Remove
darcsbug.txt bfrk, 2014-04-12.19:50:54 text/plain
nix-support.tar.gz bfrk, 2014-04-12.19:52:53 application/gzip
Messages
msg17336 (view) Author: bfrk Date: 2014-04-12.19:50:54
1. Summarise the issue (what were doing, what went wrong?)

I did 'darcs amend', selected a patch, added some stuff. Darcs said:

darcs failed:  bug at src/Darcs/Repository/PatchIndex.hs:246 compiled
Apr  4 2014 21:10:43

I attached the complete shell session in darcsbug.txt, including the
output of darcs --exact-version and uname -a.
Attachments
msg17337 (view) Author: bfrk Date: 2014-04-12.19:52:53
I attached a tar ball of the repo, taken directly after the failed amend.
Attachments
msg17338 (view) Author: bfrk Date: 2014-04-12.19:57:57
It seems that despite the crash the amend completed successfully:

ben@sarun[1]: .../Epics/nix-support > darcs changes
Sat Apr 12 21:38:50 CEST 2014  Ben Franksen
<benjamin.franksen@helmholtz-berlin.de>
  * added setup.sh, replaces /etc/profile.d stuff
Shall I view this patch? (1/?) [yN...], or ? for more options: x
    Sat Apr 12 21:38:50 CEST 2014  Ben Franksen
<benjamin.franksen@helmholtz-berlin.de>
      * added setup.sh, replaces /etc/profile.d stuff
    
        A ./setup.sh
Shall I view this patch? (1/?) [yN...], or ? for more options: q
msg17339 (view) Author: bfrk Date: 2014-04-12.20:10:28
I guess this will be hard to debug since the original patch I amended is
now lost. I can try to explain what the situation was IIRC:

I changed scripts/setup.sh, then (darcs move)-d it to ., then recorded.
Then I removed scripts (with a few remaining files) and recorded that.
Then I changed setup.sh again and amend the first of the two patches and
that is where the crash happened.
msg17340 (view) Author: bfrk Date: 2014-04-12.20:17:39
The repo is now broken. I tried to record some more stuff and got the
same error:

ben@sarun[1]: .../Epics/nix-support > darcs record pkgs/config.nix 
Recording changes in "pkgs/config.nix":

hunk ./pkgs/config.nix 6
-    epics_base = callPackage epics/base/full.nix { version =
"3.14.12.4"; };
-
-    epics_base_3_14_12_3 = callPackage epics/base/full.nix { version =
"3.14.12.3"; };
-
-#    epics_catools = callPackage epics/base/catools.nix {};
-#     epics_base = callPackage epics/base { base = epics_base; };
-#    sequencer = callPackage epics/seq { version = "2.1.16"; base =
epics_base; };
-
-    seq = {hash}: callPackage epics/local.nix {
-      name = "seq";
-      version = "2.1.16";
-      repo = "epics/support/seq/branch-2-1";
-      deps = { EPICS_BASE = epics_base; };
-      extraInputs = [ re2c ];
-      inherit hash;
-    };
-
-#     epics_env = myEnvFun {
-#       name = "epics-devel";
-#       shell = "zsh -l";
-#       extraCmds = ''
-#         export EPICS_HOST_ARCH=linux-x86_64
-#         export PERL5LIB=.nix-profile/lib/perl:$PERL5LIB
-#       '';
-#       buildInputs = [ stdenv perl readline re2c epics_base sequencer ];
-#     };
+    nix-make = callPackage epics/build-support/nix-make {};
Shall I record this change? (1/1)  [ynW...], or ? for more options: y
Do you want to record these changes? [Yglqk...], or ? for more options: y
What is the patch name? removed everything except fetchdarcs and
nix-make from config.nix 
Do you want to add a long comment? [yn]n

darcs failed:  bug at src/Darcs/Repository/PatchIndex.hs:246 compiled
Apr 12 2014 22:01:47
couldn't find ./scripts in patch index
See http://wiki.darcs.net/BugTracker/Reporting for help on bug reporting.
Failed to record patch 'removed everything except fetchdarcs and
nix-make from config.nix'

BTW, darcs is lying: it did record the new patch:

ben@sarun[1]: .../Epics/nix-support > darcs changes
Sat Apr 12 22:14:21 CEST 2014  Ben Franksen
<benjamin.franksen@helmholtz-berlin.de>
  * removed everything except fetchdarcs and nix-make from config.nix
Shall I view this patch? (1/?) [yN...], or ? for more options: q
msg17342 (view) Author: bfrk Date: 2014-04-12.22:59:07
I don't get the error with darcs-2.8.4.
msg17343 (view) Author: bfrk Date: 2014-04-12.23:13:39
I verified my suspicion that the error lies in the patches by Jose Luis
Neder that implement detection of replaces and moves and that need the
unreleased hashed-storage version that is currently bundled with the
darcs sources. When I obliterate these patches:

ben@sarun[1]: .../darcs/screened > darcs pull --dry-run   
Would pull from "http://darcs.net/screened"...
Welcome to the darcs screened repository.

If you would like to contribute, please read our guide for contributors:
http://wiki.darcs.net/Development/GettingStarted

Thanks and happy hacking!
**********************
Would pull the following changes:
Fri Jan 10 00:00:42 CET 2014  Jose Luis Neder <jlneder@gmail.com>
  * Show fileid info with show index
  Update timestamp index with new adds and moves in pending
  (darcs mv, darcs add)
  Require hashed-storage 0.5.11

Mon Sep 16 01:41:26 CEST 2013  Jose Luis Neder <jlneder@gmail.com>
  * resolve issue642: Automatic detection of file renames

Fri Jan 10 05:20:13 CET 2014  Jose Luis Neder <jlneder@gmail.com>
  * resolve issue2209: Automatically detect replace
  This patch add the flag --look-for-replaces to amend-record, record and
  whatsnew commands, to automatically detect possible replaces.

Fri Feb  7 20:29:23 CET 2014  Ganesh Sittampalam <ganesh@earth.li>
  * we need utf8-string on Windows too now for the fast-export/import code

Fri Feb  7 11:59:11 CET 2014  Dan Frumin <difrumin@gmail.com>
  * Cleaning up the headers in WhatsNew and SelectChanges
  

Fri Feb  7 12:00:51 CET 2014  Dan Frumin <difrumin@gmail.com>
  * resolve issue851: interactive mode for whatsnew

Sun Mar 16 15:47:49 CET 2014  Ganesh Sittampalam <ganesh@earth.li>
  * conditionally use local copy of Data.Map.Strict in Darcs.Repository.Util
  This is needed for building with containers<0.5, e.g. on Debian stable

Tue Apr  8 18:45:28 CEST 2014  Ale Gadea <alex.aegf@gmail.com>
  * Resolve Issue1416: put log files in tempdir instead of in working dir.
    
  The temporary files are found in _darcs.
  For the commands amend-record, record and tag, the temp file is
patch_description.txt
  and is persistent, ie always have the last message whether failed or
not the command.
  For send, we use two files, darcs-send for the editing and
darcs-send.final for the 
  backup. If all is ok, the files are removed.


and then remove the bundled hashed-storage from my cabal sandbox, and
then fix one line in the code:

ben@sarun[1]: .../darcs/screened > darcs record 
hunk ./src/Darcs/UI/Commands/Record.hs 280
-                 when (isJust logf) $ removeFile (fromJust logf)
+                 case logf of Nothing -> return (); Just f -> removeFile f
Shall I record this change? (1/1)  [ynW...], or ? for more options: y
Do you want to record these changes? [Yglqk...], or ? for more options: y
What is the patch name? fixed missing import of fromJust by not using it
(better style)

then I get a working version that does not choke on my repository.

I suggest that these patches (and/or the bundled hashed-storage version)
need serious review and fixing!
msg17344 (view) Author: bfrk Date: 2014-04-12.23:33:51
I don't know what made me think the error is gone. It is still there.

I am sorry. The patches I accused are probably innocent.

Now I am at a loss. I think I will have to temporarily revert to using
2.8.4 for my daily work until this is fixed. Too bad, I have been
growing very fond of some of the new features lately...
msg17345 (view) Author: ganesh Date: 2014-04-13.09:29:45
Just to clarify - are you able to reproduce it now? If so and if you could 
encode that in a shell script it would be very helpful.
msg17346 (view) Author: bfrk Date: 2014-04-13.11:51:38
I tried to reproduce it with a small toy example but failed so far.
Fortunately the repo I attached to the issue is small and has only a few
patches in it. You should be able to reproduce the bug by unpacking it,
and saying 'darcs changes scripts'.
msg17350 (view) Author: bfrk Date: 2014-04-13.12:20:37
See also issue2378
msg18562 (view) Author: bfrk Date: 2015-06-20.12:42:38
It seem this has been fixed somehow in the meantime because I can no
longer reproduce it with the attached repo.
History
Date User Action Args
2014-04-12 19:50:56bfrkcreate
2014-04-12 19:52:54bfrksetfiles: + nix-support.tar.gz
messages: + msg17337
2014-04-12 19:57:58bfrksetmessages: + msg17338
2014-04-12 20:10:30bfrksetmessages: + msg17339
2014-04-12 20:17:40bfrksetmessages: + msg17340
2014-04-12 22:59:08bfrksetmessages: + msg17342
2014-04-12 23:13:40bfrksetmessages: + msg17343
2014-04-12 23:33:52bfrksetmessages: + msg17344
2014-04-13 09:29:46ganeshsetnosy: + ganesh
messages: + msg17345
2014-04-13 11:51:39bfrksetmessages: + msg17346
2014-04-13 12:20:38bfrksetmessages: + msg17350
2015-06-20 12:42:40bfrksetstatus: unknown -> resolved
messages: + msg18562
resolvedin: 2.10.0