From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark H Weaver Subject: Re: Fixed output derivation hash mismatch - why? Date: Thu, 12 Apr 2018 04:31:14 -0400 Message-ID: <87po344yi5.fsf@netris.org> References: <87tvsgev2z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54274) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6XeQ-0003YV-RI for guix-devel@gnu.org; Thu, 12 Apr 2018 04:32:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6XeM-0007yy-Pg for guix-devel@gnu.org; Thu, 12 Apr 2018 04:32:14 -0400 Received: from world.peace.net ([50.252.239.5]:51736) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f6XeM-0007yS-Kt for guix-devel@gnu.org; Thu, 12 Apr 2018 04:32:10 -0400 In-Reply-To: <87tvsgev2z.fsf@gmail.com> (Chris Marusich's message of "Thu, 12 Apr 2018 00:35:00 -0700") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Chris Marusich Cc: guix-devel@gnu.org Hi Chris, Chris Marusich writes: > I'm trying to define a fixed output derivation using gexp->derivation, > but I'm getting a hash mismatch, and I can't figure out why. I've > attached a minimal script that illustrates the problem. When I run it, > I see the following output: > > $ /tmp/test-fixed-output-derivation.scm=20 > ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=3D0 > ;;; or pass the --no-auto-compile argument to disable. > ;;; compiling /tmp/test-fixed-output-derivation.scm > ;;; compiled /home/marusich/.cache/guile/ccache/2.2-LE-8-3.A/tmp/test-fix= ed-output-derivation.scm.go > The following derivation will be built: > /gnu/store/fiiz8cxz90q7l0c6jfdrpzkanyyvhpv8-test.drv > building path(s) `/gnu/store/8s4m28x6qmpkqhqasy59lw3hih548kxv-test' > `/gnu/store/kfzwabhn37bg692ayb2czb853drlv2gp-test' -> `/gnu/store/8s4m28x= 6qmpkqhqasy59lw3hih548kxv-test' > sha256 hash mismatch for output path `/gnu/store/8s4m28x6qmpkqhqasy59lw3h= ih548kxv-test' > expected: 0dids4n73p8w77pn9nffs7x0ww1a3f1jbic1p642hwd0jfl3zcg9 > actual: 1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq > Backtrace: > 8 (apply-smob/1 #) > In ice-9/boot-9.scm: > 705:2 7 (call-with-prompt _ _ #) > In ice-9/eval.scm: > 619:8 6 (_ #(#(#))) > In ice-9/boot-9.scm: > 2312:4 5 (save-module-excursion _) > 3822:12 4 (_) > In /tmp/test-fixed-output-derivation.scm: > 30:2 3 (_) > In guix/store.scm: > 1443:24 2 (run-with-store _ _ #:guile-for-build _ #:system _ # _) > 1362:38 1 (_ #) > 936:15 0 (_ # _ _) > > guix/store.scm:936:15: Throw to key `srfi-34' with args `(#)'. > > I don't understand why the Guix daemon thinks that the output > (/gnu/store/8s4m28x6qmpkqhqasy59lw3hih548kxv-test) hashes to > 0dids4n73p8w77pn9nffs7x0ww1a3f1jbic1p642hwd0jfl3zcg9. It doesn't. When the daemon writes: expected: 0dids4n73p8w77pn9nffs7x0ww1a3f1jbic1p642hwd0jfl3zcg9 actual: 1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq that means that the output hashes to 1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq, but you told it to expect 0dids4n73p8w77pn9nffs7x0ww1a3f1jbic1p642hwd0jfl3zcg9. > That doesn't even > match what "guix hash" says: > > $ guix hash /gnu/store/8s4m28x6qmpkqhqasy59lw3hih548kxv-test > 1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq Yes it does. This matches what the daemon wrote was the "actual" hash. > Note that the result of "guix hash" above DOES match the hash value for > /tmp/test: > > $ guix hash /tmp/test > 1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq It matches both of them. > What's going on here? I think the problem is here: (define hash (sha256 (base32 "1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq"))) Remove the 'sha256'. It should just be this: (define hash (base32 "1r3v22qkypccqifzbww5lrn6hf1chi23m6zzkyvb8bvg457nxslq")) Within 'origin' records, the 'sha256' is the field name, part of the constructor syntax. Here, you are not within an 'origin' constructor, and the 'sha256' is instead a procedure which computes the sha256 hash of its argument. Mark