unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Sent <richard@freakingpenguin.com>
To: 69836@debbugs.gnu.org
Subject: bug#69836: Guix build builds but errors when given file-like object
Date: Sat, 16 Mar 2024 22:48:02 -0400	[thread overview]
Message-ID: <87cyrt376l.fsf@freakingpenguin.com> (raw)

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.




                 reply	other threads:[~2024-03-17  3:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=87cyrt376l.fsf@freakingpenguin.com \
    --to=richard@freakingpenguin.com \
    --cc=69836@debbugs.gnu.org \
    /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).