From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47597) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVKZW-0004KD-1M for guix-patches@gnu.org; Wed, 12 Jul 2017 12:33:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVKZS-000250-OJ for guix-patches@gnu.org; Wed, 12 Jul 2017 12:33:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:32974) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVKZS-00024q-Kz for guix-patches@gnu.org; Wed, 12 Jul 2017 12:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dVKZS-0000A5-G0 for guix-patches@gnu.org; Wed, 12 Jul 2017 12:33:02 -0400 Subject: [bug#27654] [PATCH] base: Report evaluation error. Resent-Message-ID: References: <20170711171615.3992-1-m.othacehe@gmail.com> <87lgntetr1.fsf@gnu.org> From: Mathieu Othacehe In-reply-to: <87lgntetr1.fsf@gnu.org> Date: Wed, 12 Jul 2017 18:32:37 +0200 Message-ID: <868tjtmx96.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 27654@debbugs.gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi Ludo, > While we’re at it, let’s avoid ‘error’ altogether (‘error’ raises a > ‘misc-error’ exception, which is not very helpful.) Ok, would the attached patch be ok ? Thanks, Mathieu --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-base-Report-evaluation-error.patch >From c9a3325c1c021564edc689ff2421b04c9e794052 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 11 Jul 2017 19:15:08 +0200 Subject: [PATCH] base: Report evaluation error. * src/cuirass/base.scm (evaluate): Report an error if eof-object? is true on data read from port. Otherwise, suppose that data are correct and keep thins going. --- src/cuirass/base.scm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm index 326a530..3506916 100644 --- a/src/cuirass/base.scm +++ b/src/cuirass/base.scm @@ -32,6 +32,7 @@ #:use-module (ice-9 receive) #:use-module (srfi srfi-19) #:use-module (srfi srfi-34) + #:use-module (srfi srfi-35) #:export (;; Procedures. call-with-time-display fetch-repository @@ -137,6 +138,10 @@ directory and the sha1 of the top level commit in this directory." (system* "./configure" "--localstatedir=/var")) (zero? (system* "make" "-j" (number->string (current-processor-count)))))) +(define-condition-type &evaluation-error &error + evaluation-error? + (name evaluation-error-spec-name)) + (define (evaluate store db spec) "Evaluate and build package derivations. Return a list of jobs." (let* ((port (open-pipe* OPEN_READ @@ -148,7 +153,15 @@ directory and the sha1 of the top level commit in this directory." (%package-cachedir) (object->string spec) (%package-database))) - (jobs (read port))) + (jobs (match (read port) + ;; If an error occured during evaluation report it, + ;; otherwise, suppose that data read from port are + ;; correct and keep things going. + ((? eof-object?) + (raise (condition + (&evaluation-error + (name (assq-ref spec #:name)))))) + (data data)))) (close-pipe port) jobs)) -- 2.13.2 --=-=-=--