GNU bug report logs - #20428
git-fetch does not always validate hash

Previous Next

Package: guix;

Reported by: Ricardo Wurmus <rekado <at> elephly.net>

Date: Sun, 26 Apr 2015 13:14:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

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 20428 in the body.
You can then email your comments to 20428 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 bug-guix <at> gnu.org:
bug#20428; Package guix. (Sun, 26 Apr 2015 13:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ricardo Wurmus <rekado <at> elephly.net>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 26 Apr 2015 13:14:02 GMT) Full text and rfc822 format available.

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

From: Ricardo Wurmus <rekado <at> elephly.net>
To: bug-guix <at> gnu.org
Subject: git-fetch does not always validate hash
Date: Sun, 26 Apr 2015 15:13:16 +0200
I'm currently playing with the elogind package recipe and I'm
occasionally updating my clone of the elogind git repository.  Whenever
I do I update the value of "commit" in the package definition:

    (define-public elogind
      (let ((commit "18ee7abc9a"))
        (package
          (name "elogind")
          (version (string-append "219." commit))
          (source (origin
                    (method git-fetch)
                    (uri (git-reference
                          (url "http://git.elephly.net/software/elogind.git")
                          (commit commit)))
                    (sha256
                     (base32
                      "0lg8jgp9rl3wf9w2xfip87nx9zpjhm4js7x1z05744xiyfmvawp5"))))
          ;; ...
          (license license:lgpl2.1+))))

Upon rebuilding the package from a new commit I would expect the build
to fail with a hash validation error as I have not updated the hash yet.
However, the build procedure just continues.  I noticed that the git
checkout is still the very same as before I updated the value of
"commit".  I cannot seem to reliably force a new git checkout.





Reply sent to ludo <at> gnu.org (Ludovic Courtès):
You have taken responsibility. (Fri, 01 May 2015 20:22:02 GMT) Full text and rfc822 format available.

Notification sent to Ricardo Wurmus <rekado <at> elephly.net>:
bug acknowledged by developer. (Fri, 01 May 2015 20:22:03 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: Ricardo Wurmus <rekado <at> elephly.net>
Cc: 20428-done <at> debbugs.gnu.org
Subject: Re: bug#20428: git-fetch does not always validate hash
Date: Fri, 01 May 2015 22:21:52 +0200
Ricardo Wurmus <rekado <at> elephly.net> skribis:

> Upon rebuilding the package from a new commit I would expect the build
> to fail with a hash validation error as I have not updated the hash yet.
> However, the build procedure just continues.  I noticed that the git
> checkout is still the very same as before I updated the value of
> "commit".  I cannot seem to reliably force a new git checkout.

Indeed, origins compile to fixed-output derivations, meaning that these
are special derivations whose output is known in advance (rather, the
SHA256 is the output is known in advance.)  Thus, it doesn’t matter how
the derivation produces its result as long as its output has the correct
hash.

When you leave the ‘sha256’ unchanged, the daemon notices that there’s
already an item with this name and hash in the store, so it does
nothing.

This is expected behavior, though I understand this can be error-prone
here.

To avoid that, you could add a ‘file-name’ field to the origin that
includes the commit:

  (file-name (string-append name "-checkout-" commit))

Thus, if you change the commit without changing the hash, the daemon
will still want to build the origin (because of the changed name) and
will eventually complain about the hash mismatch.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 30 May 2015 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 81 days ago.

Previous Next


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