From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Lam Newsgroups: gmane.lisp.guile.user,gmane.lisp.guile.bugs Subject: sxml or guile bug? Date: Mon, 1 May 2023 10:32:26 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000c8e5b405fa98a3e6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4086"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user , bug-guile@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon May 01 04:33:30 2023 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptJM2-0000sr-0X for guile-user@m.gmane-mx.org; Mon, 01 May 2023 04:33:30 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptJLY-00031a-Vc; Sun, 30 Apr 2023 22:33:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptJLW-00031E-Pk; Sun, 30 Apr 2023 22:32:58 -0400 Original-Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptJLU-0002B5-Lm; Sun, 30 Apr 2023 22:32:58 -0400 Original-Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-4ec8eca56cfso2542356e87.0; Sun, 30 Apr 2023 19:32:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682908374; x=1685500374; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=b4Hpej4urA2cHNN/A9jj1nkhOV75Vqinv2bhRQplqTg=; b=d0r+zDiS13iCtrP7VrTBI7JT4kdTe3HoHnbdGGpLkfSu6iVvsUeij3UQ6OUHPxfCyC XDOKRd+D1qX1w7dNSgJYVcG/LVmwtfTufHXr0Gllid+PBQOVcr5lMbNtLvQ7+U/ALKGf 2xewKl+McqUKhLG5U4V4XgqmcxcrgRMkWqbn4ruJtadiq3++YTtHSuL5ctvl/gLe5VKz 44Z2ANp0ZaC46WvW1CJUIeH2TRGI/BnArj5fMUrcMQaEJFMW8KEauM57TGpfnTZhlMwI CaCMq4esFzFx3eMN7khGl4Jb8u221Igqi5JzeLMhD02d2Pya5WV6ZdtDLo3QdHPwpd38 EVrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682908374; x=1685500374; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=b4Hpej4urA2cHNN/A9jj1nkhOV75Vqinv2bhRQplqTg=; b=MLAiR/IXYu4jP8VxI9OSZQXW7f+WnLEPcgT+HvAlj92E9din3FoWZIrVutqrQOi+hL FQCd5Sh4W+qQwoXkcsWZOzF9VCkuqrYIMPOv3t757EEybB/Pz+tUo/UBUoZHr+QyRRMG Gq6u607kKNe3e7aUHRMDilvSt5X9c5qPPfoEXERMTwQ3yJIscz3xgQzJehwTHOaM1anE tcDziJfP/R96U0GZJjRzyoM4zzcfChPt6VJoyVUKNbDhlXYteFlmJKJnpX6i/60/Ux/K QZpUPuFkxcJMc9y57NWXC83T0aJPA7ZVlEIN408k2YsWvdcRndRQbnziVZJgy/BcfgbH LOzg== X-Gm-Message-State: AC+VfDwrgYAzMGUMi9epEG5/ah2WdVGV1331ZHIx38IKiXleXGsVRPiW sP3ZH1mTXfjq7lQNM9StWnigjcn13HscH1Zp4R5827mrv8S78w== X-Google-Smtp-Source: ACHHUZ6i+FxsORxsz2oM0uWHVUkZKqb5kcFf+Lo9RVC3NH6GsvXoldxLlVsAZOMaNgUOvnr4kDtf1loci4PqN6Xa/wA= X-Received: by 2002:ac2:5d2d:0:b0:4f0:e03:75d9 with SMTP id i13-20020ac25d2d000000b004f00e0375d9mr3168093lfb.48.1682908373350; Sun, 30 Apr 2023 19:32:53 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=christopher.lck@gmail.com; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_HTML_ATTACH=0.01, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:18980 gmane.lisp.guile.bugs:10610 Archived-At: --000000000000c8e5b405fa98a3e6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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. =3D=3D=3D=3D sxml-bug.scm =3D=3D=3D=3D=3D (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=3D[~s]\n" html) (format #t "sxpath is [~s]\n" path) (format #t "result is [~s]\n" ((sxpath path) sx)) =3D=3D=3D=3D And the backtrace with -2 =3D=3D=3D=3D=3D 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 # =E2=80=A6) 254:18 10 (map-union # =E2=80=A6) 254:18 9 (map-union # =E2=80=A6) 254:18 8 (map-union # =E2=80=A6) 254:18 7 (map-union # =E2=80=A6) 252:22 6 (map-union # =E2=80=A6) 252:22 5 (map-union # =E2=80=A6) 254:18 4 (map-union # =E2=80=A6) 254:18 3 (map-union # =E2=80=A6) 252:22 2 (map-union # =E2=80=A6) 484:19 1 (loop _ ((tr -6))) 181:24 0 (_ _) sxml/xpath.scm:181:24: yikes! =3D=3D=3D=3D=3D --000000000000c8e5b405fa98a3e6 Content-Disposition: attachment; filename="test-file.html" Content-ID: X-Attachment-Id: f_lh482h1s0 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII"; name="test-file.html" read rows from the bottom From 01/01/23 to 12/31/23 Sorting / Add indenting columns : Disabled Sorting / Secondary Key : none Sorting / Primary Subtotal : Disabled Sorting / Primary Subtotal for Date Key : none General / Add options summary : always General / Table for Exporting : Enabled Display / Totals : Disabled Display / Amount : single Display / Other Account Name : Disabled Display / Account Name : Enabled Display / Notes : Disabled Display / Memo : Disabled Display / Num : Disabled Accounts / Accounts : Bank Date Description Account Amount 01/03/23 $103 income Root.Asset.Bank [1]$103.00 01/09/23 $109 income Root.Asset.Bank [2]$109.00 01/15/23 $22 expense Root.Asset.Bank [3]-$22.00 02/03/23 $103 income Root.Asset.Bank [4]$103.00 02/09/23 $109 income Root.Asset.Bank [5]$109.00 02/15/23 $22 expense Root.Asset.Bank [6]-$22.00 03/03/23 $103 income Root.Asset.Bank [7]$103.00 03/09/23 $109 income Root.Asset.Bank [8]$109.00 03/15/23 $22 expense Root.Asset.Bank [9]-$22.00 04/03/23 $103 income Root.Asset.Bank [10]$103.00 04/09/23 $109 income Root.Asset.Bank [11]$109.00 04/15/23 $22 expense Root.Asset.Bank [12]-$22.00 05/03/23 $103 income Root.Asset.Bank [13]$103.00 05/09/23 $109 income Root.Asset.Bank [14]$109.00 05/15/23 $22 expense Root.Asset.Bank [15]-$22.00 06/03/23 $103 income Root.Asset.Bank [16]$103.00 06/09/23 $109 income Root.Asset.Bank [17]$109.00 06/15/23 $22 expense Root.Asset.Bank [18]-$22.00 07/03/23 $103 income Root.Asset.Bank [19]$103.00 07/09/23 $109 income Root.Asset.Bank [20]$109.00 07/15/23 $22 expense Root.Asset.Bank [21]-$22.00 08/03/23 $103 income Root.Asset.Bank [22]$103.00 08/09/23 $109 income Root.Asset.Bank [23]$109.00 08/15/23 $22 expense Root.Asset.Bank [24]-$22.00 09/03/23 $103 income Root.Asset.Bank [25]$103.00 09/09/23 $109 income Root.Asset.Bank [26]$109.00 09/15/23 $22 expense Root.Asset.Bank [27]-$22.00 10/03/23 $103 income Root.Asset.Bank [28]$103.00 10/09/23 $109 income Root.Asset.Bank [29]$109.00 10/15/23 $22 expense Root.Asset.Bank [30]-$22.00 11/03/23 $103 income Root.Asset.Bank [31]$103.00 11/09/23 $109 income Root.Asset.Bank [32]$109.00 11/15/23 $22 expense Root.Asset.Bank [33]-$22.00 12/03/23 $103 income Root.Asset.Bank [34]$103.00 12/09/23 $109 income Root.Asset.Bank [35]$109.00 12/15/23 $22 expense Root.Asset.Bank [36]-$22.00 References 1. gnc-register:split-guid=859032c8639e49b49501e9a0a1497ac5 2. gnc-register:split-guid=cbe4ba7904514285a22913f3d41fde9d 3. gnc-register:split-guid=fd07c28587454d1896ac3d90b491abc7 4. gnc-register:split-guid=8d2376b51564402b8269654336eeee04 5. gnc-register:split-guid=ea146a234ff742649b93b9a33fefae2e 6. gnc-register:split-guid=8ab91494621f4bf1b0cdfc5601359459 7. gnc-register:split-guid=0b489080220c436aae8614023054953d 8. gnc-register:split-guid=7a94654477ec47a2a63093d34236ea1f 9. gnc-register:split-guid=66c9c5bbdf514ba7b20f06eda93e0eeb 10. gnc-register:split-guid=c83755eb16374818807ce38e796be8d4 11. gnc-register:split-guid=eb2ce4371dae4116abf8e69f8b3af6f6 12. gnc-register:split-guid=df341fa54f054d128abdee4340448305 13. gnc-register:split-guid=597e3adb64eb4b41bf275170e055bd43 14. gnc-register:split-guid=fe179202452a44dfb9a2540615323d38 15. gnc-register:split-guid=ca46492548a14b448dbb4f67d4d571f5 16. gnc-register:split-guid=0c8fb144e4154335a1c6dbc98f5ab53d 17. gnc-register:split-guid=889517c233dc4c2f917a9e7c945028a4 18. gnc-register:split-guid=7297930cce5c42ccbbe864e177db78e7 19. gnc-register:split-guid=ba0f8fd1ce75411785d831f70d8a51b6 20. gnc-register:split-guid=88fc84a2790448c3a273b7ea11da3bf0 21. gnc-register:split-guid=a3d79534553f462ea3c6cd8d533b99bb 22. gnc-register:split-guid=576cb90366c44bb1b942ea22a615bf1f 23. gnc-register:split-guid=773905c9652c4ddc80ca4ff462375cd0 24. gnc-register:split-guid=6c2135444dfc447b9c8c8872ae3dff36 25. gnc-register:split-guid=64b5a4f8b67d40dfb617d322baa331a7 26. gnc-register:split-guid=ae3c7904b80e44ee89a9c1e67b162b50 27. gnc-register:split-guid=67293b53307843ceb4ed10a77119243c 28. gnc-register:split-guid=285dd536ed844570aa1c313777d06821 29. gnc-register:split-guid=f6c3a452d6264df3974d3a7042c6cba9 30. gnc-register:split-guid=4a27b2af68fe4a3197173230a6915fbc 31. gnc-register:split-guid=d96ca6c7ec5c476293da8cc1778648e8 32. gnc-register:split-guid=2f762a28938443669db6c9e397fb8ec0 33. gnc-register:split-guid=1db360a62cfe44e6a52e10864edff969 34. gnc-register:split-guid=051b3f418f984dac82d6fa93469e6525 35. gnc-register:split-guid=51e95c4897c74b87a058f55d5b6cc9ca 36. gnc-register:split-guid=dbab36af60ce4edaaa56c536834edc39 --000000000000c8e5b405fa98a3e6--