[PATCH] services: configuration: Produce doc even if package->symbol fails.

  • Open
  • quality assurance status badge
Details
One participant
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal
T
T
Tomas Volf wrote on 7 Jul 19:27 +0200
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
53d2860103fbb103f902c3783724d44717be16d0.1720373267.git.~@wolfsden.cz
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(-)

Toggle diff (22 lines)
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
T
T
Tomas Volf wrote on 6 Oct 17:14 +0200
[PATCH v2] services: configuration: Produce doc even if package->symbol fails.
(address . 71981@debbugs.gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
f15912833621ab6263dc1d9d10f40d8d380b9c8a.1728227680.git.~@wolfsden.cz
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(-)

Toggle diff (20 lines)
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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 71981@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71981
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch