GNU bug report logs - #71981
[PATCH] services: configuration: Produce doc even if package->symbol fails.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Sun, 7 Jul 2024 17:29:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 71981 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 guix-patches <at> gnu.org:
bug#71981; Package guix-patches. (Sun, 07 Jul 2024 17:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 07 Jul 2024 17:29:02 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] services: configuration: Produce doc even if package->symbol
 fails.
Date: Sun,  7 Jul 2024 19:27:47 +0200
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





Information forwarded to guix-patches <at> gnu.org:
bug#71981; Package guix-patches. (Sun, 06 Oct 2024 15:16:02 GMT) Full text and rfc822 format available.

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

From: Tomas Volf <~@wolfsden.cz>
To: 71981 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2] services: configuration: Produce doc even if
 package->symbol fails.
Date: Sun,  6 Oct 2024 17:14:40 +0200
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
---
Rebase on latest master.

 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.46.0




This bug report was last modified 11 days ago.

Previous Next


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