[Bug 2002511] Re: zlib 1.2.13 (and patched 1.2.11) breaks libxml(2) on s390x

Bug Watch Updater 2002511 at bugs.launchpad.net
Wed Jan 11 13:08:03 UTC 2023


Launchpad has imported 17 comments from the remote bug at
https://bugzilla.redhat.com/show_bug.cgi?id=2155328.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2022-12-20T20:39:24+00:00 lbalhar wrote:

Description of problem:
The latest version of zlib (1.2.13) in rawhide breaks libxml2 (and therefore lxml). The problem appears during loading a gzipped XML file.

Version-Release number of selected component (if applicable):
zlib-1.2.13-1.fc38.s390x

How reproducible:
Allways.

Steps to Reproduce:
1. echo "<a></a>" > file.xml
2. gzip file.xml
3. python3
>>> import libxml2
>>> libxml2.parseFile("file.xml.gz")

Actual results:
file.xml.gz:1: parser error : Document is empty

^
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/libxml2.py", line 1362, in parseFile
    if ret is None:raise parserError('xmlParseFile() failed')
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libxml2.parserError: xmlParseFile() failed

Expected results:
Loaded file. It works fine with zlib-1.2.12-5.fc37.s390x.

Additional info:
Might this be caused by the downstream patches we have in Fedora for s390x?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/0

------------------------------------------------------------------------
On 2022-12-21T19:24:28+00:00 iii wrote:

This must be a problem with the latest hardware compression patches.

export DFLTCC=0

makes the problem go away.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/1

------------------------------------------------------------------------
On 2022-12-21T22:18:06+00:00 lbalhar wrote:

Thanks for the info Ilya. Do you know where and how we can fix this?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/2

------------------------------------------------------------------------
On 2022-12-22T01:30:43+00:00 mhroncok wrote:

I can confirm DFLTCC=0 makes the problem go away.

$ python3
..
>>> libxml2.parseFile("file.xml.gz")
file.xml.gz:1: parser error : Document is empty

^
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.11/site-packages/libxml2.py", line 1362, in parseFile
    if ret is None:raise parserError('xmlParseFile() failed')
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libxml2.parserError: xmlParseFile() failed


$ DFLTCC=0 python3
...
>>> libxml2.parseFile("file.xml.gz")
<xmlDoc (file.xml.gz) object at 0x3ff930787d0>

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/3

------------------------------------------------------------------------
On 2022-12-22T08:56:14+00:00 iii wrote:

Yes, this must be the new strm.adler change - it seems that we should not be updating this field for raw streams.
I am working on a fix.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/4

------------------------------------------------------------------------
On 2022-12-22T11:01:17+00:00 iii wrote:

Created attachment 1934106
patch for zlib 1.2.11

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/5

------------------------------------------------------------------------
On 2022-12-22T11:01:39+00:00 iii wrote:

Created attachment 1934107
patch for zlib 1.2.13

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/6

------------------------------------------------------------------------
On 2022-12-22T11:10:21+00:00 iii wrote:

Please try either of the attached patches.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/7

------------------------------------------------------------------------
On 2022-12-22T14:11:45+00:00 lbalhar wrote:

Thanks for the patches. Could one of the package maintainers try it,
please? I've tried to apply it and it does not apply. Looking at the
patches we already have they depend on each other so I don't know
whether I should add this one as a new one or squash it into
zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch which adds the file the
new patch tries to modify.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/8

------------------------------------------------------------------------
On 2022-12-22T15:19:13+00:00 iii wrote:

Created attachment 1934119
patch for zlib 1.2.13 (rawhide version)

Hm, indeed, the 1.2.13 patch that I posted did not apply to the rawhide
zlib. I generated it against
https://github.com/madler/zlib/pull/410#issuecomment-1353070525, which
is slightly ahead.

I've attached the rebased version; it should go after all the current
rawhide patches, i.e. after Patch23: zlib-1.2.11-covscan-issues-
rhel9.patch.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/9

------------------------------------------------------------------------
On 2022-12-23T12:58:53+00:00 lbalhar wrote:

I did a test in COPR. With the rawhide version of zlib, python-lxml
fails to build because one of the tests loading gzipped XML file fails.
With the new patch, python-lxml builds fine. See:
https://copr.fedorainfracloud.org/coprs/lbalhar/zlib/builds/

PR for zlib: https://src.fedoraproject.org/rpms/zlib/pull-request/21

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/10

------------------------------------------------------------------------
On 2023-01-09T10:55:40+00:00 ljavorsk wrote:

I'm working on it.

There are several things that need to be addressed before applying the
changes in the patch.

I'm waiting for the rebase of the patch at
https://github.com/madler/zlib/pull/410

After that, it should be good to go :)

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/11

------------------------------------------------------------------------
On 2023-01-10T14:13:46+00:00 ljavorsk wrote:

