unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: disarchive: disassemble then assemble tarball
Date: Mon, 03 Apr 2023 14:19:33 -0600	[thread overview]
Message-ID: <871ql0zpka.fsf@ngyro.com> (raw)
In-Reply-To: 87sfdhf1w5.fsf@gmail.com

Hi Simon,

Simon Tournier <zimon.toutoune@gmail.com> writes:

> Discussing in #62153 [1], it is noticed that Disarchive is not working
> as expected.

To be fair, Oleg is experimenting with reusing some internal Disarchive
code in another context.  That experiment didn’t go well, and Oleg came
to a good (IMO) conclusion: try the tarball code from Gash-Utils.  (The
longer story is that the tarball code in Disarchive is nicer, but it is
specialized for the Disarchive use case.  Sometime I might de-specialize
it and use it in Gash-Utils, but Gash-Utils has difficult constraints
due to its use during bootstrapping.  We’ll see.)

>  scheme@(guile-user)> ,module(disarchive assemblers tarball)
>  scheme@(disarchive assemblers tarball)> (assemble-tarball (disassemble-tarball "my-gnu.tar") ".")
>
> [...]
>
>     $ tar tf sha256/7a94f577d3235a5ab954f0bc56b15fbe5518c56354c4235574618f6e666f6a38
>
> [...]
>
> gnu/build/accounts.go
> tar: Unexpected EOF in archive
> tar: Error is not recoverable: exiting now

The ‘assemble-tarball’ procedure assumes (without checking) that it has
access to a copy of its input in the “workspace” directory.  Normally,
it would be called from the generic ‘assemble’ procedure, which ensures
this (and also checks the output).  It probably just wrote all the
tarball headers without the file contents, producing a corrupt tarball.
Indeed, if you set up logging (using ‘%disarchive-log-port’) it prints a
bunch of “Ignoring irregular file” warnings.

> Well, I am not sure to understand why the name “my-gnu”.

It’s just ‘(basename "my-gnu.tar" ".tar")’.  The names are designed to
aid a human while debugging.  To my knowledge, Disarchive doesn’t use
them for anything.  You can use set the name by passing “--name” to the
‘disassemble’ subcommand.

> And then I do not understand how to use “disarchive assemble”; I get
> something like:
>
> Checking my-gnu digest... fail
> Output is incorrect
>
> What do I do wrong?

You need to put “gnu” in a directory by itself.  First,

  $ mkdir base

Then either

  $ mv gnu base/

or

  $ tar -C base -xf my-gnu.tar

Then you can run

  $ disarchive assemble base spec

In other words, it’s your old nemesis:

  https://lists.gnu.org/archive/html/guix-devel/2023-03/msg00063.html

:)  (I tease only because it’s confused me many times too!)


-- Tim


  reply	other threads:[~2023-04-03 20:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 14:58 disarchive: disassemble then assemble tarball Simon Tournier
2023-04-03 20:19 ` Timothy Sample [this message]
2023-04-03 21:08   ` Simon Tournier

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

  List information: https://guix.gnu.org/

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

  git send-email \
    --in-reply-to=871ql0zpka.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=guix-devel@gnu.org \
    --cc=zimon.toutoune@gmail.com \
    /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 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).