-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XML to_s error #10365
Comments
What's the |
Put another way: could you provide code that I can copy/paste into a file, run it and see it break? |
I have been unable to reproduce this in a smaller code sample if I read this from a file or make it a string literal in any way it seems to work and when I use a client it fails. I will try to get a smaller sample. Here is a sample of the full XML |
This still breaks for me but now only breaks on one macbook pro and not another. I have not been able to reproduce when not making remote calls so it is hard to make a code sample for this. I am closing this to keep the issues clean. But this might be a problem introduced with 0.36.x |
I was able to narrow this down without making web requests. It seems like certain ordering of xpath methods followed by a puts breaks the program. Here is a link to the working and broke code samples. Here is the broken sample. https://gist.github.com/wontruefree/f7efd84b0cbd4eb1d2f1f32bfe249e2a#file-xml-bug
And the other one prints out he XML. |
That code runs without failure for me. Same libxml2 version, but on linux. Crystal latest is linked against LLVM 10, but master build is linked against LLVM 11.1.
So looks like it only fails on macos. Can anyone reproduce it? Could also be worth trying with an older Crystal compiler and/or other libxml2 versions. This could likely a bug in libxml2, though (or iconv or whatever would be involved). |
Unable to repro osx crystal 0.36.1, llvm 11.0.1, libxml2 2.9.10
|
So I can reproduce this on my macbookpro(2015) but not on a macbookpro(2019). |
@wontruefree can you check the output of If it is
it means you are not using brew libxml but the default system one. if you do
With |
The output was:
I used
|
I had this same issue, and it was fixed with (Ary's suggestion): export PATH="/opt/homebrew/opt/libxml2/bin:$PATH"
export PKG_CONFIG_PATH="${PKG_CONFIG_PATH:+$PKG_CONFIG_PATH:}/opt/homebrew/opt/libxml2/lib/pkgconfig" ( So it's a problem with certain libxml2 versions. Let's leave this open for reference, but for what it's worth it's fixed. |
If we so desire, we could probably fix this in the Crystal brew formula. E.g. something like what this formula is doing: Then we could always be sure |
I found that if we call |
That fixes it for me too yea. If that doesn't have any other downsides then is prob the better solution. Esp given it seems we do not actually have EDIT: Thinking on it more, should we make dependency more explicit. Either saying it uses the macos version, or actually add |
I am trying to write XMLs to a file and I am getting this error.
When I try to reduce this bug down it it starts working again. Here are the versions of XML and Crystal but are the most updated versions on homebrew.
Here is a branch with the section of code that is raising the error. Also it works when parsed as HTML.
https://github.com/wontruefree/braintree/blob/bug_xml_parse/src/cli/dispute_create_command.cr#L14-L17
The text was updated successfully, but these errors were encountered: