After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 659404 - lzma compression support
lzma compression support
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other Mac OS
: Normal enhancement
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2011-09-18 16:09 UTC by Anders F Björklund
Modified: 2012-01-27 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
libxml2-add-lzma-compression-support.patch (30.00 KB, patch)
2011-09-18 16:09 UTC, Anders F Björklund
none Details | Review
libxml2-liblzma.patch (82.51 KB, patch)
2011-09-19 08:09 UTC, Anders F Björklund
none Details | Review

Description Anders F Björklund 2011-09-18 16:09:02 UTC
Created attachment 196885 [details] [review]
libxml2-add-lzma-compression-support.patch

This patch adds liblzma support, next to the libz support...
When enabled, libxml can now handle lzma/xz compression too.

It's somewhat complicated by the missing "xzopen" interface,
and by transparently handling gzip even when lzma is enabled.
Comment 1 Anders F Björklund 2011-09-19 08:09:57 UTC
Created attachment 196902 [details] [review]
libxml2-liblzma.patch

I cleaned the support up by moving helpers to separate file,
and added the missing API entry needed for XML_WITH_LZMA...
Comment 2 Daniel Veillard 2011-11-11 08:53:19 UTC
Okay, I finally came around reading this, sorry for the delay.
This is a bit scary, I mean it's a lot of code, I got a bit better
when I discovered it was in a large part based on alone_decoder.c
from the xz project code. There is still a few things I worry about
like in xz_state, the lzma_stream and z_stream structures are embbeded in. 
This create a serious risk, if the libraries are upgrated, and
somehow they change the structures, libvirt will suddenly crash.
Yes libraries are not supposed to break ABIs, in practice this
happens all the time, and I'm cautious. I would very much prefer
using an allocator/deallocator from the library if this exists
instead. ... okay read a bit of doc "Passing data to and from liblzma"
and it seems that they really expect us to allocate that structure
it's weird...
I think the new xzlib.c will need a header with author etc.. 
and go though indent(1) to match existing libxml2 code. but that's
something I can do...
Will look for possible feedback on your side before pushing this in any case

   thanks,

Daniel
Comment 3 Anders F Björklund 2011-11-11 10:39:51 UTC
I think the original idea upstream was to provide a stream-oriented library (called ) that would handle the *zfile scenario, without downstream duplication.
"A separate I/O library is planned, which would abstract handling of .gz, .bz2, and .xz files with an easy to use API." But that library is not done (started?)

So I made an internal (read-only) implementation of such a library for .lzma and .xz, but it would probably be better if it was handled externally... But maybe it could be made more resistant to change in the libz and liblzma libraries and their headers/structures, without being "pushed out" into an external library ?
Comment 4 Daniel Veillard 2012-01-27 14:26:02 UTC
Okay, sorry it took so long, but the good news is that I used some of
the chinese new year vacations to finish the patches cleanup and push.
This is now integrated upstream in the head branch !
W.r.t. making a separate library, I don't think that would be a great 
idea as it would make the dependancy chain even more complex,
so your approach is probably better. Check out the git, and see
if I added any mistake ! :)

Daniel