all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Marius Bakke <marius@gnu.org>
Cc: 50696@debbugs.gnu.org
Subject: bug#50696: [core-updates-frozen] Wrong output hashes computed since cb06f7c61e4b839
Date: Mon, 20 Sep 2021 23:38:14 +0200	[thread overview]
Message-ID: <87wnnbnd15.fsf@gnu.org> (raw)
In-Reply-To: <87a6k78u4z.fsf@gnu.org> (Marius Bakke's message of "Mon, 20 Sep 2021 11:37:48 +0200")

Hi Marius,

Marius Bakke <marius@gnu.org> skribis:

> On the 'core-updates-frozen' branch, attempting to pull 'master' gives a
> backtrace along the lines of ...
>
> Computing Guix derivation for 'x86_64-linux'... |Backtrace:

[...]

>   1. &store-protocol-error:
>       message: "derivation `/gnu/store/szv5fh043rrqq01xpycp7xci4y7myqfk-guile-3.0.7.tar.xz.drv' has incorrect output `/gnu/store/qwjhql8lqw40fqhaqw40jwqs0hc0248w-guile-3.0.7.tar.xz', should be `/gnu/store/0zliqv8lcw13f9iasy14kmwsqj3d309w-guile-3.0.7.tar.xz'"
>       status: 1
>
> I bisected it down to cb06f7c61e4b:
>
> commit cb06f7c61e4b8393abf38f1f5891e03c33d53b9b
> Author: Ludovic Courtès <ludo@gnu.org>
> Date:   Thu Sep 9 23:22:10 2021 +0200
>
>     base32: Provide an open-coded 'bit-field'.
>
>     This improves the throughput of 'bytevector->base32-string' a bit.
>
>     * guix/base32.scm (bit-field): New macro.

The problem is that at -O1 with Guile 3.0.7 (which is the default for
imported modules on ‘core-updates-frozen’ since
331a09654eb7e9f6212b7e8469077fa7393e8b11), that code gets miscompiled:

--8<---------------cut here---------------start------------->8---
$ rm guix/base32.go
$ guild compile -O1 guix/base32.scm -o guix/base32.go
wrote `guix/base32.go'
$ ./pre-inst-env guile
GNU Guile 3.0.7
Copyright (C) 1995-2021 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> ,use(guix base32)
scheme@(guile-user)> (nix-base32-string->bytevector "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6")
$1 = #vu8(230 180 126 128 240 207 124 168 250 212 169 244 186 92 228 202 232 206 240 60 140 248 170 168 200 83 184 90 164 64 13 112)
scheme@(guile-user)> (bytevector->nix-base32-string $1)
$2 = "000d0080l00k00h0l00c0h00w00a0hq0lh090hl0hh0g0000wh06"
--8<---------------cut here---------------end--------------->8---

Long story short: the “baseline compiler” (-O0 and -O1) would
erroneously translate (ash x N) to (ash x (- N)) when N is a literal:

--8<---------------cut here---------------start------------->8---
scheme@(guix base32)> (compile '(lambda (x) (ash x -2)) #:to 'value #:env (current-module) #:optimization-level 1)
$46 = #<procedure 36aeed8 (x)>
scheme@(guix base32)> (compile '(lambda (x) (ash x -2)) #:to 'value #:env (current-module) #:optimization-level 2)
$47 = #<procedure 2e4d7a8 (x)>
scheme@(guix base32)> ($47 4)
$48 = 1
scheme@(guix base32)> ($46 4)
$49 = 16
--8<---------------cut here---------------end--------------->8---

Fixed upstream:

  https://git.savannah.gnu.org/cgit/guile.git/commit/?id=74abae04aa68dc18676bd84c4a73324b0613475d

However I’m not sure how to work around the bug, other than by reverting
the change.  I’ll think a bit more about it.

Thanks,
Ludo’.




  reply	other threads:[~2021-09-20 22:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20  9:37 bug#50696: [core-updates-frozen] Wrong output hashes computed since cb06f7c61e4b839 Marius Bakke
2021-09-20 21:38 ` Ludovic Courtès [this message]
2021-09-21  8:15   ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnnbnd15.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=50696@debbugs.gnu.org \
    --cc=marius@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 external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.