Hi, we've identified an unusual behaviour in writing a test in gnucash. Can anyone reproduce and confirmit? I paste a simple .scm file, and its input test-file.html. Now, in sxml-bug.scm, modify the index - from -1 to -2 i.e. access the last/penultimate row etc. Odd negative indices work, even negative indices lead to error. Odd (haha) bug. See report for (tr -2) for example, pasted below. ==== sxml-bug.scm ===== (use-modules (sxml simple)) (use-modules (sxml xpath)) (use-modules (ice-9 textual-ports)) (define html (call-with-input-file "/tmp/test-file.html" get-string-all)) (define sx (xml->sxml html)) ;; note this path: try different indices for the tr tag: ;; odd numbers -1 -3 -5 are ok ;; even numbers -2 -4 -6 will fail (define path '(// (table 1) // (tr -1))) (format #t "html=[~s]\n" html) (format #t "sxpath is [~s]\n" path) (format #t "result is [~s]\n" ((sxpath path) sx)) ==== And the backtrace with -2 ===== Backtrace: In ice-9/boot-9.scm: 1752:10 18 (with-exception-handler _ _ #:unwind? _ # _) In unknown file: 17 (apply-smob/0 #) In ice-9/boot-9.scm: 724:2 16 (call-with-prompt _ _ #) In ice-9/eval.scm: 619:8 15 (_ #(#(#))) In ice-9/boot-9.scm: 2836:4 14 (save-module-excursion _) 4388:12 13 (_) In /home/user/sources/sxml-bug.scm: 20:30 12 (_) In sxml/xpath.scm: 254:18 11 (map-union # …) 254:18 10 (map-union # …) 254:18 9 (map-union # …) 254:18 8 (map-union # …) 254:18 7 (map-union # …) 252:22 6 (map-union # …) 252:22 5 (map-union # …) 254:18 4 (map-union # …) 254:18 3 (map-union # …) 252:22 2 (map-union # …) 484:19 1 (loop _ ((tr -6))) 181:24 0 (_ _) sxml/xpath.scm:181:24: yikes! =====