[darcs-users] vc-darcs.el and the length of hashes (cons: Args out of range)
Hello! As a darcs user from time to time (and sympathizer), I have recently started to use vc-darcs.el in Emacs. (I know there are other darcs libraries for Emacs, but I'm interested in the Emacs VC interface, too, because I'm accustomed to using it in certain situations.) I want to share some observations about a discovered bug in one of the implementations of vc-darcs (which I'm left with as the only one, because the other link is dead). Perhaps, this will help make it better. I'm not sure about where this inconsistency comes from. Perhaps, an older version of darcs had a different interface w.r.t. the ids of patches. Understanding this would make it clearer how to proceed with a possible fix (keep both variants or not, check versions,...). Do you have any suggestions? Best regards, Ivan -- Forwarded message -- Date: Tue, 8 Dec 2015 13:18:54 +0300 From: Ivan ZakharyaschevTo: jch@ Subject: vc-darcs: cons: Args out of range Hello! I've just installed your vc-darcs.el from your repo. (BTW, the second implementation mentioned at http://darcs.net/RelatedSoftware/Emacs and http://www.emacswiki.org/emacs/DaRcs -- http://www.loveshack.ukfsn.org/emacs/vc-darcs.el -- is not available because the site doesn't open.) When I call C-x v l in a file under darcs control, I get the error message: cons: Args out of range: "6119dca7cd08261f99cecc2643451601ad6d", 0, 61 I'm using: $ darcs --version 2.10.0 (release) Best regarads, -- Ivan -- Forwarded message -- Date: Tue, 8 Dec 2015 13:20:41 +0300 From: Ivan Zakharyaschev To: jch@ Subject: Re: vc-darcs: cons: Args out of range $ emacs --version GNU Emacs 24.3.1 Copyright (C) 2013 Free Software Foundation, Inc. -- Forwarded message -- Date: Wed, 9 Dec 2015 02:34:42 +0300 From: Ivan Zakharyaschev To: Juliusz Chroboczek Subject: Re: vc-darcs: cons: Args out of range 2015-12-08 18:20 UTC+03:00, Juliusz Chroboczek : Could you please say M-: (setq debug-on-error t) RET and send me a backtrace? Sure. I'm attaching it. -- Forwarded message -- Date: Wed, 9 Dec 2015 03:37:02 +0300 From: Ivan Zakharyaschev To: Juliusz Chroboczek Subject: Re: vc-darcs: cons: Args out of range So, the patch hash is SHA1 -- http://darcs.net/Internals/NamedPatch (via http://darcs.net/Internals/Hashes ). SHA1 is 40 hexadecimal digits long -- https://en.wikipedia.org/wiki/SHA-1 . And vc-darcs.el tries to get 62 symbols of `h' in `vc-darcs-changes'... So, is `h' the hash?.. (let ((h (cdr (assoc 'hash (cadr e) (when h (push (substring h 0 61) l)) Probably, yes. So, something is wrong (40 vs 62)... -- IvanDebugger entered--Lisp error: (args-out-of-range "fa1eff0e1163fc2c716cccb2f4ab9bffe21597c1" 0 61) substring("fa1eff0e1163fc2c716cccb2f4ab9bffe21597c1" 0 61) (cons (substring h 0 61) l) (setq l (cons (substring h 0 61) l)) (progn (setq l (cons (substring h 0 61) l))) (if h (progn (setq l (cons (substring h 0 61) l (let ((h (cdr (assoc (quote hash) (cadr e) (if h (progn (setq l (cons (substring h 0 61) l) (progn (let ((h (cdr (assoc (quote hash) (cadr e) (if h (progn (setq l (cons (substring h 0 61) l)) (if (and (consp e) (eq (car e) (quote patch))) (progn (let ((h (cdr (assoc (quote hash) (cadr e) (if h (progn (setq l (cons (substring h 0 61) l))) (let ((e (car (prog1 ch (setq ch (cdr ch)) (if (and (consp e) (eq (car e) (quote patch))) (progn (let ((h (cdr (assoc ... ... (if h (progn (setq l (cons ... l (while (not (null ch)) (let ((e (car (prog1 ch (setq ch (cdr ch)) (if (and (consp e) (eq (car e) (quote patch))) (progn (let ((h (cdr ...))) (if h (progn (setq l ... (let ((ch (cddr (car changes))) (l (quote nil))) (while (not (null ch)) (let ((e (car (prog1 ch (setq ch ...) (if (and (consp e) (eq (car e) (quote patch))) (progn (let ((h ...)) (if h (progn ...))) (nreverse l)) (let ((changes (xml-parse-region 1 (point-max (if (and (null (cdr changes)) (eq (quote changelog) (car (car changes nil (error "Unexpected output from darcs changes --xml.")) (let ((ch (cddr (car changes))) (l (quote nil))) (while (not (null ch)) (let ((e (car (prog1 ch ... (if (and (consp e) (eq (car e) (quote patch))) (progn (let (...) (if h ...)) (nreverse l))) (progn (apply (function vc-do-command) t 0 vc-darcs-program-name files "changes" "--xml" flags) (let ((changes (xml-parse-region 1 (point-max (if (and (null (cdr changes)) (eq (quote changelog) (car (car changes nil (error "Unexpected output from darcs changes --xml.")) (let ((ch (cddr (car changes))) (l (quote nil))) (while (not (null ch)) (let ((e (car ...))) (if (and (consp e) (eq ... ...)) (progn (let ... ...) (nreverse l (unwind-protect (progn (apply (function vc-do-command) t 0
Re: [darcs-users] vc-darcs.el records changes without the fullname unlike darcs itself (with a PATCH)
On Tue, 15 Dec 2015, Ivan Zakharyaschev wrote: Another problem I've noticed with the vc-darcs.el from jch@ is that it doesn't use the author's fullname when recording changes. This has been discovered thanks to a warning by "darcs amend". Let's have a look how the code of vc-darcs.el could be fixed. (I'll post if I come up with something.) I've pushed my fix to http://hub.darcs.net/imz/vc-darcs_jch . (Before that I had to convert to darcs-2 to be able to push to hub.darcs.net, so that might be considered a temporary darcs-2 repo to publish the fixes until Juliusz converts his one.) Hence, the suggested fix: diff -rN -u old-vc-darcs/vc-darcs.el new-vc-darcs/vc-darcs.el --- old-vc-darcs/vc-darcs.el2015-12-15 07:47:00.563953863 +0300 +++ new-vc-darcs/vc-darcs.el2015-12-15 07:47:00.563953863 +0300 @@ -97,12 +97,13 @@ : group 'vc-darcs) (defcustom vc-darcs-mail-address - (or (getenv "DARCS_EMAIL") - (getenv "EMAIL") - (if (string-match "<" user-mail-address) - user-mail-address - (format "%s <%s>" - (user-full-name) user-mail-address))) + (let ((addr (or (getenv "DARCS_EMAIL") + (getenv "EMAIL") + user-mail-address))) +(if (string-match "<" addr) + addr + (format "%s <%s>" + (user-full-name) addr))) "*The email address to use in darcs." : type '(choice string (const nil)) : group 'vc-darcs) Best regards, Ivan ___ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users
Re: [darcs-users] vc-darcs.el and the length of hashes (cons: Args out of range)
On Tue, 15 Dec 2015, Ivan Zakharyaschev wrote: I'm not sure about where this inconsistency comes from. Perhaps, an older version of darcs had a different interface w.r.t. the ids of patches. Understanding this would make it clearer how to proceed with a possible fix (keep both variants or not, check versions,...). Do you have any suggestions? A stupid fix which works for the newer darcs has been pushed to http://hub.darcs.net/imz/vc-darcs_jch/patch/2744a57b44e61a4ab186fe38d8d4645b467ce4e2 . SHA1 is 40 hexadecimal digits long -- https://en.wikipedia.org/wiki/SHA-1 . And vc-darcs.el tries to get 62 symbols of `h' in `vc-darcs-changes'... So, is `h' the hash?.. (let ((h (cdr (assoc 'hash (cadr e) (when h (push (substring h 0 61) l)) Probably, yes. So, something is wrong (40 vs 62)... -- Ivan ___ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users
[darcs-users] vc-darcs.el and the length of hashes (cons: Args out of range)
Ivan Zakharyaschev writes: > http://www.loveshack.ukfsn.org/emacs/vc-darcs.el -- is not available > because the site doesn't open.) That would be Dave Love's site, a long-time Emacs and Darcs contributor who stopped posting to Emacs channels about a decade ago, and I haven't seen him around Darcs channels for a handful of years, too. Googling for "Dave Love" and/or "loveshack and not B52s" ;-) might come up with an existing site. (Didn't see any on the first page with just "loveshack" and need to get back to $DAYJOB, sorry I can't be of more help.) Steve ___ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users
Re: [darcs-users] repository state identifier(s) in "darcs show repo"
More info about the different hashes that Darcs uses: http://darcs.net/Internals/Hashes The XOR I propose is on hash #1. ___ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users
[darcs-users] repository state identifier(s) in "darcs show repo"
Hi everyone, As said by David Leuschner in a previous mail, one of the shortcomings of Darcs is: "it's not as easy to refer to a specific state of the repository using a hash". As a developer I know that Darcs uses (internally) the pristine hash, which is a hash of the recorded working copy. However two repositories can have the same pristine hash and different histories (eg, one being a superset of the other with patches and their corresponding rollbacks, or one having tags that the other lacks). But it can be good enough for some purposes (lazy cloning). Should "darcs show repo" show that hash? Now most importantly, we need a hash that would identify a set of patches independently of reordering, since it's what Darcs considers the history of a repository. Doing it right, eg building and hashing the dependency graph of all patches, is costly. Moreover we do not have any infrastructure to retrieve a set of patches from such hash. (That's the scenario in http://darcs.net/Ideas/ShortSecureId ). So can we just have one that would enable us to quickly check that two repos have the same patches, ignoring reordering? I propose a simple checksum: XOR all patch metadata hashes! Probability of collision should be low enough since patch metadata hashes are good hashes. Calculating the XOR is as fast as reading the inventories of the current repo (which can be lazy) plus the overhead of generating and XOR'ing the hashes. Darcs itself would not need to store this XOR, it seems. But there could be many uses of it by third-party tools, on the other hand. Darcsden could show it for comparison purposes. A development team could maintain a XOR-to-patchset map to identify repository states encountered by its members. Let the tools emerge later! So, should "darcs show repo" show that XOR? Opinions? Guillaume ___ darcs-users mailing list darcs-users@darcs.net http://lists.osuosl.org/mailman/listinfo/darcs-users