Skip Menu |
 

This queue is for tickets about the Barcode-Code128 CPAN distribution.

Report information
The Basics
Id: 28369
Status: resolved
Priority: 0/
Queue: Barcode-Code128

People
Owner: WRW [...] cpan.org
Requestors: ANDK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.01
Fixed in: (no value)



Subject: test result negative maybe due to library skew
Download (untitled) / with headers
text/plain 2.7k
I've steppe through the debugger with the png.t test. It shows that there are minimal differences on the byte level. Probably due to differing versions of the drawing libraries involved. This leads finally to a failing test. See for yourself DB<0> f blib/lib/Barcode/Code128.pm DB<1> b 521 DB<2> c ok 1 Barcode::Code128::png(blib/lib/Barcode/Code128.pm:521): 521: return $image->png(); DB<2> r scalar context return from Barcode::Code128::png: "�PNG\cM\cJ\cZ\cJ\c@\c@\c@\cMIHDR\c@\c@\cA&\c@\c@\c@\@\cB\cC\c@\c@\c@�p2�\c@\c@\c@\cLPLTE������\c@\c@\c@�\c@\c ＀F�\c@\c@\c@�IDATX���1\cJ�0\cL\cEP�)�\cT\c]{!->BOa<�\cBݻ\cH�?e%\cO%c�\cE���|��p� ��\cRR?PO���y�\cX�\cFGkn9�O`�Ř[�\cN�(�X���j�N�\cT)R�H�\"E꟩�\c_HR_S�9�\ @wE\cWٲ/ ＀j�[�BM,룎ڤ�¤.�gu��U�>��Qٗ��eX�\cNW\cT\cC}�ؙ3�\cF\cL3��\c_��<\ c@\c@\c@\c@IEND�B" main::(t/png.t:30): print "not " unless $test eq $good; DB<2> use Devel::Peek DB<4> Dump $test SV = PVMG(0x86d5728) at 0x83817f0 REFCNT = 2 FLAGS = (PADMY,POK,pPOK) IV = 0 NV = 0 PV = 0x86dcd80 "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\1&\0\0\0@\2\3\0\0\0\312p2\272\0\0\0\fPLTE\314\314\314\377\377\377\0\0\0\377\0\0\352\335\206\357\0\0\0\251IDATX\205\355\3261\n\3030\f\5P\241)\364\24\35{!->BOa<\365\2\335\273\10\302?e%\17%c\213\5\351\360\277\301|\342\360p\214\207\10\252\362\22R?PO\213\240\231y\263\30\356\6Gkn9\220O`\210\305\230[\316\16\367(\206X\203\265\371j\344N\212\24)R\244H\221\"E\352\237\251\302\37HR_S\3149\201@wE\27\331\262/H*C\206j\326[\366\276BM,\353\243\216\332\244\204\302\244.\213gu\330\325U\313>\260\227Q\331\227\250\317eX\245\16W\24\3}\345\330\2313\362\6\f3\262\353\37\274\311<\0\0\0\0IEND\256B`\202"\0 CUR = 250 LEN = 252 DB<5> Dump $good SV = PV(0x86aaad0) at 0x85667b8 REFCNT = 2 FLAGS = (PADMY,POK,pPOK) PV = 0x86d8ac0 "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\1&\0\0\0@\2\3\0\0\0\312p2\272\0\0\0\fPLTE\314\314\314\377\377\377\0\0\0\377\0\0\352\335\206\357\0\0\0\251IDATx\234\355\3261\n\3030\f\5P\241)\364\24\35{!->BOa<\365\2\335\273\10\302?e%\17%c\213\5\351\360\277\301|\342\360p\214\207\10\252\362\22R?PO\213\240\231y\263\30\356\6Gkn9\220O`\210\305\230[\316\16\367(\206X\203\265\371j\344N\212\24)R\244H\221\"E\352\237\251\302\37HR_S\3149\201@wE\27\331\262/H*C\206j\326[\366\276BM,\353\243\216\332\244\204\302\244.\213gu\330\325U\313>\260\227Q\331\227\250\317eX\245\16W\24\3}\345\330\2313\362\6\f3\262\353<\206\346\200\0\0\0\0IEND\256B`\202"\0 CUR = 250 LEN = 252 Hope this helps,
Download (untitled) / with headers
text/plain 137b
Please log into RT and attach the PNG file that was generated when you ran the script, or email it to me as an attachment at wrw@cpan.org
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Thu, 19 Jul 2007 00:49:21 +0200
To: bug-Barcode-Code128 [...] rt.cpan.org, wrw [...] cpan.org
From: andreas.koenig.7os6VVqR [...] franz.ak.mind.de (Andreas J. Koenig)
Download (untitled) / with headers
text/plain 593b
Show quoted text
>>>>> On Wed, 18 Jul 2007 16:50:35 -0400, "William_R_Ward via RT" <bug-Barcode-Code128@rt.cpan.org> said:
Show quoted text
Show quoted text
> Please log into RT and attach the PNG file that was generated when you > ran the script, or email it to me as an attachment at wrw@cpan.org
I ran the debugger again and dumped the two variables into two files, test.png and good.png. Appended below. Checksums: % sha1sum /tmp/????.png 8b0ab57230b692a2b5e02098e69967aeaefbf4ef /tmp/good.png 490923a751110c4d475f0a972e74410b1ec9a0de /tmp/test.png HTH, -- andreas
Download test.png
image/png 250b

