GNU bug report logs - #27654
[PATCH] base: Report evaluation error.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Tue, 11 Jul 2017 17:19:02 UTC

Severity: normal

Tags: patch

Done: Mathieu Othacehe <m.othacehe <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 27654 in the body.
You can then email your comments to 27654 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#27654; Package guix-patches. (Tue, 11 Jul 2017 17:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Tue, 11 Jul 2017 17:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Mathieu Othacehe <m.othacehe <at> gmail.com>
Subject: [PATCH] base: Report evaluation error.
Date: Tue, 11 Jul 2017 19:16:15 +0200
* src/cuirass/base.scm (evaluate): Report an error in eof-object? is true on
  data read from port. Otherwise, suppose that data are correct and keep thins
  going.
---
 src/cuirass/base.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index f5f80b3..5e0cb0d 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -136,7 +136,13 @@ 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?)
+                  (error "Could not evaluate specifications.\n"))
+                 (data data))))
     (close-pipe port)
     jobs))
 
-- 
2.13.1





Information forwarded to guix-patches <at> gnu.org:
bug#27654; Package guix-patches. (Wed, 12 Jul 2017 12:16:02 GMT) Full text and rfc822 format available.

Message #8 received at 27654 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 27654 <at> debbugs.gnu.org
Subject: Re: [bug#27654] [PATCH] base: Report evaluation error.
Date: Wed, 12 Jul 2017 14:15:30 +0200
Howdy!

Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> * src/cuirass/base.scm (evaluate): Report an error in eof-object? is true on
>   data read from port. Otherwise, suppose that data are correct and keep thins
>   going.
> ---
>  src/cuirass/base.scm | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
> index f5f80b3..5e0cb0d 100644
> --- a/src/cuirass/base.scm
> +++ b/src/cuirass/base.scm
> @@ -136,7 +136,13 @@ 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?)
> +                  (error "Could not evaluate specifications.\n"))
> +                 (data data))))

While we’re at it, let’s avoid ‘error’ altogether (‘error’ raises a
‘misc-error’ exception, which is not very helpful.)

What about declaring a specific SRFI-35 error condition type for
evaluation errors, and then raising it (with SRFI-34) here?  (If you’re
not familiar with SRFI-3[45], there are examples of it in the (guix *)
modules.)

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#27654; Package guix-patches. (Wed, 12 Jul 2017 16:33:02 GMT) Full text and rfc822 format available.

Message #11 received at 27654 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 27654 <at> debbugs.gnu.org
Subject: Re: [bug#27654] [PATCH] base: Report evaluation error.
Date: Wed, 12 Jul 2017 18:32:37 +0200
[Message part 1 (text/plain, inline)]
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
[0001-base-Report-evaluation-error.patch (text/x-diff, inline)]
From c9a3325c1c021564edc689ff2421b04c9e794052 Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <m.othacehe <at> gmail.com>
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


Information forwarded to guix-patches <at> gnu.org:
bug#27654; Package guix-patches. (Wed, 12 Jul 2017 20:55:01 GMT) Full text and rfc822 format available.

Message #14 received at 27654 <at> debbugs.gnu.org (full text, mbox):

From: ludo <at> gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe <at> gmail.com>
Cc: 27654 <at> debbugs.gnu.org
Subject: Re: [bug#27654] [PATCH] base: Report evaluation error.
Date: Wed, 12 Jul 2017 22:54:05 +0200
[Message part 1 (text/plain, inline)]
Mathieu Othacehe <m.othacehe <at> gmail.com> skribis:

> From c9a3325c1c021564edc689ff2421b04c9e794052 Mon Sep 17 00:00:00 2001
> From: Mathieu Othacehe <m.othacehe <at> gmail.com>
> 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.

Please mention the new ‘&evaluation-error’ in here.

BTW, shouldn’t ‘process-specs’ protect against it, so that Cuirass
doesn’t stop as soon as it encounters an evaluation error?  Like:

[Message part 2 (text/x-patch, inline)]
diff --git a/src/cuirass/base.scm b/src/cuirass/base.scm
index fc3cc1a..3d19bda 100644
--- a/src/cuirass/base.scm
+++ b/src/cuirass/base.scm
@@ -185,9 +185,12 @@ if required.  Return the last commit ID on success, #f otherwise."
                                #:use-substitutes? (%use-substitutes?)
                                #:keep-going? #t)
 
+            (guard (c ((evaluation-error? c)
+                       ;; Report the problem in the log...
+                       #f))
               (let* ((spec* (acons #:current-commit commit spec))
                      (jobs  (evaluate store db spec*)))
-              (build-packages store db jobs))))
+                (build-packages store db jobs)))))
         (db-add-stamp db spec commit))))
 
   (for-each process jobspecs))
[Message part 3 (text/plain, inline)]
OK with something along these lines, thanks!

Ludo’.

Reply sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
You have taken responsibility. (Sun, 30 Jul 2017 10:48:02 GMT) Full text and rfc822 format available.

Notification sent to Mathieu Othacehe <m.othacehe <at> gmail.com>:
bug acknowledged by developer. (Sun, 30 Jul 2017 10:48:02 GMT) Full text and rfc822 format available.

Message #19 received at 27654-done <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 27654-done <at> debbugs.gnu.org
Subject: Re: [bug#27654] [PATCH] base: Report evaluation error.
Date: Sun, 30 Jul 2017 12:47:05 +0200
Hi Ludo,

> OK with something along these lines, thanks!

Done and pushed, thanks !

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 27 Aug 2017 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.