• Bug#905316: maxima: printf hangs with format string, works in lisp mode

    From Camm Maguire@21:1/5 to All on Thu May 15 01:30:01 2025
    tags 905316 forwarded maxima-discuss@lists.sourceforge.net
    thanks

    Greetings, and thanks for your report! ============================================================================= Dear Maintainer,

    I wanted to format a list of integers in base 16, but the default output was returned in mixed case for the letters A-F. When I added case-conversion to the format string, maxima suddenly ends up in an infinite memory-consuming loop. The exact same format string works in lisp within maxima.


    Example:


    This works as expected and prints the list as a comma-separated list of hexadecimal integers in upper case:

    (%i1) :lisp (format t "~{0x~:@(~x~)~^, ~}~%" '(1000 2000 3000 4000) )
    0x3E8, 0x7D0, 0xBB8, 0xFA0
    NIL
    (%i1)

    while this hangs indefinitely (notice exact same string and values)

    (%i1) printf(true, "~{0x~:@(~x~)~^, ~}~%", [1000,2000,3000,4000] );


    This started happening when I added the case conversion. If I remove it, the output is as expected:

    (%i4) printf(true, "~{0x~x~^, ~}~%", [1000,2000,3000,4000] );
    0x3E8, 0x7D0, 0xBB8, 0xFA0
    (%o4) false
    =============================================================================

    Take care,
    --
    Camm Maguire camm@maguirefamily.org ==========================================================================
    "The earth is but one country, and mankind its citizens." -- Baha'u'llah

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Camm Maguire@21:1/5 to All on Thu May 15 16:30:01 2025
    forwarded 905316 maxima-discuss@lists.sourceforge.net
    thanks

    Greetings, and thanks for your report! ============================================================================= Dear Maintainer,

    I wanted to format a list of integers in base 16, but the default output was returned in mixed case for the letters A-F. When I added case-conversion to the format string, maxima suddenly ends up in an infinite memory-consuming loop. The exact same format string works in lisp within maxima.


    Example:


    This works as expected and prints the list as a comma-separated list of hexadecimal integers in upper case:

    (%i1) :lisp (format t "~{0x~:@(~x~)~^, ~}~%" '(1000 2000 3000 4000) )
    0x3E8, 0x7D0, 0xBB8, 0xFA0
    NIL
    (%i1)

    while this hangs indefinitely (notice exact same string and values)

    (%i1) printf(true, "~{0x~:@(~x~)~^, ~}~%", [1000,2000,3000,4000] );


    This started happening when I added the case conversion. If I remove it, the output is as expected:

    (%i4) printf(true, "~{0x~x~^, ~}~%", [1000,2000,3000,4000] );
    0x3E8, 0x7D0, 0xBB8, 0xFA0
    (%o4) false
    =============================================================================

    Take care,
    --
    Camm Maguire camm@maguirefamily.org ==========================================================================
    "The earth is but one country, and mankind its citizens." -- Baha'u'llah

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)