unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Tomas Volf <~@wolfsden.cz>
To: 71981@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [bug#71981] [PATCH] services: configuration: Produce doc even if package->symbol fails.
Date: Sun,  7 Jul 2024 19:27:47 +0200	[thread overview]
Message-ID: <53d2860103fbb103f902c3783724d44717be16d0.1720373267.git.~@wolfsden.cz> (raw)

Due to #71979 it can happen that package->symbol can return #f even for
packages that are defined in modules on the load patch and which were
previously loaded and set as a default value.

In that case we can just return (package-name val), since for the purpose of
illustrating the default value in the documentation the name should suffice.
And having (possibly) slightly misleading documentation property is still
better then `guix pull' just failing due to passing #f to symbol->string.

* gnu/services/configuration.scm (generate-documentation)[package?]: Fall back
to package-name if package->symbol fails.

Change-Id: I9987caf40d3ff62a52cbd6e3325aa42c69a6c47a
---
 gnu/services/configuration.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index d2b1687496..a0e6fe206f 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -445,7 +445,14 @@ (define (generate-documentation documentation documentation-name)
                    (define (show-default val)
                      (cond
                       ((package? val)
-                       (symbol->string (package->symbol val)))
+                       (let ((sym (package->symbol val)))
+                         ;; Work around for #71979.  While in the alternate
+                         ;; the answer will not always match the symbol, it
+                         ;; should be good enough for illustrating the default
+                         ;; value in documentation.
+                         (if sym
+                             (symbol->string sym)
+                             (package-name val))))
                       (((list-of package?) val)
                        (format #f "(~{~a~^ ~})" (map package->symbol val)))
                       (else (str val))))
-- 
2.45.1





             reply	other threads:[~2024-07-07 17:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-07 17:27 Tomas Volf [this message]
2024-10-06 15:14 ` [bug#71981] [PATCH v2] services: configuration: Produce doc even if package->symbol fails Tomas Volf

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='53d2860103fbb103f902c3783724d44717be16d0.1720373267.git.~@wolfsden.cz' \
    --to=~@wolfsden.cz \
    --cc=71981@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).