From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: bug#32050: invoke (guix build utils) error reporting lacking Date: Wed, 04 Jul 2018 13:45:32 -0400 Message-ID: <87efginbcz.fsf@netris.org> References: <87fu0zkvv9.fsf@apteryx.i-did-not-set--mail-host-address--so-tickle-me> <878t6rkuuf.fsf_-_@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60429) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1falrt-00005u-9X for bug-guix@gnu.org; Wed, 04 Jul 2018 13:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1falrq-0004DQ-6e for bug-guix@gnu.org; Wed, 04 Jul 2018 13:47:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:39047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1falrq-0004DI-2d for bug-guix@gnu.org; Wed, 04 Jul 2018 13:47:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1falrp-0005Ve-RW for bug-guix@gnu.org; Wed, 04 Jul 2018 13:47:01 -0400 Sender: "Debbugs-submit" Resent-Message-ID: In-Reply-To: <878t6rkuuf.fsf_-_@gmail.com> (Maxim Cournoyer's message of "Wed, 04 Jul 2018 09:12:56 -0400") List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: Maxim Cournoyer Cc: 32050@debbugs.gnu.org Hi Maxim, Maxim Cournoyer writes: > More problematic even, it seems "invoke" can't do everything that > "system*" can? > > For example, the following package builds fine: > > (define-public docbook-dsssl-doc > (package > (name "docbook-dsssl-doc") > (version "1.79") > (source (origin > (method url-fetch) > (uri (string-append "mirror://sourceforge/docbook/" > name "/" version "/" > name "-" version ".tar.bz2")) > (sha256 > (base32 > "1plp5ngc96pbna4rwglp9glcadnirbm3hlcjb4gjvq1f8biic9lz")))) > (build-system trivial-build-system) > (arguments > `(#:modules ((guix build utils)) > #:builder > (begin > (use-modules (guix build utils)) > (let ((source (assoc-ref %build-inputs "source")) > (out (assoc-ref %outputs "out"))) > (mkdir-p out) > ;; Extract the "doc" subdirectory. > (system* "tar" "xf" source "--strip-components=1" > "--no-same-owner" "-C" out > (string-append "docbook-dsssl-" ,version "/doc")))))) > (native-inputs > `(("bzip2", bzip2) > ("tar" ,tar))) > (home-page "https://docbook.org/") > (synopsis "DocBook DSSSL style sheets documentation") > (description "Documentation for the DocBook DSSSL style sheets.") > (license non-copyleft))) > > > ,run-in-store (build-package docbook-dsssl-doc #:use-substitutes? #t #:dry-run? #f) > /gnu/store/ljr8xn3qbr3lahr29zc0lbki9x33zls6-docbook-dsssl-doc-1.79 > $4 = #t Did you check to see if the extraction actually succeeded? In this case, I don't see how it could have. When using 'tar' from within 'trivial-build-system', you need to add 'bzip2' to PATH, or else 'tar' will fail because it can't find 'bzip2'. There are many examples of setting PATH in (gnu packages fonts). Because of the way you are using 'system*' here without the usual 'zero?' wrapped around it, the numeric result code is returned as the result of the builder, and all numbers (even 0) are considered true in Scheme. So, this build will always succeed, ignoring errors from 'tar'. > But changing just "system*" to "invoke", I get: > > @ build-remote /gnu/store/fdcg5nazw2jvpb7k4mq7q0750gq22zh7-docbook-dsssl-doc-1.79.drv 192.168.1.105 > Backtrace: > 2 (primitive-load "/gnu/store/06zszks9mwp52gih8j0mj5bahfi?") > In ice-9/eval.scm: > 191:35 1 (_ #f) > In /gnu/store/xlj36j9dw581iah51iyjgi75iikrj55h-module-import/guix/build/utils.scm: > 616:6 0 (invoke _ . _) > > /gnu/store/xlj36j9dw581iah51iyjgi75iikrj55h-module-import/guix/build/utils.scm:616:6: In procedure invoke: > Throw to key `srfi-34' with args `(#)'. > builder for `/gnu/store/fdcg5nazw2jvpb7k4mq7q0750gq22zh7-docbook-dsssl-doc-1.79.drv' failed with exit code 1 > derivation '/gnu/store/fdcg5nazw2jvpb7k4mq7q0750gq22zh7-docbook-dsssl-doc-1.79.drv' offloaded to '192.168.1.105' failed: build of `/gnu/store/fdcg5nazw2jvpb7k4mq7q0750gq22zh7-docbook-dsssl-doc-1.79.drv' failed > While executing meta-command: > Throw to key `srfi-34' with args `(#)'. Changing 'system*' to 'invoke' allowed you to see that something went wrong. > The error reported by `invoke' isn't accurate, and mutes important > output from the program invoked. > > Example of a failed tar extraction: > > /gnu/store/xlj36j9dw581iah51iyjgi75iikrj55h-module-import/guix/build/utils.scm:616:6: In procedure invoke: > Throw to key `srfi-34' with args `(#)'. > > > While reproducing the same error in an containerized environment, > calling the command directly yields: > > tar xf yanfzfi7rdyf5scf5h65xbkn7xg0nnbn-docbook-dsssl-doc-1.79.tar.bz2 --strip-components=1 -C $PWD docbook-dssl-1.79/doc > tar: docbook-dssl-1.79/doc: Not found in archive > tar: Exiting with failure status due to previous errors > maxim@apteryx /tmp/docbook-dsssl-doc [env]# echo $? > 2 > > Two observations: > > 1. invoke's reported exit status was wrong (127 rather than 2) > 2. The useful error message "docbook-dssl-1.79/doc: Not found in > archive" was masked. I think what happened is that 'tar' actually failed in two different ways. In the first case, where the result code was 127, it failed because 'bzip2' was not found in PATH. In the second case, it failed because "docbook-dssl-1.79/doc" was not found in the archive. Or at least that's my guess. Regards, Mark