Message body is not shown because sender requested not to inline it.

Download good.png
image/png 250b

Message body is not shown because sender requested not to inline it.

Attached is the code128.png file from the Barcode::Code128 "t/" directory.
Download code128.png
image/png 250b
code128.png
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Wed, 18 Jul 2007 15:59:55 -0700
To: bug-Barcode-Code128 [...] rt.cpan.org
From: "Bill Ward" <bill [...] wards.net>
Download (untitled) / with headers
text/plain 1.5k
This is really a strange bug. Both of these images are different from the "code128.png" file in the distribution, and 20x as large in size too! ls -al *.png -rw-r--r-- 1 bill www-data 250 May 28 2001 code128.png -rw-rw-r-- 1 bill www-data 5510 Jul 18 15:54 good.png -rw-rw-r-- 1 bill www-data 5510 Jul 18 15:54 test.png sha1sum *.png 8b0ab57230b692a2b5e02098e69967aeaefbf4ef code128.png 8356e73624f66df2360490043688bd4ec3215077 good.png af102aec3670c483e53213650d07e440e57f4a4e test.png However I visually compared all the images and as far as I can tell they are identical. Should I include all three in the distribution? Or should I abandon the idea of including a PNG sample file at all? Can you provide more information about the specific versions of the PNG and GD libraries in use on your system? On 7/18/07, (Andreas J. Koenig) via RT <bug-Barcode-Code128@rt.cpan.org> wrote: Show quoted text
> > Queue: Barcode-Code128 > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28369 > >
> >>>>> On Wed, 18 Jul 2007 16:50:35 -0400, "William_R_Ward via RT" <bug-Barcode-Code128@rt.cpan.org> said:
> >
> > Please log into RT and attach the PNG file that was generated when you > > ran the script, or email it to me as an attachment at wrw@cpan.org
> > I ran the debugger again and dumped the two variables into two files, > test.png and good.png. Appended below. Checksums: > > % sha1sum /tmp/????.png > 8b0ab57230b692a2b5e02098e69967aeaefbf4ef /tmp/good.png > 490923a751110c4d475f0a972e74410b1ec9a0de /tmp/test.png > > HTH, > -- > andreas > > > > >
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Thu, 19 Jul 2007 07:37:13 +0200
To: bug-Barcode-Code128 [...] rt.cpan.org
From: andreas.koenig.7os6VVqR [...] franz.ak.mind.de (Andreas J. Koenig)
Download (untitled) / with headers
text/plain 2.8k
Show quoted text
>>>>> On Wed, 18 Jul 2007 19:00:38 -0400, "Bill Ward via RT" <bug-Barcode-Code128@rt.cpan.org> said:
Show quoted text
Show quoted text
> This is really a strange bug. Both of these images are different from > the "code128.png" file in the distribution, and 20x as large in size > too!
Show quoted text
> ls -al *.png > -rw-r--r-- 1 bill www-data 250 May 28 2001 code128.png > -rw-rw-r-- 1 bill www-data 5510 Jul 18 15:54 good.png > -rw-rw-r-- 1 bill www-data 5510 Jul 18 15:54 test.png
Show quoted text
> sha1sum *.png > 8b0ab57230b692a2b5e02098e69967aeaefbf4ef code128.png > 8356e73624f66df2360490043688bd4ec3215077 good.png > af102aec3670c483e53213650d07e440e57f4a4e test.png
Show quoted text
> However I visually compared all the images and as far as I can tell > they are identical. Should I include all three in the distribution? > Or should I abandon the idea of including a PNG sample file at all?
Feel free to include both, it would get you a cheap quick fix. But comparing images byte by byte will throw false errors from time to time. So you would have to collect more and more valid examples over time. A better fix would be to resize them to one size, calculate the difference, take the average color and decide about a threshold over which this average must not go. This is quite easy with imagemagick, don't know about other tools. Show quoted text
> Can you provide more information about the specific versions of the > PNG and GD libraries in use on your system?
This may or may not be helpful to you, for me it is a jungle: # apt-show-versions | egrep 'libgd|libpng' libgd2-dev 2.0.33-2 installed: No available version in archive libgdbmg1/testing uptodate 1.7.3-28 libpng10-0 1.0.18-1 installed: No available version in archive libgd2 2.0.33-2 installed: No available version in archive libpng2 1.0.18-1 installed: No available version in archive libgd-perl/stable uptodate 1.41-13 libgd-graph-perl/testing uptodate 1.43.08-2.1 libgd2-xpm-dev/testing upgradeable from 2.0.33-5.2 to 2.0.34-1 libpng12-0/testing upgradeable from 1.2.15~beta5-1 to 1.2.15~beta5-2 libpng12-dev/testing upgradeable from 1.2.15~beta5-1 to 1.2.15~beta5-2 libgdbm3/testing uptodate 1.8.3-3 libpng3/testing upgradeable from 1.2.15~beta5-1 to 1.2.15~beta5-2 libgd1-xpm/stable uptodate 1.8.4.debian-1 libgd-gd1-perl/stable uptodate 1.41-13 libgdbm-dev/testing uptodate 1.8.3-3 libgd-text-perl/testing upgradeable from 0.86-2 to 0.86-3.1 libgd2-xpm/testing upgradeable from 2.0.33-5.2 to 2.0.34-1 % /home/src/perl/repoperls/installed-perls/*/p*/perl-5.*@31623/bin/module_info GD Name: GD Version: 2.35 Directory: /home/src/perl/repoperls/installed-perls/perl/plaxoaY/perl-5.8.0@31623/lib/site_perl/5.9.5/i686-linux-64int File: /home/src/perl/repoperls/installed-perls/perl/plaxoaY/perl-5.8.0@31623/lib/site_perl/5.9.5/i686-linux-64int/GD.pm Core module: no -- andreas
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Thu, 19 Jul 2007 09:57:00 -0700
To: bug-Barcode-Code128 [...] rt.cpan.org
From: "Bill Ward" <bill [...] wards.net>
I don't think I want to introduce a dependency on ImageMagick.
CC: ANDK [...] cpan.org
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Fri, 20 Jul 2007 08:21:17 +0200
To: bug-Barcode-Code128 [...] rt.cpan.org
From: andreas.koenig.7os6VVqR [...] franz.ak.mind.de (Andreas J. Koenig)
Download (untitled) / with headers
text/plain 1.6k
Show quoted text
>>>>> On Thu, 19 Jul 2007 12:57:18 -0400, "Bill Ward via RT" <bug-Barcode-Code128@rt.cpan.org> said:
Show quoted text
Show quoted text
> I don't think I want to introduce a dependency on ImageMagick.
Of course not, this was not my suggestion. What I wanted to say perhaps was: maybe, just maybe, this could be a way to turn the test into something more robust. To have something more robust does not necessarily mean that you want to force everybody to do it. Maybe you could simply skip a modified/better test if it needs something like IM. I just wanted to show a way out against the "we're going to collect any possible representation of an image". Sorry if my intentions did not get through. So just to make clear what I wanted to say, I thought of something like this: if (eval { require Image::Magick; 1; }){ my $goodim = Image::Magick->new; $goodim->BlobToImage($good); my $testim = Image::Magick->new; $testim->BlobToImage($test); my($goodw,$goodh) = $goodim->Get("width","height"); $testim->Resize(geometry => sprintf("%sx%s",$goodw,$goodh),filter=>"Triangle"); # sharp $goodim->Composite(image=>$testim, compose=>"Difference"); $goodim->Resize(geometry => "3x3", filter=>"Cubic"); # blurred $goodim->Quantize(colorspace=>'gray'); my($red) = split /,/, $goodim->Get("pixel[1,1]"); ok($red <= 2, "only tiny differences"); } else { skip(1); } This is probably faster to write and easier to maintain in GD than in IM because every version of IM seems to change a tiny aspect of the interface. But it's easier to think through in IM because it is quite expressive. -- andreas
Download (untitled) / with headers
text/plain 358b
On Fri Jul 20 02:21:41 2007, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote: Show quoted text
> >>>>> On Thu, 19 Jul 2007 12:57:18 -0400, "Bill Ward via RT" <bug-
> Barcode-Code128@rt.cpan.org> said: > >
GD has a compare method, which does not compare on a byte-by-byte level (which would fail on compression differences). See the attached patch. Regards, Slaven
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up '/var/tmp/CPAN-build/Barcode-Code128-2.01-vpJVaY/t/png.t' 'Barcode-Code128-2.01/t/png.t' Index: ./t/png.t --- ./t/png.t Mon May 28 23:42:51 2001 +++ ./t/png.t Thu Jul 3 07:50:00 2008 @@ -19,13 +19,21 @@ exit unless $max; use strict; my $code = new Barcode::Code128; my $file = "t/code128.png"; -my $good; -{ - open IM, $file or die "Can't read $file: $!"; - binmode IM; - read IM, $good, -s $file; - close IM; -} +my $expected_image = GD::Image->new($file); + my $test = $code->png("CODE 128"); -print "not " unless $test eq $good; +my $got_image = GD::Image->new($test); + +my $cmp = $expected_image->compare($got_image); +print "not " if $cmp != 0; print "ok 2\n"; + +if ($cmp & &GD::GD_CMP_IMAGE) { warn "The two images look different\n" } +if ($cmp & &GD::GD_CMP_NUM_COLORS) { warn "The two images have different numbers of colors\n"} +if ($cmp & &GD::GD_CMP_COLOR) { warn "The two images' palettes differ\n"} +if ($cmp & &GD::GD_CMP_SIZE_X) { warn "The two images differ in the horizontal dimension\n"} +if ($cmp & &GD::GD_CMP_SIZE_Y) { warn "The two images differ in the vertical dimension\n"} +if ($cmp & &GD::GD_CMP_TRANSPARENT) { warn "The two images have different transparency\n"} +if ($cmp & &GD::GD_CMP_BACKGROUND) { warn "The two images have different background colors\n"} +if ($cmp & &GD::GD_CMP_INTERLACE) { warn "The two images differ in their interlace\n"} +if ($cmp & &GD::GD_CMP_TRUECOLOR) { warn "The two images are not both true color\n"} #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Thu Jul 3 07:50:56 2008 # Generated by : makepatch 2.03 # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 't/png.t' 679 1215064200 0100755 #### End of ApplyPatch data #### #### End of Patch kit [created: Thu Jul 3 07:50:56 2008] #### #### Patch checksum: 68 2761 55017 #### #### Checksum: 86 3385 41013 ####
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Thu, 3 Jul 2008 17:29:52 -0700
To: bug-Barcode-Code128 [...] rt.cpan.org
From: "Bill Ward" <bill [...] wards.net>
Download (untitled) / with headers
text/plain 591b
On Wed, Jul 2, 2008 at 10:53 PM, Slaven_Rezic via RT <bug-Barcode-Code128@rt.cpan.org> wrote: Show quoted text
> Queue: Barcode-Code128 > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28369 > > > On Fri Jul 20 02:21:41 2007, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
>> >>>>> On Thu, 19 Jul 2007 12:57:18 -0400, "Bill Ward via RT" <bug-
>> Barcode-Code128@rt.cpan.org> said: >> >>
> > GD has a compare method, which does not compare on a byte-by-byte level > (which would fail on compression differences). See the attached patch.
That's wonderful news!! Thanks. I'll give that a try.
From: ricmarques [...] spamcop.net
Hi, On Wed, Jul 2, 2008, Slaven_Rezic via RT <bug-Barcode-Code128@rt.cpan.org> wrote: Show quoted text
> Queue: Barcode-Code128 > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=28369 > > > GD has a compare method, which does not compare on a byte-by-byte > level(which would fail on compression differences). See the attached > patch.
... and on Thu Jul 03 2008, bill@wards.net replied: Show quoted text
> That's wonderful news!! Thanks. I'll give that a try.
Are there any news regarding applying this patch to Barcode::Code128 ? I'm installing Koha 3.0 - http://www.koha.org - in a web server running Linux (openSUSE 11.0), and Koha requires the installation of the Barcode::Code128 Perl module. The installation from CPAN fails as reported: t/barcode....ok t/gif........ok 1/0skipped all skipped: no reason given t/png........FAILED test 2 Failed 1/2 tests, 50.00% okay I know that I could do a "force install" of this module, but I would like to avoid that, if possible. Could you give some feedback, please? Thanks in advance. Best wishes, Ricardo Dias Marques ricmarques AT spamcop DOT net
Subject: Re: [rt.cpan.org #28369] test result negative maybe due to library skew
Date: Wed, 12 Nov 2008 06:47:53 -0800
To: bug-Barcode-Code128 [...] rt.cpan.org
From: "Bill Ward" <bill [...] wards.net>
Download (untitled) / with headers
text/plain 356b
Show quoted text
> > Are there any news regarding applying this patch to Barcode::Code128 ? > I'm installing Koha 3.0 - http://www.koha.org - in a web server running > Linux (openSUSE 11.0), and Koha requires the installation of the > Barcode::Code128 Perl module. The installation from CPAN fails as reported: >
Thanks for the reminder - I will try to get this out soon.
From: ricmarques [...] spamcop.net
Download (untitled) / with headers
text/plain 631b
Hi Bill, Today (12-Nov-2008) I had asked: Show quoted text
> > Are there any news regarding applying this patch to > > Barcode::Code128? > > I'm installing Koha 3.0 - http://www.koha.org - in a web server > > running Linux (openSUSE 11.0), and Koha requires the installation > > of the Barcode::Code128 Perl module. > > The installation from CPAN fails as reported:
... to which, on the same day, Bill Wards (bill AT wards.net)replied: Show quoted text
> Thanks for the reminder - I will try to get this out soon.
You're welcome. Thank you very much for the lightning fast answer! :) Best wishes, Ricardo Dias Marques ricmarques AT spamcop DOT net
should be fixed in 2.21


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.