Click here to get back home

Process to fix a broken CPAN module?

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Process to fix a broken CPAN module? google 05-06-2008
Posted by google on May 6, 2008, 2:43 am
Please log in for more thread options
I have found a major flaw in a CPAN package. The package is
File::Binary and it has big endian and little endian unpack-ing
backwards. Likewise, all the test files are reversed so that the
tests all pass!

Why do I believe this is true?

From the perl manual on pack:
n,N unpacks a 16 or 32 bit integer in "network" or big endian order
v,V unpacks a 16 or 32 bit integer in "VAX" or little endian order

From the code:
if ($endian == $BIG_ENDIAN) {
$self-> = 'v';
$self-> = 'V';
} else {
$self-> = 'n';
$self-> = 'N';
}

When I 'od -x' the test files, they are clearly reversed:

od -x be.power10.n32.ints
0000000 ffff ffff f6ff ffff 9cff ffff 18fc
ffff
0000020 f0d8 ffff 6079 feff c0bd f0ff 8069
67ff
0000040 001f 0afa 0036 65c4

From the test file ".../File-Binary-1.7/t/17power10.n32.ints.be.t":
is($bin->get_si32(),-1); # 0xffffffff in B.E.
is($bin->get_si32(),-10); # 0xfffffff6 in B.E.
is($bin->get_si32(),-100); # 0xffffff9c in B.E.
is($bin->get_si32(),-1000); # 0xffff18fc in B.E.

so clearly this file contains little-endian integers.

OK, so there is a mistake here -- I would like to submit a fix to all
this -- my question is how do I go about doing this? I have contacted
the author, but no response.

Any help/guidance would be appreciated. When I get this fixed, then
I'll be able to submit my new module to CPAN (my first attempt).

Thanks!

Posted by Jens Thoms Toerring on May 6, 2008, 4:59 am
Please log in for more thread options
google@obmac.org wrote:
> I have found a major flaw in a CPAN package. The package is
> File::Binary and it has big endian and little endian unpack-ing
> backwards. Likewise, all the test files are reversed so that the
> tests all pass!

> Why do I believe this is true?

> From the perl manual on pack:
> n,N unpacks a 16 or 32 bit integer in "network" or big endian order
> v,V unpacks a 16 or 32 bit integer in "VAX" or little endian order

> From the code:
> if ($endian == $BIG_ENDIAN) {
> $self-> = 'v';
> $self-> = 'V';
> } else {
> $self-> = 'n';
> $self-> = 'N';
> }

> When I 'od -x' the test files, they are clearly reversed:

> od -x be.power10.n32.ints
> 0000000 ffff ffff f6ff ffff 9cff ffff 18fc

I hope you do realize that 'od -x' does reverse the bytes when
used on a little endian system. Just create a file that only
contains two letter, e.g. first 'a' and then 'b'. Now look at
the file with 'od -x' and you will find (at least if you're
on a little endian system)

0000000 6261

i.e. the 'b' seems to come first and only then the 'a'.
That's because the '-x' option makes od deal with two
bytes at once. If you want to see what's really in the
file in a byte-by-byte fashion use instead

od -t x1 filename

(or e.g. load the file into emacs and switch to hexl-mode).

> OK, so there is a mistake here -- I would like to submit a fix to all
> this -- my question is how do I go about doing this? I have contacted
> the author, but no response.

It looks as if the module is actively maintained (the last
version was uploaded on Aril 1st, 2008). How long did you
give the author to reply? Did you consider that he could
be on vacation and not able to read emails at the moment?

Best regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de

Posted by rthangam on May 6, 2008, 8:14 am
Please log in for more thread options


Jens Thoms Toerring wrote:
> google@obmac.org wrote:
> > I have found a major flaw in a CPAN package. The package is
> > File::Binary and it has big endian and little endian unpack-ing
> > backwards. Likewise, all the test files are reversed so that the
> > tests all pass!
>
> > Why do I believe this is true?
>
> > From the perl manual on pack:
> > n,N unpacks a 16 or 32 bit integer in "network" or big endian order
> > v,V unpacks a 16 or 32 bit integer in "VAX" or little endian order
>
> > From the code:
> > if ($endian == $BIG_ENDIAN) {
> > $self-> = 'v';
> > $self-> = 'V';
> > } else {
> > $self-> = 'n';
> > $self-> = 'N';
> > }
>
> > When I 'od -x' the test files, they are clearly reversed:
>
> > od -x be.power10.n32.ints
> > 0000000 ffff ffff f6ff ffff 9cff ffff 18fc
>
> I hope you do realize that 'od -x' does reverse the bytes when
> used on a little endian system. Just create a file that only
> contains two letter, e.g. first 'a' and then 'b'. Now look at
> the file with 'od -x' and you will find (at least if you're
> on a little endian system)
>
> 0000000 6261
>
> i.e. the 'b' seems to come first and only then the 'a'.
> That's because the '-x' option makes od deal with two
> bytes at once. If you want to see what's really in the
> file in a byte-by-byte fashion use instead
>
> od -t x1 filename
>
> (or e.g. load the file into emacs and switch to hexl-mode).
>
> > OK, so there is a mistake here -- I would like to submit a fix to all
> > this -- my question is how do I go about doing this? I have contacted
> > the author, but no response.
>
> It looks as if the module is actively maintained (the last
> version was uploaded on Aril 1st, 2008). How long did you
> give the author to reply? Did you consider that he could
> be on vacation and not able to read emails at the moment?
>
> Best regards, Jens
> --
> \ Jens Thoms Toerring ___ jt@toerring.de
> \__________________________ http://toerring.de


Which CPAN module are you taking about ?. Every CPAN module has a link
'Report a bug' where you can log a bug. Try it out may be you might
get some response

Similar ThreadsPosted
Trying to install module with CPAN December 4, 2004, 12:27 pm
Trying to install module with CPAN December 5, 2004, 1:35 pm
FAQ 8.45 How do I install a module from CPAN? March 18, 2005, 6:03 am
FAQ 8.45 How do I install a module from CPAN? June 10, 2005, 5:03 am
FAQ 8.45 How do I install a module from CPAN? September 12, 2005, 10:03 pm
FAQ 8.45 How do I install a module from CPAN? November 20, 2005, 5:03 am
question about cpan module October 17, 2006, 3:22 pm
How do I specify @INC during CPAN module installation? December 5, 2006, 10:31 pm
FAQ 8.45 How do I install a module from CPAN? March 23, 2007, 9:03 pm
FAQ 8.45 How do I install a module from CPAN? June 8, 2007, 3:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap