Bug#430805: The problem is caused by Image::LibRSVG-isGzCompressionSupported

2007-07-03 Thread Niko Tyni
On Wed, Jun 27, 2007 at 12:03:20PM -0500, Gunnar Wolf wrote:

 ...I reproduced it - the problem is that $rsvg-loadImage with a
 svg.gz triggers a segfault, and all the tests from that point on don't
 get executed at all. Just to illustrate, from the source tree, just
 after the build died (hence with the compiled module in blib/):
 
 $ perl -Iblib/lib -Iblib/arch -e 'use Image::LibRSVG; 
 $rsvg=Image::LibRSVG-new; print 
 $rsvg-loadImage(examples/artscontrol.svg.gz)'
 
 triggers basically the same message as the one reported in the
 bug. 

The regression here is that libgsf 1.114.4-1 introduced changes
that broke applications not calling gsf_init() and using 'dynamic'
stream types like gzipped input.

This is #431104, and I'll send more details there.

In this case, libgsf is used by librsvg, which calls gsf_init() from
rsvg_init(). So instead of disabling .svgz support, we should just call
rsvg_init() from the constructor. Patch attached; this fixes the test
failures for me.

I'll forward this upstream as well.

 Now, the faulty function seems to be
 Image::LibRSVG-isGzCompressionSupported - In fact, it is not even
 documented, and the build does not depend on (nor ever mention)
 Perl's Compress::Zlib or C's zlib. This function is not even
 documented in the POD or used anywhere else in the code:

I think Image::LibRSVG-isGzCompressionSupported() is just an internal
function to make it easier to disable .svgz support if needed. The zlib
linkage comes from libgsf through librsvg.

Cheers,
-- 
Niko Tyni   [EMAIL PROTECTED]
--- LibRSVG.xs	2007/07/03 07:05:37	1.1
+++ LibRSVG.xs	2007/07/03 07:05:52
@@ -383,6 +383,7 @@
 CODE:
 Newz(0, RETVAL, 1, SVGLibRSVG);
 RETVAL-pixbuf = NULL;
+rsvg_init();
 OUTPUT:
 RETVAL
 


Bug#430805: The problem is caused by Image::LibRSVG-isGzCompressionSupported

2007-06-27 Thread Gunnar Wolf
tags 430805 + patch
thanks

...Or so I guess ;-) According to the build log:

Failed Test Stat Wstat Total Fail  Failed  List of Failed
---
t/1.t  01127   10  37.04%  23-27

Now, tests 23 and 24 are only run when we have compression support -
From t/1.t, starting at line 60:

## if we use z-lib let's give it a try
if( Image::LibRSVG-isGzCompressionSupported() ) {
ok( $rsvg-loadImage( examples/artscontrol.svg.gz ) );
ok( $rsvg-saveAs( examples/test.png ) );
} else {
ok(1);
ok(1);
}

...I reproduced it - the problem is that $rsvg-loadImage with a
svg.gz triggers a segfault, and all the tests from that point on don't
get executed at all. Just to illustrate, from the source tree, just
after the build died (hence with the compiled module in blib/):

$ perl -Iblib/lib -Iblib/arch -e 'use Image::LibRSVG; 
$rsvg=Image::LibRSVG-new; print 
$rsvg-loadImage(examples/artscontrol.svg.gz)'

triggers basically the same message as the one reported in the
bug. Now, the faulty function seems to be
Image::LibRSVG-isGzCompressionSupported - In fact, it is not even
documented, and the build does not depend on (nor ever mention)
Perl's Compress::Zlib or C's zlib. This function is not even
documented in the POD or used anywhere else in the code:

$ grep -r isGzCompr .|grep -v svn
./t/1.t:if( Image::LibRSVG-isGzCompressionSupported() ) {
./LibRSVG.xs:SVGLibRSVG::isGzCompressionSupported()
./Changes:   - added new function isGzCompressionSupported to check if 
gzipped files can be passed

And anyway, in the XS, line 454, it is hardcoded to answer yes:

static bool
SVGLibRSVG::isGzCompressionSupported()
CODE:
RETVAL = 1;
OUTPUT:
RETVAL

In fact, changing the 1 to a 0 makes the build work. So, the diff is a
baffling: 

Index: LibRSVG.xs
===
--- LibRSVG.xs  (revision 5662)
+++ LibRSVG.xs  (working copy)
@@ -455,7 +455,7 @@
 static bool
 SVGLibRSVG::isGzCompressionSupported()
 CODE:
-RETVAL = 1;
+RETVAL = 0;
 OUTPUT:
 RETVAL

I'm not uploading this, as I'm unfamiliar with the code and I might be
just breaking it. Please, if you use this package, test it and tell
me if it should be uploaded (or upload yourself if you prefer, of
course ;-) ) 

Greetings

-- 
Gunnar Wolf - [EMAIL PROTECTED] - (+52-55)5623-0154 / 1451-2244
PGP key 1024D/8BB527AF 2001-10-23
Fingerprint: 0C79 D2D1 2C4E 9CE4 5973  F800 D80E F35A 8BB5 27AF


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]