benibela / xidel

Command line tool to download and extract data from HTML/XML pages or JSON-APIs, using CSS, XPath 3.0, XQuery 3.0, JSONiq or pattern matching. It can also create new or transformed XML/HTML/JSON documents.
http://www.videlibri.de/xidel.html
GNU General Public License v3.0
674 stars 42 forks source link

fn:matches (version 0.9.9 FPC3.2+) crashes on macOS #93

Closed Fravadona closed 2 years ago

Fravadona commented 2 years ago

Given the followings XML:

<?xml version="1.0" encoding="utf-8" ?>
<a>X</a>

Here's what I get when I run xidel --xpath 'matches( /a/text(), "a|b" )' input.xml:

Xidel 0.9.9 (20220605.git87483a690c50ef2a60fbebf83055ce46f9c2b6ac) FPC3.2.2 x86_64-Darwin
An unhandled exception occurred at $0000000101E13F13:
EAccessViolation: Access violation
  $0000000101E13F13
  $0000000101CC4777
Xidel 0.9.9 (20220424.8389.2d2ee7befb8a) FPC3.2.2 x86_64-Darwin
An unhandled exception occurred at $000000010357B303:
EAccessViolation: Access violation
  $000000010357B303
  $00000001033E87C7
Xidel 0.9.9 (20220424.8389.2d2ee7befb8a) FPC3.2.2 x86_64-Linux
false
Xidel 0.9.9 (20220424.8389.2d2ee7befb8a) FPC3.0.4a x86_64-Darwin
false

I attached the build logs of Xidel using FPC 3.2.2 on Linux and macOS so that you can see the several new warnings that appear on macOS.

xidel_build_linux.log xidel_build_macos.log

benibela commented 2 years ago

What does the debug version say? Or compiled with -g -gl? Or when it is run through gdb (after the error use commands disassemble and backtrace to get more information)?

I do not have a Mac to investigate this

Fravadona commented 2 years ago

I didn't find the debug version, compiling Xidel with -g -gl doesn't yield anything more than the previous crash message, and getting gdb to work on macOS is so convoluted... But here's the log:

gdb.log

benibela commented 2 years ago

Looks like that issue I encountered last month when updating fpc: https://github.com/BeRo1985/flre/issues/85

Try compiling it with the patched flre

Fravadona commented 2 years ago

Hi,

The patch fixes the macOS issue

Thank you