Skip to content
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

lxml 5.0.0 incompatibility - Arithmetic exception #277

Closed
eljeffeg opened this issue Jan 4, 2024 · 8 comments
Closed

lxml 5.0.0 incompatibility - Arithmetic exception #277

eljeffeg opened this issue Jan 4, 2024 · 8 comments

Comments

@eljeffeg
Copy link

eljeffeg commented Jan 4, 2024

lxml 5.0.0 was released on Dec 29th 2023. This update causes an Arithmetic exception (core dumped) when using python-xmlsec.

Example code that would fail..

import xmlsec
from lxml import etree
root = None
with open("sign4-in.xml") as f:
    root = etree.parse(f).getroot()
xmlsec.tree.add_ids(root, ["ID"])
eljeffeg added a commit to eljeffeg/python-xmlsec that referenced this issue Jan 4, 2024
gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Jan 5, 2024
Bug: xmlsec/python-xmlsec#277
Signed-off-by: Sam James <sam@gentoo.org>
@brianray
Copy link

also experiencing segfault with lxml-5

@nosnilmot
Copy link
Contributor

nosnilmot commented Jan 21, 2024

Use pip install --no-binary lxml lxml to install lxml from source and link to system libxml2, same as xmlsec, to avoid conflicting libxml2 libraries.
See also https://bugs.launchpad.net/lxml/+bug/1960668#yui_3_10_3_1_1705879387759_1639 and https://github.com/nosnilmot/lxml/blob/master/doc/FAQ.txt#L623

@eljeffeg
Copy link
Author

@nosnilmot Sucks that your PR from Dec 2022 was never accepted. We could have avoided the entire issue. Suggest upvoting a fork. lol #275

@bgaifullin
Copy link
Collaborator

I am not sure, that need to build lxml from source every-time.

@nosnilmot
Copy link
Contributor

I am not sure, that need to build lxml from source every-time.

what are you not sure about?

lxml bundles it's own copy of libxml2 which may be a different version from the library that xmlsec is linked against, the only way to ensure they are both using the same version is to rebuild lxml.

This is documented here: https://lxml.de/FAQ.html#my-application-crashes

@deronnax
Copy link

@eljeffeg you are on macOS, aren't you?

@eljeffeg
Copy link
Author

Yes, I'll try and test it tonight or tomorrow.

@eljeffeg
Copy link
Author

@deronnax I can confirm I was able to build the latest xmlsec on MacOS and it passed the example code posted in the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants