First, the meat:
Now, the potatoes:
The following vpatch modifies my original V implementation as follows:
Over 5x speedup of press operations:
; compiling file "/home/b/common-lisp/veh/veh.lisp" (written 27 DEC 2016 11:47:45 PM): ; /home/b/common-lisp/veh/veh.fasl written ; compilation finished in 0:00:00.076 VEH> (time (press :press-root "/home/b/src/tmsr/trb" :target-dir "scratch" :head "makefiles.vpatch")) No signatures found for patch mod6_privkey_tools_wBeginHeight.vpatch Evaluation took: 15.533 seconds of real time 4.467000 seconds of total run time (0.175000 user, 4.292000 system) [ Run times consist of 0.014 seconds GC time, and 4.453 seconds non-GC time. ] 28.76% CPU 22 lambdas converted 51,647,726,990 processor cycles 2 page faults 14,880,672 bytes consed #<SB-IMPL::PROCESS :EXITED 0> ; compiling file "/home/b/common-lisp/veh/veh.lisp" (written 27 DEC 2016 11:48:55 PM): ; /home/b/common-lisp/veh/veh.fasl written ; compilation finished in 0:00:00.091 VEH> (time (press :press-root "/home/b/src/tmsr/trb" :target-dir "scratch" :head "makefiles.vpatch")) Evaluation took: 2.413 seconds of real time 0.874000 seconds of total run time (0.153000 user, 0.721000 system) 36.22% CPU 32,620 forms interpreted 22 lambdas converted 8,021,794,410 processor cycles 21,115,072 bytes consed T
Achieved by filtering the list of signatures to consider when verifying a vpatch down to those whose filenames contain the filename of the vpatch in question.
Compares hashes after applying every patch.
Originally, I intended to use the Common Lisp Ironclad library for hashing files, but ran into the following crazy:
b@hnm ~/src/tmsr/trb $ sha512sum /home/b/src/tmsr/trb/scratch/bitcoin/src/bitcoinrpc.cpp a1812ac4e4425986e8574ebf837c6b1a84e4772e01b46e4e1caef098496226f7321a3fabc5249b55ce6365863f2c25fef0005f4bcde7188603b0805c77256bc0 /home/b/src/tmsr/trb/scratch/bitcoin/src/bitcoinrpc.cpp b@hnm ~/src/tmsr/trb $ sha512sum /home/b/src/tmsr/trb/scratch/bitcoin/src/test/util_tests.cpp 1360397ac0c494d5003656deb41494de4480c56bbe46254a09f193682a9e7813fe133a45c93699835e6de89951c350ad2a7e59bcf8b1307a7670cc1db5f22e24 /home/b/src/tmsr/trb/scratch/bitcoin/src/test/util_tests.cpp --- VEH> (byte-array-to-hex-string (digest-file :sha512 #p "/home/b/src/tmsr/trb/scratch/bitcoin/src/bitcoinrpc.cpp")) "a1812ac4e4425986e8574ebf837c6b1a84e4772e01b46e4e1caef098496226f7321a3fabc5249b55ce6365863f2c25fef0005f4bcde7188603b0805c77256bc0" VEH> (byte-array-to-hex-string (digest-file :sha512 #p "/home/b/src/tmsr/trb/scratch/bitcoin/src/test/util_tests.cpp")) "174fbbb374a2052d62922dc1f48748f1b4693c40ce7bda05e5d9022bf0618f717caf5a173023d3fbd0ac5a52f9effc64116fac1310d546dd68d3f073e6b08e20"
That's right, the Ironclad I had on disk hashed *some* files correctly, and *other* files incorrectly. The ever-attentive phf pointed out that this had been fixed within the past 2 years. I thought for a bit and solicited input from the forum on hashulator tradeoffs, electing to fall back to the Drepperific `sha512sum' until such a time as I either pillage SHA-512 from Ironclad or reimplement it myself.
Anyways, this modification checks file hashes for every file touched in every patch, after every patch.
Error handling for external programs
You'll note that I wrap `sb-ext:run-program' with some lightweight error handling. It quite simply checks the process exit code, and signals an `external-program-error' condition if the external program didn't exit with a 0. You can see in `verify' where I handle the `external-program-error' condition, inspect the program's stderr for a magic string ("BAD signature"), and then either signal a more specific condition (`bad-signature-error') or allow the previously-signaled condition to bubble through. Tidy little use of the CL condition handling system.
As a part of this, I also tidied up the semantics around running external programs in veh. This was necessary to pass in stdin arguments (for patch), and to remove a few ugly `(apply #' run ...)' stanzas.
- excised a few comments
- `press' exit value is now either T or a condition, if signaled (and not the return value of `rm')
I intend to put V down for a while, barring patches to address outright showstoppers that need fixing. Publishing vpatches frequently isn't necessarily A Good Thing, tickles the programmer's desire to feel relevant and as though he's contributing when it's more likely he's just shuffling deck chairs around; much fun can be had sailing with a steady wind abeam and a glass of rosé in hand.