From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Mysterious error while refactoring guix/scripts/system.scm Date: Wed, 10 Aug 2016 00:23:29 -0700 Message-ID: <8737md3x5a.fsf@gmail.com> References: <87wpjxhx7z.fsf@gmail.com> <87poppq85f.fsf@igalia.com> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46917) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXNrZ-0000Il-BI for guix-devel@gnu.org; Wed, 10 Aug 2016 03:23:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXNrX-0006lj-6b for guix-devel@gnu.org; Wed, 10 Aug 2016 03:23:40 -0400 Received: from mail-pa0-x229.google.com ([2607:f8b0:400e:c03::229]:36168) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXNrW-0006ld-R1 for guix-devel@gnu.org; Wed, 10 Aug 2016 03:23:39 -0400 Received: by mail-pa0-x229.google.com with SMTP id pp5so13224528pac.3 for ; Wed, 10 Aug 2016 00:23:38 -0700 (PDT) In-Reply-To: <87poppq85f.fsf@igalia.com> (Andy Wingo's message of "Thu, 04 Aug 2016 09:56:44 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Andy Wingo Cc: guix-devel@gnu.org --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Andy, Thank you for the help! Sorry for the late reply; I wasn't able to respond until just now. > Here the #:system system was taking the `system' binding from within the > function -- it was lexically bound. You're right; that was the problem. I've updated the patch (see attached) and applied it again to 7972d8a2e98af6592050a37036c2c80a01358fcf, but when I built the new version and ran './pre-inst-env guix system list-generations', the following new error occurred (after successfully printing the list of generations): =2D-8<---------------cut here---------------start------------->8--- Generation 1 Jul 29 2016 08:26:37 file name: /var/guix/profiles/system-1-link canonical file name: /gnu/store/90xaq1d04g39c1wmxplngh3hhc1h5z7g-system label: GNU with Linux-Libre 4.7 (beta) root device: /dev/sda1 kernel: /gnu/store/p7wbfpbs8p8ykdrn1440f95ap9iq1czh-linux-libre-4.7 Generation 2 Aug 03 2016 07:35:00 file name: /var/guix/profiles/system-2-link canonical file name: /gnu/store/6il3znhh2cyp3xw0800x6m3yjq8jq5z9-system label: GNU with Linux-Libre 4.7 (beta) root device: my-root kernel: /gnu/store/p7wbfpbs8p8ykdrn1440f95ap9iq1czh-linux-libre-4.7 Generation 3 Aug 03 2016 07:38:12 file name: /var/guix/profiles/system-3-link canonical file name: /gnu/store/74d698pk4dwv4k4bvf2n4b7j4bg0gbq0-system label: GNU with Linux-Libre 4.7 (beta) root device: #vu8(18 55 238 217 114 62 64 185 130 140 206 84 109 78 188 2= 17) kernel: /gnu/store/p7wbfpbs8p8ykdrn1440f95ap9iq1czh-linux-libre-4.7 Generation 4 Aug 03 2016 07:55:20 (current) file name: /var/guix/profiles/system-4-link canonical file name: /gnu/store/01fd40gf19syn493y2f6h35cb58kqmg4-system label: GNU with Linux-Libre 4.7 (beta) root device: #vu8(18 55 238 217 114 62 64 185 130 140 206 84 109 78 188 2= 17) kernel: /gnu/store/p7wbfpbs8p8ykdrn1440f95ap9iq1czh-linux-libre-4.7 Backtrace: In ice-9/boot-9.scm: 157: 15 [catch #t # ...] In unknown file: ?: 14 [apply-smob/1 #] In ice-9/boot-9.scm: 63: 13 [call-with-prompt prompt0 ...] In ice-9/eval.scm: 432: 12 [eval # #] In ice-9/boot-9.scm: 2401: 11 [save-module-excursion #] 4050: 10 [#] 1724: 9 [%start-stack load-stack ...] 1729: 8 [#] In unknown file: ?: 7 [primitive-load "/root/guix/scripts/guix"] In guix/ui.scm: 1209: 6 [run-guix-command system "list-generations"] In ice-9/boot-9.scm: 157: 5 [catch srfi-34 # ...] 157: 4 [catch system-error ...] In guix/scripts/system.scm: 884: 3 [#] 818: 2 [process-command list-generations () ...] In guix/store.scm: 1182: 1 [run-with-store # ...] In unknown file: ?: 0 [# #] ERROR: In procedure #: ERROR: Wrong type to apply: # =2D-8<---------------cut here---------------end--------------->8--- I'm hoping you can help me (1) understand this particular problem, and (2) help me learn to become more self-sufficient at troubleshooting these kinds of issues going forward. I don't want to have to bother you or the mailing list every time I encounter a stack trace. Regarding (1), I'm having trouble understanding this particular stack trace. Where did the error occur? What caused it? I'm used to stack traces in Java and Python, where often the exact line which threw an exception is usually obvious in the stack trace. I'm finding Guile's stack traces more difficult to understand. Maybe I'm just not used to them yet. Regarding (2), I've read some of the manual at '(guile) Debugging' (mainly '(guile) Evaluation Model' and '(guile) Programmatic Error Handling'), and although it's great and detailed, it isn't obvious to me how to apply that knowledge in practice. For example, I'm not even sure how to find out what the parts and symbols in the above stack trace mean. How can I get better at this? Should I just read the rest of '(guile) Debugging' in detail, and experiment with my own toy programs until it makes more sense? Or is there a common tool people use for debugging that I'm not aware of, like how pdb is a common debugging tool for Python programs? Again, thank you for your help. I really appreciate it! =2D-=20 Chris --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Refactor-process-action-and-process-command.patch Content-Transfer-Encoding: quoted-printable From=20a3e094e5393ac7289075a0b63696bd9e5024b202 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Wed, 3 Aug 2016 00:39:39 -0700 Subject: [PATCH] Refactor process-action and process-command =2D-- guix/scripts/system.scm | 74 ++++++++++++++++++++++++---------------------= ---- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 209ebf9..731e3cd 100644 =2D-- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -774,7 +774,6 @@ resulting from command-line parsing." (let* ((file (match args (() #f) ((x . _) x))) =2D (system (assoc-ref opts 'system)) (os (if file (load* file %user-module #:on-error (assoc-ref opts 'on-error)) @@ -789,47 +788,46 @@ resulting from command-line parsing." (grub-configuration-device (operating-system-bootloader os))))) =20 =2D (with-store store =2D (set-build-options-from-command-line store opts) =2D =2D (run-with-store store =2D (mbegin %store-monad =2D (set-guile-for-build (default-guile)) =2D (case action =2D ((extension-graph) =2D (export-extension-graph os (current-output-port))) =2D ((shepherd-graph) =2D (export-shepherd-graph os (current-output-port))) =2D (else =2D (perform-action action os =2D #:dry-run? dry? =2D #:derivations-only? (assoc-ref opts =2D 'derivations= -only?) =2D #:use-substitutes? (assoc-ref opts 'substit= utes?) =2D #:image-size (assoc-ref opts 'image-size) =2D #:full-boot? (assoc-ref opts 'full-boot?) =2D #:mappings (filter-map (match-lambda =2D (('file-system-map= ping . m) =2D m) =2D (_ #f)) =2D opts) =2D #:grub? grub? =2D #:target target #:device device)))) =2D #:system system)))) + (case action + ((extension-graph) + (export-extension-graph os (current-output-port))) + ((shepherd-graph) + (export-shepherd-graph os (current-output-port))) + (else + (perform-action action os + #:dry-run? dry? + #:derivations-only? (assoc-ref opts + 'derivations-only?) + #:use-substitutes? (assoc-ref opts 'substitutes?) + #:image-size (assoc-ref opts 'image-size) + #:full-boot? (assoc-ref opts 'full-boot?) + #:mappings (filter-map (match-lambda + (('file-system-mapping . m) + m) + (_ #f)) + opts) + #:grub? grub? + #:target target #:device device))))) =20 (define (process-command command args opts) "Process COMMAND, one of the 'guix system' sub-commands. ARGS is its argument list and OPTS is the option alist." =2D (case command =2D ((list-generations) =2D ;; List generations. No need to connect to the daemon, etc. =2D (let ((pattern (match args =2D (() "") =2D ((pattern) pattern) =2D (x (leave (_ "wrong number of arguments~%")))))) =2D (list-generations pattern))) =2D (else =2D (process-action command args opts)))) + (with-store store + (set-build-options-from-command-line store opts) + + (run-with-store store + (mbegin %store-monad + (set-guile-for-build (default-guile)) + (case command + ((list-generations) + (let ((pattern (match args + (() "") + ((pattern) pattern) + (x (leave (_ "wrong number of arguments~%"))))= )) + (list-generations pattern))) + (else + (process-action command args opts)))) + #:system (assoc-ref opts 'system)))) =20 (define (guix-system . args) (define (parse-sub-command arg result) =2D-=20 2.7.3 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXqtZzAAoJEN1AmhXYIkadYs4P/AsbXvRvLze46sFNv6u1+ECA vjJE276rxaM95J4UrF5h2sAMqj1Kz8T+Jg++JrYdbEAJ/Chu8OJ2X8qmeJir18Fy 50q6qqB0tMypdU1G+gRhCqTlShGxZ2jhlOlb7u25exe2bOw5ZRR3r+KbavHgswvR szuPRJIn6f6A1SAAfBBEZ16Mm3CBWEG6Ql527SCdQcbXTmgy9Bf7yjkP4/jfLz6N 6r83afOj/0FmUejlVH5d++kkQPIFY09Ejd+YDVLM695fZ4B+wB+Q+fnsmbwruImR jjZQMz8IaN0NxbhiRiA9KN/hp5FjrngfaSK+VJoo+MR4KpN1RIyR9Wn/hAllliHJ KiXSHf0H7xPYKy3qTHp7VJZw33i5g+OXavvthiJLZzYdJgsA5g2Gz4oPIGtWWG5Q mMwB2YEeD9GDIAOrtfearJ3DfyfxTcuYVbVXwSp0ZTsRc7OuiZqslCgsAtFQREFa NTKtypyibcqgP/AzBwsUjzOhTJRF/scykVBHDbwU5HnOqJx5lpDUFjJVVkM97pNh uVa1/lQIoeaO/RJqAl0hjVTWQxI6n6qzbjizGo+uVbK0RiX25dtu5wsdzS7/7Ugf bWvo6WAwgiGf9HAyLbnYfmmP+O+G72WGdQfGjN+cNrDtEkLADGVp6Kzb/3HkOhiK vavnEZI3/ZEnzJKHXfn6 =mFOO -----END PGP SIGNATURE----- --==-=-=--