Subject: [bug#75426] [PATCH] docker: Build tarballs reproducibly.

From: Simon Josefsson <[email-masked]>
Date: Fri, 31 Jan 2025 23:44:18 +0100

fre 2025-01-31 klockan 17:12 +0100 skrev Ludovic Courtès:
> Hi,
> 
> Simon Josefsson <[email-masked]> skribis:
> 
> > Hi!  I suspect something went wrong with this patch, now 'guix
> > pack'
> > fail and give the error below.  Maybe the 'cf' has to come first?
> > 
> > https://gitlab.com/debdistutils/guix/container/-/jobs/8988707317
> 
> > tar: You must specify one of the '-Acdtrux', '--delete' or '--test-
> > label' options
> > Try 'tar --help' or 'tar --usage' for more information.
> 
> Hmm I don’t see this message in the GitLab log above, and I cannot
> reproduce the problem:
> 
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix pack -f docker sed
> /gnu/store/h2hdp469v3014b82qsvz5fkw00sfxdgh-sed-docker-pack.tar.gz
> $ git log |head -3
> commit 97fb1887ad10000c067168176c504274e29e4430
> Author: Ashish SHUKLA <[email-masked]>
> Date:   Mon Jan 20 21:46:10 2025 +0000
> --8<---------------cut here---------------end--------------->8---
> 
> Could you try to come up with a command and commit that reproduces
> it?

Running the commands in the log like below on my local trisquel machine
with guix triggers the same problem.  Any ideas?

(FWIW, the message is hidden inside the log, but the error and filename
of the log is printed in the gitlab log above, same as below; it is
possible to click on 'Job artifacts' to find the log files.)

/Simon

jas@kaka:~$ guix describe
Generation 26	31 jan 2025 23:37:27	(aktuell)
  guix d48da2d
    repository URL: https://git.savannah.gnu.org/git/guix.git
    branch: master
    commit: d48da2d21610f9cf5f76cd846703b12beedb1fd5
jas@kaka:~$ guix pack coreutils --save-provenance -S /bin=bin -S
/share=share -f docker --image-tag=guix --max-layers=8 --verbosity=2
net-base
The following derivation will be built:
  /gnu/store/qkz6wc1qq23ah1xk387givjvk9qlgwcn-coreutils-net-base-
docker-pack.tar.gz.drv
bygger /gnu/store/qkz6wc1qq23ah1xk387givjvk9qlgwcn-coreutils-net-base-
docker-pack.tar.gz.drv…
|builder for `/gnu/store/qkz6wc1qq23ah1xk387givjvk9qlgwcn-coreutils-
net-base-docker-pack.tar.gz.drv' failed with exit code 1
bygge av /gnu/store/qkz6wc1qq23ah1xk387givjvk9qlgwcn-coreutils-net-
base-docker-pack.tar.gz.drv misslyckades
Granska bygglogg vid
”/var/log/guix/drvs/qk/z6wc1qq23ah1xk387givjvk9qlgwcn-coreutils-net-
base-docker-pack.tar.gz.drv.bz2”.
guix pack: fel: build of `/gnu/store/qkz6wc1qq23ah1xk387givjvk9qlgwcn-
coreutils-net-base-docker-pack.tar.gz.drv' failed
jas@kaka:~$ bzcat /var/log/guix/drvs/qk/z6wc1qq23ah1xk387givjvk9qlgwcn-
coreutils-net-base-docker-pack.tar.gz.drv.bz2 | tail -30
tar: You must specify one of the '-Acdtrux', '--delete' or '--test-
label' options
Try 'tar --help' or 'tar --usage' for more information.
Backtrace:
           7 (primitive-load "/gnu/store/5z5322v39y5mwninj36m877zgsx?")
In guix/docker.scm:
    387:6  6 (build-docker-image "/gnu/store/8ac4lljjiqp3a7zydh6l9v?"
?)
In ice-9/ports.scm:
   433:17  5 (call-with-output-file _ _ #:binary _ #:encoding _)
    476:4  4 (_ _)
In guix/docker.scm:
   277:15  3 (_)
In srfi/srfi-1.scm:
   586:17  2 (map1 ("/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-?" ?))
In guix/docker.scm:
   279:18  1 (_ "/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2?")
In guix/build/utils.scm:
    822:6  0 (invoke "tar" "--mtime=@1" "--owner=0" "--group=0" "--?"
?)

guix/build/utils.scm:822:6: In procedure invoke:
ERROR:
  1. &invoke-error:
      program: "tar"
      arguments: ("--mtime=@1" "--owner=0" "--group=0" "--numeric-
owner" "--sort=name" "--mode=go+u,go-w" "cf" "layer.tar"
"/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39")
      exit-status: 2
      term-signal: #f
      stop-signal: #f
jas@kaka:~$