unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Corrupt input while restoring file
@ 2015-03-13  1:19 David Thompson
  2015-03-14 14:00 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: David Thompson @ 2015-03-13  1:19 UTC (permalink / raw)
  To: guix-devel

Hello,

I'm trying to get my WIP 'guix publish' script to work again and 'guix
substitute-binary' throws a nar error after downloading from my server.

Take this for example:

    guix substitute-binary --substitute /gnu/store/z8kf6hgln4a7xf68pdnlibl3vcg5rl15-ruby-2.2.1 /tmp/foobar

This store item is 39.7MiB uncompressed, but Guix tries to read a 162MiB
file out of it!

Here's the output of some quick debugging statements I inserted into
'get-bytevector-n*' in (guix serialization):

    ;;; (count 170068601)
    
    ;;; (eof? #f)
    
    ;;; (length<? #t)
    Backtrace:
    In ice-9/boot-9.scm:
      63: 19 [call-with-prompt prompt0 ...]
    In ice-9/eval.scm:
     432: 18 [eval # #]
    In ice-9/boot-9.scm:
    2401: 17 [save-module-excursion #<procedure cbc940 at ice-9/boot-9.scm:4045:3 ()>]
    4050: 16 [#<procedure cbc940 at ice-9/boot-9.scm:4045:3 ()>]
    1724: 15 [%start-stack load-stack #<procedure ccede0 at ice-9/boot-9.scm:4041:10 ()>]
    1729: 14 [#<procedure cd2ea0 ()>]
    In unknown file:
       ?: 13 [primitive-load "/home/dave/Code/guix/scripts/guix"]
    In guix/ui.scm:
     849: 12 [run-guix-command substitute-binary "--substitute" ...]
    In ice-9/boot-9.scm:
     157: 11 [catch getaddrinfo-error ...]
     157: 10 [catch srfi-34 #<procedure 166c2a0 at guix/ui.scm:221:2 ()> ...]
     157: 9 [catch system-error ...]
    In guix/scripts/substitute-binary.scm:
     767: 8 [#<procedure 166c2c0 at guix/scripts/substitute-binary.scm:678:3 ()>]
    In guix/serialization.scm:
     331: 7 [restore-file #<input: r6rs-custom-binary-input-port 16ab820> "/tmp/foobar"]
     365: 6 [restore "/tmp/foobar"]
     365: 5 [restore "/tmp/foobar/bin"]
     333: 4 [restore "/tmp/foobar/bin/irb"]
     127: 3 [read-string #<input: r6rs-custom-binary-input-port 16ab820>]
     119: 2 [read-byte-string #<input: r6rs-custom-binary-input-port 16ab820>]
      78: 1 [get-bytevector-n* #<input: r6rs-custom-binary-input-port 16ab820> ...]
    In unknown file:
       ?: 0 [scm-error misc-error #f "~A" ("foo") #f]
    
    ERROR: In procedure scm-error:
    ERROR: foo

I'm just not sure what's going on here.  'guix publish' simply uses
'write-file' to dump store items into an HTTP response.

Does anyone have an idea what might be going on?

Thanks!

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Corrupt input while restoring file
  2015-03-13  1:19 Corrupt input while restoring file David Thompson
@ 2015-03-14 14:00 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-03-14 14:00 UTC (permalink / raw)
  To: David Thompson; +Cc: guix-devel

David Thompson <dthompson2@worcester.edu> skribis:

> Take this for example:
>
>     guix substitute-binary --substitute /gnu/store/z8kf6hgln4a7xf68pdnlibl3vcg5rl15-ruby-2.2.1 /tmp/foobar
>
> This store item is 39.7MiB uncompressed, but Guix tries to read a 162MiB
> file out of it!

Please check the file
/var/guix/substitute-binary/cache/z8kf6hgln4a7xf68pdnlibl3vcg5rl15.  It
should contain the raw narinfo produced by ‘guix publish’.  Is it
correct?

If not, you can remove that file and do a query to repopulate it (like
‘guix build ruby -n’, which leads to the daemon invoking ‘guix
substitute-binary --query’.)

The narinfo has a ‘NarSize’ field, which gets map to what the
‘narinfo-size’ procedure in (guix scripts substitute-binary) returns.
This is the expected size of the .nar, uncompressed:

  (format (current-error-port) "downloading `~a'~:[~*~; (~,1f MiB installed)~]...~%"
          store-path

          ;; Use the Nar size as an estimate of the installed size.
          (narinfo-size narinfo)
          (and=> (narinfo-size narinfo)
                 (cute / <> (expt 2. 20))))

(The actual size of the data being downloaded is smaller or equal to the
nar size, due to compression; the installed size is typically greater.)

>      331: 7 [restore-file #<input: r6rs-custom-binary-input-port 16ab820> "/tmp/foobar"]
>      365: 6 [restore "/tmp/foobar"]
>      365: 5 [restore "/tmp/foobar/bin"]
>      333: 4 [restore "/tmp/foobar/bin/irb"]

This suggests that the nar is properly decoded so far.

>      127: 3 [read-string #<input: r6rs-custom-binary-input-port 16ab820>]
>      119: 2 [read-byte-string #<input: r6rs-custom-binary-input-port 16ab820>]
>       78: 1 [get-bytevector-n* #<input: r6rs-custom-binary-input-port 16ab820> ...]
>     In unknown file:
>        ?: 0 [scm-error misc-error #f "~A" ("foo") #f]

So where does this ‘error’ call come from?  What does ‘read-contents’
sees for the ‘irb’ file, namely the ‘executable?’ and ‘size’ variables?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-14 14:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-13  1:19 Corrupt input while restoring file David Thompson
2015-03-14 14:00 ` Ludovic Courtès

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).