Subject: Re: bug#19610: decoding-error while retrieving brasero build outputs

From: [email-masked] (Ludovic Courtès)
Date: Thu, 15 Jan 2015 23:09:04 +0100

Mark H Weaver <[email-masked]> skribis:

> What do you suppose went wrong here?
>
>   http://hydra.gnu.org/build/201789
>
> It seems to have happened twice in a row.

The bytevector shown in the backtrace looks like this when decoded as
Latin-1:

--8<---------------cut here---------------start------------->8---
=> "(signature \n (data \n  (flags pkcs1)\n  (hash sha256 \")/\xadüA2]Óa[v\\fp\\fº-Úi@©mÝ ÿuzs\\bqÂ4«\")\n  )\n (sig-val \n  (rsa \n   (s #77F22DF7B1A26E6CED24A9FDA493F1A9D11B7225B24465BE8CACDE09844E9090D447B1A767C78DFEC12B2DD253D1E9D92AA8644F68BA2E05ED40FF2132FD22DC23D8E3C62922448A70F71170421389B8C23C9FE080D28C76122A4516ADC7D7A159898BBC3AF4048FC5E929AEEC9C379E0B5CC7CAB74F454845A5C1065BACA952AFC61FDA873732E1DD0877F923419A1CC4FCE568E204F4CE9ACB3C77C3F5E4C829BCC6F52EEE21D6ED2543C08DC26EC6ADA3D17DEA5EB7456BA0F087094039E9656A9238D7E9755D1DC61BCA6BF1050F6BBF8F7F7DD7A6CDC7EA28F877782C355C3B692B250BE72FF2C8078D9783532242D71A8E79E6081B91586F47C8A4C36D1337BA2C065F3335C3ACD2FA86D64C637113A82FBA25E765B4D8D5D3F9D453AA879182510E42491D7507EB2384FA750809FBE2B1E3D9B6FE2AF6EDBF64F724DEE8BA54A7B52C46EBB6D438E3AC643D28CA9801927473B79A5A19BA88958D56FDE6CC7C9FCED091A2226285176DCF9DB2563D830D96EE2037014390397C8DEEA79E5A597D475F1FE161648C87AA1FA15AEDFBB7EF05D980526CA6E2CFC83E45D30BF8FBD2DFF3254920C690DF6B48DF2235A1910C062D9CA5BC38BB3D0AB4BE2D970B79B84A17CD737BF49163979EF18EC3891078A679ECC4E62FB193D987B9097E68801F7CBAD135A9923BA4942A986699506B0E576A4A09E1EC35E2FF3B49AA#)\n   )\n  )\n (public-key \n  (rsa \n   (n #00CD70EC7B7625F18D752CFB598B9EAE34253CBC413EB580A2E722174C271B1DE0E5EF154335F2D61050E33A1729333C8EB82EB27752557146CC4B503BFF5D8FF12F7A5A4646C213EFBF490D910F65250F367C66074E2F93DAB38E0A314B01A4270BEE0B58A2244B10E2D87E58FF8BA0F88A04535D6E1E7CF56BAF252D3A72E6C3631DB77AD3ECFF46B5A6BA483D58400175F0388A4BDB1FB5B760C3BC4ABB95F618465F15A4964F30FA728244EA64CAF0BC7CA2AD3E24769EDC4653A1AACA7A69F6FA93D2A2B99ADB47578D3CD3AC2B89C55AA3D62C87E2E3907141C846F015C5408782241B717D59DF41BF4E4A47504432DC2E6FB99B2EF295920657ECED7DE43714D615C8D46F8DCC41ACB7B07DAAC8E4072B3B28CD52EFFBCE06D71DDADA76EC24CCBBAD72C757AA7FA73136773D468D2DCF34CEE5801AE6AED746CC00040DF94D4CCD67261904F78AFC1BC52AD3B834AACD7FBC8EBCC0ADB4266D6BD22FC3FAFC99B8BD8CCCA6C299A46E9BE41951587D3FA5E6A49B5146CE99FDF730A2DA432A52BF06AD17A7D7A79D658DC06BE91F2B50AC010225BACA6ED2BE8C8458D4E99050564438EAC3E703272EEE290CE465F3874C0E375D0BF2A1FD422657A5D5E009BF4878F5D4AFDFB6086918646233B15052B5791F0C8C8CB857A3308D50E22781DDC38A89C8618043C8E4A21C7EBF5DFD7B8110CEB40CDC6FE5BA9ABC03C5#)\n   (e #010001#)\n   )\n  )\n )\n"
--8<---------------cut here---------------end--------------->8---

Similar to what commit 6030d8493 did, the fix is this:

diff --git a/guix/nar.scm b/guix/nar.scm
index bab727e..43e5210 100644
--- a/guix/nar.scm
+++ b/guix/nar.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <[email-masked]>
+;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <[email-masked]>
 ;;; Copyright © 2014 Mark H Weaver <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -211,7 +211,9 @@ s-expression"))
                 (_ "importing file or directory '~a'...~%")
                 file)
 
-        (let ((sig (and has-sig? (read-string port))))
+        ;; The signature may contain characters that are meant to be
+        ;; interpreted as bytes in a 'char *', so read them as a ISO-8859-1.
+        (let ((sig (and has-sig? (read-latin1-string port))))
           (when verify-signature?
             (if sig
                 (begin

However, I tested it live, and it aborts like this (this is with Guile
2.0.11.109-e1d29 on x86_64-linux-gnu):

--8<---------------cut here---------------start------------->8---
retrieving 1 files from 'wildebeest.jxself.org'...
importing file or directory '/gnu/store/prrwzx5v33miiz5fh8653m1izl5f8d4k-brasero-3.8.0'...

;;; (sigport #f #<input: r6rs-custom-binary-input-port 1eee0d0>)
guile: ../../libguile/ports.c:2527: scm_i_port_iconv_descriptors: Assertion `pti->encoding_mode == SCM_PORT_ENCODING_MODE_ICONV' failed.
builder for `/gnu/store/izjx4wllhcy66nsn9pxbkghaq2cy06qv-brasero-3.8.0.drv' failed due to signal 6 (Aborted)
@ hook-failed /gnu/store/izjx4wllhcy66nsn9pxbkghaq2cy06qv-brasero-3.8.0.drv - 6 builder for `/gnu/store/izjx4wllhcy66nsn9pxbkghaq2cy06qv-brasero-3.8.0.drv' failed due to signal 6 (Aborted)
guix build: error: build failed: build of `/gnu/store/izjx4wllhcy66nsn9pxbkghaq2cy06qv-brasero-3.8.0.drv' failed
--8<---------------cut here---------------end--------------->8---

(The ‘sigport’ pk shows the port encoding, in nar.scm.)

This sounds like a memory corruption, as you noted on IRC.

To be continued...

Ludo’.