From: Ricardo Wurmus <rekado@elephly.net>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 28094@debbugs.gnu.org
Subject: bug#28094: cuirass doesn’t build i686 things
Date: Sat, 26 Aug 2017 08:48:00 +0200 [thread overview]
Message-ID: <87bmn2vn8f.fsf@elephly.net> (raw)
In-Reply-To: <87fucfdz3v.fsf@gnu.org>
Hi Ludo,
[…]
>> /gnu/store/60671wa0i1fljll26fx7lxfl27fb27si-curl-7.55.0-doc /gnu/store/nmfwf4fkvb4mfyi7m5sn1daklkjsz9mn-curl-7.55.0
>> /gnu/store/53vb094sihb819hk124qvfjq8vz78252-curl-7.53.0-doc /gnu/store/9ihxpf7al0znb19lx0bk6ymjp6nxhn9y-curl-7.53.0
>> Database error with INSERT INTO Builds (derivation, evaluation, log, output) VALUES ('~A', '~A', '~A', '~A'); and (/gnu/store/zg0zpndricjwwbjv5087zw9hmdcd708y-curl-7.55.0.drv 3 #f /gnu/store/60671wa0i1fljll26fx7lxfl27fb27si-curl-7.55.0-doc)
[…]
>> In cuirass/database.scm:
>> 192:2 0 (db-add-build #<<sqlite-db> pointer: #<pointer 0x24cde…> …)
>> cuirass/database.scm:192:2: In procedure db-add-build:
>> cuirass/database.scm:192:2: Throw to key `sqlite-error' with args `(#f 1555 "UNIQUE constraint failed: Builds.derivation, Builds.evaluation, Builds.output")'.
[…]
> This is the tail of the Builds table on that machine:
>
> --8<---------------cut here---------------start------------->8---
> /gnu/store/jcdfzvb3ca4n5jzh7ajc3yb47akg30c4-hplip-3.17.7.drv|4|#f|/gnu/store/1bil0xyhpim3cfyaifdpb2jsjdni2hif-hplip-3.17.7
> /gnu/store/lndp48wl3jcqjysjdrxgh0nm5cghc38v-cups-filters-1.13.1.drv|4|#f|/gnu/store/lvfymniwbz33an5a2hakf4b1c57lrdwr-cups-filters-1.13.1
> /gnu/store/9zzp62b9l2b85dbdqiq17avbqw3h0xkz-cups-2.2.1.drv|4|#f|/gnu/store/a403mrmm7jd2vxygfjszrsycpa75w6cy-cups-2.2.1
> /gnu/store/2isifzc6i42bxpb5rwm3wq2qvpyw158g-cups-minimal-2.2.1.drv|4|#f|/gnu/store/n7mf8hk262rnlhrjqmacnkp1yn518ks4-cups-minimal-2.2.1
> /gnu/store/5aysbn4y15hzjyj6ixw16rl223c8bv12-curl-7.53.0.drv|4|#f|/gnu/store/53vb094sihb819hk124qvfjq8vz78252-curl-7.53.0-doc
> /gnu/store/5aysbn4y15hzjyj6ixw16rl223c8bv12-curl-7.53.0.drv|4|#f|/gnu/store/9ihxpf7al0znb19lx0bk6ymjp6nxhn9y-curl-7.53.0
> /gnu/store/zg0zpndricjwwbjv5087zw9hmdcd708y-curl-7.55.0.drv|4|#f|/gnu/store/60671wa0i1fljll26fx7lxfl27fb27si-curl-7.55.0-doc
> /gnu/store/zg0zpndricjwwbjv5087zw9hmdcd708y-curl-7.55.0.drv|4|#f|/gnu/store/nmfwf4fkvb4mfyi7m5sn1daklkjsz9mn-curl-7.55.0
> --8<---------------cut here---------------end--------------->8---
>
> So the problem is that we’re trying to insert one of these again, which
> fails because we already have it under this primary key.
>
> This is because the curl-7.55.0 package ends up twice in the list of
> jobs: once as a replacement for curl-7.53.0, and once because the
> curl-7.55.0 is itself a public variable.
>
> Commit 7d4d6c13f46f2a307883226789d6aa503e2d7081 in guix-maintenance.git
> works around that.
Thank you!
> The proper fix in Cuirass might be to ignore the primary key error (for
> future reference, 1555 in the ‘sqlite-error’ exception above is
> (logior 19 (ash 6 8)), which is SQLITE_CONSTRAINT_PRIMARYKEY in
> <sqlite3.h>), as in the attached patch. Thoughts? I’ll push it if
> there are no objections.
This looks good to me.
> diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
> index 91133c2..9c7e69a 100644
> --- a/src/cuirass/database.scm
> +++ b/src/cuirass/database.scm
> @@ -181,15 +181,30 @@ string."
> ((char=? char #\') (loop (cons* char char chars)))
> (else (loop (cons char chars)))))))
>
> +;; Extended error codes (see <sqlite3.h>).
> +;; XXX: This should be defined by (sqlite3).
> +(define SQLITE_CONSTRAINT 19)
> +(define SQLITE_CONSTRAINT_PRIMARYKEY
> + (logior SQLITE_CONSTRAINT (ash 6 8)))
> +
> (define (db-add-build db build)
> - "Store BUILD in database DB."
> - (sqlite-exec db "\
> + "Store BUILD in database DB. This is idempotent."
> + (catch 'sqlite-error
> + (lambda ()
> + (sqlite-exec db "\
> INSERT INTO Builds (derivation, evaluation, log, output)\
> VALUES ('~A', '~A', '~A', '~A');"
> - (assq-ref build #:derivation)
> - (assq-ref build #:eval-id)
> - (assq-ref build #:log)
> - (assq-ref build #:output))
> + (assq-ref build #:derivation)
> + (assq-ref build #:eval-id)
> + (assq-ref build #:log)
> + (assq-ref build #:output)))
> + (lambda (key who code . rest)
> + ;; If we get a primary-key-constraint-violated error, that means we have
> + ;; already inserted the same (derivation,eval-id,log) tuple, which we
> + ;; can safely ignore.
> + (unless (= code SQLITE_CONSTRAINT_PRIMARYKEY)
> + (apply throw key who code rest))))
> +
Unfortunately, re-throwing the error doesn’t print any meaningful error
message. To get the error message that I showed above I caught any
sqlite errors and re-threw the exception only after printing the
arguments to sqlite-exec:
(format (current-error-port) "Database error with ~a and ~a~%" msg args)
I think it would be good to include a line like this right after
“(unless (= code SQLITE_CONSTRAINT_PRIMARYKEY)”.
Thank you for debugging this!
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
next prev parent reply other threads:[~2017-08-26 6:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-15 7:43 bug#28094: cuirass doesn’t build i686 things Ricardo Wurmus
2017-08-16 7:32 ` Ricardo Wurmus
2017-08-23 16:58 ` Ricardo Wurmus
2017-08-24 7:21 ` Ricardo Wurmus
2017-08-25 23:08 ` Ludovic Courtès
2017-08-26 6:48 ` Ricardo Wurmus [this message]
2017-08-26 8:51 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmn2vn8f.fsf@elephly.net \
--to=rekado@elephly.net \
--cc=28094@debbugs.gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).