all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Mark H Weaver <mhw@netris.org>
To: Leo Famulari <leo@famulari.name>
Cc: guix-devel@gnu.org
Subject: Re: Grafting fails for latest Go release candidate
Date: Mon, 31 Jul 2017 12:22:23 -0400	[thread overview]
Message-ID: <87d18gzidc.fsf@netris.org> (raw)
In-Reply-To: <20170731143925.GA19814@jasmine.lan> (Leo Famulari's message of "Mon, 31 Jul 2017 10:39:25 -0400")

[Adding Ludovic to the CC]

Leo Famulari <leo@famulari.name> writes:

> Working on the Go package, I found that the grafting procedure fails in
> a way that I don't understand:
>
> ------
> $ ./pre-inst-env guix build go@1.9
> The following derivation will be built:
>    /gnu/store/bv30jxzjl7c5z3hk6pmywpzwwrn1hq5m-go-1.9rc1.drv
> @ build-started
> /gnu/store/bv30jxzjl7c5z3hk6pmywpzwwrn1hq5m-go-1.9rc1.drv -
> x86_64-linux
> /var/log/guix/drvs/bv//30jxzjl7c5z3hk6pmywpzwwrn1hq5m-go-1.9rc1.drv.bz2
> grafting '/gnu/store/8zbi5rr5q2pxksfgpxq37m60nsa21d3v-go-1.9rc1-doc' -> '/gnu/store/6v24sf0b3hgyc80b4w2yvx1aw03zinw6-go-1.9rc1-doc'...
> grafting '/gnu/store/73fvsx0qizcrbajgjwn8mkzkpxa6abx4-go-1.9rc1' -> '/gnu/store/ghg75mjw3csiv9hf7q0cxrm1g0fx5d0k-go-1.9rc1'...
> ERROR: In procedure put-bytevector: Value out of range: 0

I looked into this a bit.  As far as I can tell, the only way that (guix
build graft) could cause 'put-bytevector' to generate this error is if
it's called with four arguments, and the fourth argument (count) is 0,
and the third argument (start) is greater than the length of the
bytevector.

I don't have time right now to complete my analysis, but my strong
suspicion is that the following commit introduced this bug:

  https://git.savannah.gnu.org/cgit/guix.git/commit/?id=57bdd79e485801ccf405ca7389bd099809fe5d67

Specifically, I believe that it mishandles the case where the
end-of-buffer falls within the human-readable part of the store file
name, i.e. if it's within the "eeeeeeeeeeeeeeee" part of the following
example hash:

  /gnu/store/bv30jxzjl7c5z3hk6pmywpzwwrn1hq5m-eeeeeeeeeeeeeeee

The original grafting code that I wrote only rewrote the hashes, and
ensured that the entire hash was present within the buffer.  This
guaranteed that after writing the replacement hash, that the scan
position was still within the buffer.

After the modifications of the commit cited above, when a hash to be
replaced is found, the entire replacement string, including the
human-readable part, is written.  This may leave the scan pointer beyond
the end of the buffer.  It would take some more thought to determine
what happens after that, but I doubt that it's handled properly and it
seems plausible that it could lead to this error.

       Mark

  parent reply	other threads:[~2017-07-31 16:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-31 14:39 Grafting fails for latest Go release candidate Leo Famulari
2017-07-31 15:12 ` Marius Bakke
2017-07-31 16:22 ` Mark H Weaver [this message]
2017-08-03 21:06 ` Marius Bakke
2017-08-04  3:48   ` Mark H Weaver
2017-08-04  9:51     ` Marius Bakke
2017-08-07 20:08   ` Marius Bakke
2017-08-09 10:19     ` Andy Wingo
2017-08-21 15:32       ` Ludovic Courtès
2017-08-21 20:24         ` Marius Bakke
2017-08-22 19:26           ` Marius Bakke
2017-08-23 22:53             ` bug#28211: " Ludovic Courtès
2017-08-23 22:53             ` Ludovic Courtès
2017-08-24  4:56               ` bug#28211: " Mark H Weaver
2017-08-24  4:56               ` Mark H Weaver
2017-08-22 20:09         ` Leo Famulari
2017-08-07 20:16 ` Efraim Flashner

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=87d18gzidc.fsf@netris.org \
    --to=mhw@netris.org \
    --cc=guix-devel@gnu.org \
    --cc=leo@famulari.name \
    /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.