configuration->documentation generates garbage @-command on fields beginning with numeric characters

  • Open
  • quality assurance status badge
Details
2 participants
  • Maxim Cournoyer
  • Bruno Victal
Owner
unassigned
Submitted by
Bruno Victal
Severity
normal
B
B
Bruno Victal wrote on 15 Jan 2023 15:34
(name . bug-guix)(address . bug-guix@gnu.org)
825174ce-54ab-1c14-e6f7-1d05f5f434b1@makinata.eu
Minimal example (with Guix REPL):

Toggle snippet (22 lines)
scheme@(guix-user)> ,use (gnu services configuration)
scheme@(guix-user)> (define serialize-boolean (lambda (x y) #t))
scheme@(guix-user)> (define-configuration example-configuration (1-foo (boolean #t) "lorem ipsum"))
scheme@(guix-user)> (configuration->documentation 'example-configuration)
%example-configuration
@c %start of fragment

@deftp {Data Type} example-configuration
Available @code{example-configuration} fields are:

@table @asis
@item @code{#@{1-foo@}#} (default: @code{#t}) (type: boolean)
lorem ipsum

@end table

@end deftp


@c %end of fragment
scheme@(guix-user)>
M
M
Maxim Cournoyer wrote on 17 Jan 2023 16:56
control message for bug #60834
(address . control@debbugs.gnu.org)
87tu0p17ft.fsf@gmail.com
merge 60834 57958
quit
M
M
Maxim Cournoyer wrote on 17 Jan 2023 16:57
(address . control@debbugs.gnu.org)
87pmbd17d3.fsf@gmail.com
unmerge 60834
quit
B
B
Bruno Victal wrote on 6 Apr 2023 15:20
Re: bug#60834: configuration->documentation generates garbage @-command on fields beginning with numeric characters
(address . 60834@debbugs.gnu.org)
3d104971-f6f8-891d-dceb-ac67e1ef1acf@makinata.eu
This seems to be an issue involving how 'object->string' works:

Toggle snippet (12 lines)
scheme@(guile-user)> (object->string '1-foo)
$1 = "#{1-foo}#"
scheme@(guile-user)> (object->string '-foo)
$2 = "-foo"
scheme@(guile-user)> (object->string 'foo-1-bar)
$3 = "foo-1-bar"
scheme@(guile-user)> (object->string 'foo-1)
$4 = "foo-1"
scheme@(guile-user)>


Grepping guile source, we see that 'format' also uses 'object->string' for the ~a format, which prints:

Toggle snippet (5 lines)
scheme@(guile-user)> (format #t "Expected: ~a, ~a; Unexpected: ~a;~%" 'foo '-foo '1-foo)
Expected: foo, -foo; Unexpected: #{1-foo}#;
$5 = #t
scheme@(guile-user)>
?
Your comment

Commenting via the web interface is currently disabled.

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

To respond to this issue using the mumi CLI, first switch to it
mumi current 60834
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