Subject: bug#58247: Using guix time-machine results in unsupported manifest format error

From: zimoun <[email-masked]>
Date: Mon, 03 Oct 2022 00:10:24 +0200

Hi,

On Sun, 02 Oct 2022 at 20:57, david larsson <[email-masked]> wrote:
> On 2022-10-02 19:02, zimoun wrote:

>> It is probably because an issue with version of manifest; e.g, fixed by
>> 67a6828b2bb821274757f686f7c685b664339a96.  See
>> <https://issues.guix.gnu.org/57306>.
>
> Note that the commit I'm on, is from 2 days ago, which is after the fix 
> commit you're mentioning.

Yes, note that the earlier mentioned commit
7e8e07033d2a6b0ecef566a05084c534c774cd4a is from Oct 2021 if I read
correctly.

> Not sure it matters, but Im able to run guix time-machine 
> --commit=<somecommit> -- describe but not package -i <somepackage>

IIUC, ’describe’ reads from ~/.config/guix/current/manifest and here the
issue is from ~/.guix-profile/manifest.

Maybe I am wrong, but I think the issue is coming from an
incompatibility about the version of ~/.guix-profile/manifest.

This manifest is at the version 4.  When you run

  guix time-machine --commit=<commit> -- package -i hello

then I guess it works or not depending on <commit>.

The manifest file ~/.guix-profile/manifest needs to be updated and there
is a conflict because some versions of the profile manifest.  For
instance, consider two profiles generated using 2 different revisions of
Guix – a recent one and an old one:

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=729ce5f -- package -i hello -p /tmp/new

$ cat /tmp/new/manifest | grep -A 1 '(manifest'
(manifest
  (version 4)
--8<---------------cut here---------------end--------------->8---

and

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=7e8e070 -- package -i hello -p /tmp/old

$ cat /tmp/old/manifest | grep -A 1 '(manifest'
(manifest
  (version 3)
--8<---------------cut here---------------end--------------->8---

Now, consider the recent profile named /tmp/new and try to install a
previous package from an old commit,

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=7e8e070 -- package -i hello -p /tmp/new
guix package: error: unsupported manifest format
--8<---------------cut here---------------end--------------->8---

The old Guix uses version 3 and cannot read/write version 4 and bang!

Let try the converse,

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=729ce5f -- package -i hello -p /tmp/old

$ cat /tmp/old/manifest | grep -A 1 '(manifest'
(manifest
  (version 4)

$ guix package --list-generations -p /tmp/old
Generation 1	oct. 02 2022 18:53:10
  hello	2.10	out	/gnu/store/xg67cpxq2p6q7wn4y2z194pndwdymhpf-hello-2.10

Generation 2	oct. 02 2022 21:25:11	(current)
 + hello	2.12.1	out	/gnu/store/s5pd3rnzymliafb4la5sca63j86xs0y0-hello-2.12.1
 - hello	2.10  	out	/gnu/store/xg67cpxq2p6q7wn4y2z194pndwdymhpf-hello-2.10
--8<---------------cut here---------------end--------------->8---

This profile /tmp/old is thus converted from version 3 to version 4, and
then, reusing old version of Guix fails,

--8<---------------cut here---------------start------------->8---
$ guix time-machine --commit=7e8e070 -- package -i hello -p /tmp/old
guix package: error: unsupported manifest format
--8<---------------cut here---------------end--------------->8---

Well, I do not know if a fix is possible.  The issue is a
backward compatibility issue.

Cheers,
simon