GNU bug report logs - #69836
Guix build builds but errors when given file-like object

Previous Next

Package: guix;

Reported by: Richard Sent <richard <at> freakingpenguin.com>

Date: Sun, 17 Mar 2024 02:49:02 UTC

Severity: normal

To reply to this bug, email your comments to 69836 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#69836; Package guix. (Sun, 17 Mar 2024 02:49:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Sent <richard <at> freakingpenguin.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 17 Mar 2024 02:49:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Sent <richard <at> freakingpenguin.com>
To: bug-guix <at> gnu.org
Subject: Guix build builds but errors when given file-like object
Date: Sat, 16 Mar 2024 22:48:02 -0400
When running ~$ guix build -f test.scm~, where test.scm returns a file
like object, the output is built but an error is printed. According to
(info (guix) Additional Build Options), file-like objects are supported
by guix build -f.

For example, with the following file:

--8<---------------cut here---------------start------------->8---
(use-modules
 (guix gexp))

(plain-file "hello-world" "HELLO WORLD")
--8<---------------cut here---------------end--------------->8---

/gnu/store/.....-hello-world is built and contains "HELLO WORLD", but
there is an match error in guix/ui.scm:show-derivation-outputs.

--8<---------------cut here---------------start------------->8---
...
In guix/scripts/build.scm:
   804:26  4 (_)
In srfi/srfi-1.scm:
    634:9  3 (for-each #<procedure show-derivation-outputs (derivat?> ?)
In guix/ui.scm:
    956:2  2 (show-derivation-outputs _)
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
Throw to key `match-error' with args `("match" "no matching pattern" "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-world")'.
--8<---------------cut here---------------end--------------->8---

This error could be fixed with the following patch:

--8<---------------cut here---------------start------------->8---
diff --git a/guix/ui.scm b/guix/ui.scm
index 962d291d2e..4dc926cbfe 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -958,7 +958,9 @@ (define (show-derivation-outputs derivation)
      (show-outputs derivation (derivation-output-names derivation)))
     ((? derivation-input? input)
      (show-outputs (derivation-input-derivation input)
-                   (derivation-input-sub-derivations input)))))
+                   (derivation-input-sub-derivations input)))
+    ((? string?) ;file-like object was built
+     (format #t "~a~%" derivation))))
 
 (define* (check-available-space need
                                 #:optional (directory (%store-prefix)))
--8<---------------cut here---------------end--------------->8---

However, this brings up another error.

--8<---------------cut here---------------start------------->8---
...
In guix/scripts/build.scm:
   808:49  3 (_ "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-w?")
In guix/derivations.scm:
    709:7  2 (derivation->output-paths "/gnu/store/wvr6byljawdlxgxab?")
In ice-9/boot-9.scm:
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)

ice-9/boot-9.scm:1685:16: In procedure raise-exception:
In procedure struct-vtable: Wrong type argument in position 1 (expecting struct): "/gnu/store/wvr6byljawdlxgxabl6798i0afqgpyiq-hello-world"
--8<---------------cut here---------------end--------------->8---

In my opinion, being able to directly build file-like objects from the
command line is a useful feature and should be better supported. I don't
know if the ideal fix involves changing the guix-build command in
guix/scripts/build.scm to stop assuming everything is a derivation or
changing the logic in guix/derivations.scm to handle strings in addition
to derivation structs.

Possible related: https://lists.gnu.org/archive/html/bug-guix/2022-07/msg00037.html.

-- 
Take it easy,
Richard Sent
Making my computer weirder one commit at a time.




This bug report was last modified 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.