Skip to content

lxml 5.0.0 incompatibility - Arithmetic exception #277

Closed

Description

@eljeffeg

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"])

Activity

  1. added a commit that references this issue on Jan 4, 2024
  2. brianray commented on Jan 17, 2024

    @brianray

    also experiencing segfault with lxml-5

  3. nosnilmot commented on Jan 21, 2024

    @nosnilmot
    Contributor

    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

  4. eljeffeg commented on Jan 31, 2024

    @eljeffeg
    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

  5. bgaifullin commented on Mar 2, 2024

    @bgaifullin
    Collaborator

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

  6. nosnilmot commented on Mar 3, 2024

    @nosnilmot
    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

  7. deronnax commented on Mar 15, 2024

    @deronnax

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

  8. eljeffeg commented on Mar 16, 2024

    @eljeffeg
    Author

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

  9. eljeffeg commented on Mar 17, 2024

    @eljeffeg
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions