ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.23k stars 141 forks source link

chibi-doc text rendering broken in 0.11 #996

Closed ekaitz-zarraga closed 3 months ago

ekaitz-zarraga commented 3 months ago

Hi, I can't use chibi-doc in 0.11, while 0.10 worked ok.

$ chibi-doc chibi.string
ERROR: for-each: improper list: "main"
  called from <anonymous> on line 182 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/chibi/sxml.scm
  called from for1 on line 81 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from <anonymous> on line 182 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/chibi/sxml.scm
  called from for1 on line 81 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from <anonymous> on line 181 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/chibi/sxml.scm
  called from for1 on line 81 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from <anonymous>
  called from for1 on line 81 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from <anonymous>
  called from for1 on line 80 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from lp on line 57 of file /home/Ekaitz/.guix-profile/bin/chibi-doc
  called from <anonymous> on line 1268 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
  called from <anonymous> on line 800 of file /gnu/store/msc0zd5cm79i8zxfhkfz2p85dd15s92s-chibi-scheme-0.11/share/chibi/init-7.scm
ekaitz-zarraga commented 3 months ago

@ashinn I bisected the problem using this script:

make CC=gcc -j9
LD_LIBRARY_PATH=. ./chibi-scheme tools/chibi-doc chibi.string

And found the first commit with the problem is: 18d0adf13ba2a854f73fd0febf90e51ca86e13c0

ekaitz-zarraga commented 3 months ago

Does the (if (null? ls) make any sense? shouldn't it be list?

  (define (map1 proc ls res)
    (if (pair? ls)
        (map1 proc (cdr ls) (cons (proc (car ls)) res))
        (if (null? ls) ;; !!!
            (reverse res)
            (error "map: improper list" ls))))
ashinn commented 3 months ago

That commit is correct, and just uncovered the "bug" where the chibi-doc code was mapping over improper lists, relying on the forgiving handling of this by the original map implementation.

Note this only applies to the text rendering, and chibi-doc --html (as is used to generate the online manual and verified before every release) is unaffected.