I've created a test build to address this issue
(https://ljavorsk.fedorapeople.org/zlib/zlib-1.2.13-libxml-fix/)

Could you please test it?

Lumir, please test if it fixes your issue, and Ilya, please test if it
doesn't break any of your tests.

Thank you for the reports in advance.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/12

------------------------------------------------------------------------
On 2023-01-10T14:18:03+00:00 iii wrote:

zlib-1.2.13-1.fc38 passes all of my tests. Thanks!

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/13

------------------------------------------------------------------------
On 2023-01-10T14:32:11+00:00 ljavorsk wrote:

Sorry, I forgot to bump the release.

The new builds are in the same location now.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/14

------------------------------------------------------------------------
On 2023-01-10T14:34:48+00:00 iii wrote:

No problem; zlib-1.2.13-2.fc38 passes all the tests as well.

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/15

------------------------------------------------------------------------
On 2023-01-11T10:02:00+00:00 lbalhar wrote:

Thanks Lukáši for the fixes. I've tried to contact you on IRC. Could you
please upload the SRPM or open a PR with your changes so I can rebuild
the new zlib in COPR and test lxml on top of it?

Reply at:
https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/2002511/comments/16


** Changed in: zlib
       Status: Unknown => In Progress

** Changed in: zlib
   Importance: Unknown => Undecided

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to zlib in Ubuntu.
https://bugs.launchpad.net/bugs/2002511

Title:
  zlib 1.2.13 (and patched 1.2.11) breaks libxml(2) on s390x

Status in Ubuntu on IBM z Systems:
  Triaged
Status in zlib:
  In Progress
Status in zlib package in Ubuntu:
  In Progress
Status in zlib source package in Focal:
  New
Status in zlib source package in Jammy:
  New
Status in zlib source package in Kinetic:
  New
Status in zlib source package in Lunar:
  In Progress

Bug description:
  SRU Justification:
  ------------------

  [ Impact ]

   * zlib version 1.2.13, as well as patched zlib versions 1.2.11 with
     the patch from LP#1990379, break libxml2 and lxml on s390x.

   * The problem appears during loading a gzipped XML file.

   * Disabling hw compression with 'export DFLTCC=0' solves this,
     hence it's a problem with the hardware acceleration patches DFLTCC.

   * For more info see:
  https://bugzilla.redhat.com/show_bug.cgi?id=2155328

  [ Test Plan ]

   * Steps to Reproduce:
     1. echo "<a></a>" > file.xml
     2. gzip file.xml
     3. python3
     >>> import libxml2
     >>> libxml2.parseFile("file.xml.gz")

   * Actual results:
     file.xml.gz:1: parser error : Document is empty
     ^
     Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
       File "/usr/lib/python3.11/site-packages/libxml2.py",
       line 1362, in parseFile
         if ret is None:raise parserError('xmlParseFile() failed')
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     libxml2.parserError: xmlParseFile() failed

   * Expected results:
     Loaded file.

  [ Where problems could occur ]

   * Since this is limited to s390x and DFLTCC / hw acceleration active,
     any possible problems are limited to such environments.

   * Fix can be broken if the state handling (state->wrap),
     or the states mixed.

   * The translation from stream to parameter block could be broken
     (again due to wrong states) and the inflate as well.

  [ Other Info ]

   * The official upstream fix is here:
     https://github.com/zlib-ng/zlib-ng/pull/1390
     but it's for zlib-ng.

   * For zlib this needs to be adjusted and was done by the author here:
     https://launchpadlibrarian.net/641454325/patch-1.2.11

   * And again slightly adjusted by me (renamed, some white-space fixes
     and conversion into a quilt patch with proper dep3 header):
     https://launchpadlibrarian.net/645435847/1390.patch

   * The zlib version in Focal, Jammy, Kinetic and Lunar are affected.
  __________

  It has been reported that 1.2.13 as well as the patch from LP#1990379 breaks libxml2 (and libxml) on s390x:
  (https://bugzilla.redhat.com/show_bug.cgi?id=2155328). The attached patch should fix the issue.

  The upstream author proposed a fix and a new test for zlib-ng
  (https://github.com/zlib-ng/zlib-ng/pull/1390) in order to detect such
  breakages in the future.

  ___

  This was initially reported as part of LP#1990379,
  especially: https://bugs.launchpad.net/ubuntu/+source/zlib/+bug/1990379/comments/12
  but needs a separate LP bug (number) - this one.
  ___

  The proposed patch at https://launchpadlibrarian.net/641454325/patch-1.2.11
  needed some tweaks regarding white-spaces, but then applied fine on focal, jammy, kinetic and also  1.2.13, which is what we currently have in lunar-proposed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/2002511/+subscriptions




More information about the foundations-bugs mailing list