diff mbox series

[bug#52828] Fix Disarchive fallback on Guix System

Message ID 877dbpuc2n.fsf@ngyro.com
State Accepted
Headers show
Series [bug#52828] Fix Disarchive fallback on Guix System | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Timothy Sample Dec. 27, 2021, 6:39 p.m. UTC
Hi everyone,

I noticed recently that Disarchive fallback does not work on Guix
System.  This is because the ‘(guix swh)’ module shells out to ‘tar’ to
extract the tarball that it downloads from SWH.  However, when used as
part of ‘guix perform-download’ via the daemon, ‘tar’ is not available.
AFAICS, that the daemon is run with no ‘PATH’ at all.

You can confirm this by running (on Guix System):

    $ GUIX_DOWNLOAD_FALLBACK_TEST=disarchive-mirrors \
          guix build --check -S python-flask

You should see:

    [...]
    Downloading [...] from Software Heritage...
    In procedure fport_write: Broken pipe
    [...]

This patch adds ‘tar’ and ‘gzip’ to the daemon’s ‘PATH’.  To me, this is
the most straight-forward way to fix the issue, but there are others.
Any opinions?


-- Tim

Comments

Ludovic Courtès Jan. 5, 2022, 8:54 p.m. UTC | #1
Hi Timothy,

Timothy Sample <samplet@ngyro.com> skribis:

> I noticed recently that Disarchive fallback does not work on Guix
> System.  This is because the ‘(guix swh)’ module shells out to ‘tar’ to
> extract the tarball that it downloads from SWH.  However, when used as
> part of ‘guix perform-download’ via the daemon, ‘tar’ is not available.
> AFAICS, that the daemon is run with no ‘PATH’ at all.
>
> You can confirm this by running (on Guix System):
>
>     $ GUIX_DOWNLOAD_FALLBACK_TEST=disarchive-mirrors \
>           guix build --check -S python-flask
>
> You should see:
>
>     [...]
>     Downloading [...] from Software Heritage...
>     In procedure fport_write: Broken pipe
>     [...]
>
> This patch adds ‘tar’ and ‘gzip’ to the daemon’s ‘PATH’.  To me, this is
> the most straight-forward way to fix the issue, but there are others.
> Any opinions?
>
>>From 2893252c16f3e447eccd0f8d216bfb44b1965c43 Mon Sep 17 00:00:00 2001
> From: Timothy Sample <samplet@ngyro.com>
> Date: Thu, 23 Dec 2021 22:32:07 -0500
> Subject: [PATCH] services: guix: Add tar and gzip to PATH.
>
> * gnu/services/base.scm (guix-shepherd-service): Add the PATH
> environment-variable and populate it with tar and gzip.

What about uses of guix-daemon on other distros?  Perhaps we assume tar
and gzip are already on PATH?

I’d feel more comfortable with a solution at the package level.  In the
‘guix’ package, or perhaps in a Makefile.am, we could hard-code absolute
file names of tar and gzip in (guix scripts perform-download) and set
PATH from there.  We’d need to do the same in (guix self) though.

Alternatively, we could change (guix swh) to use Guile-Zlib and the tar
implementation of Gash-Utils or that of Disarchive.

WDYT?

Thanks,
Ludo’.
diff mbox series

Patch

From 2893252c16f3e447eccd0f8d216bfb44b1965c43 Mon Sep 17 00:00:00 2001
From: Timothy Sample <samplet@ngyro.com>
Date: Thu, 23 Dec 2021 22:32:07 -0500
Subject: [PATCH] services: guix: Add tar and gzip to PATH.

* gnu/services/base.scm (guix-shepherd-service): Add the PATH
environment-variable and populate it with tar and gzip.
---
 gnu/services/base.scm | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 88869e40d2..2fad07097b 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -55,7 +55,8 @@  (define-module (gnu services base)
                 #:select (alsa-utils crda eudev e2fsprogs fuse gpm kbd lvm2 rng-tools))
   #:use-module (gnu packages bash)
   #:use-module ((gnu packages base)
-                #:select (coreutils glibc glibc-utf8-locales))
+                #:select (coreutils glibc glibc-utf8-locales tar))
+  #:use-module ((gnu packages compression) #:select (gzip))
   #:autoload   (gnu packages guile-xyz) (guile-netlink)
   #:autoload   (gnu packages hurd) (hurd)
   #:use-module (gnu packages package-management)
@@ -1709,7 +1710,14 @@  (define (guix-shepherd-service config)
                                  (string-append "GUIX_LOCPATH="
                                                 #$glibc-utf8-locales
                                                 "/lib/locale")
-                                 "LC_ALL=en_US.utf8")
+                                 "LC_ALL=en_US.utf8"
+                                 ;; Make 'tar' and 'gzip' available so
+                                 ;; that 'guix perform-download' can use
+                                 ;; them when downloading from Software
+                                 ;; Heritage via '(guix swh)'.
+                                 (string-append "PATH="
+                                                #$(file-append tar "/bin") ":"
+                                                #$(file-append gzip "/bin")))
                            (if proxy
                                (list (string-append "http_proxy=" proxy)
                                      (string-append "https_proxy=" proxy))
-- 
2.34.0