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 127015 - rpm2cpio breaks with UTF-8 locale (RH9 outa the box)
rpm2cpio breaks with UTF-8 locale (RH9 outa the box)
Status: RESOLVED FIXED
Product: GARNOME
Classification: Deprecated
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jeff Waugh
garnome list
Depends on:
Blocks:
 
 
Reported: 2003-11-14 21:54 UTC by ariel
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description ariel 2003-11-14 21:54:55 UTC
garnome 0.27.1 
rpm2cpio perl script breaks if you are using a locale
(LANG, LANGUAGE, etc.) with UTF-8 in the string.  Perl
invokes the <:utf8> layer for all open()s and so the first
read of 96 characters will be a read of some larger number 
of bytes... because a few 2-byte sequences happen to be 
legitimate utf-8 encodings. This means that no header 
will be found and rpm2cpio barfs.

The fix is to set binmode on both input and output streams:

54c54,55
<   open(F, "< $ARGV[0]") or die "Can't read file $ARGV[0]\n";
---
>   open(F, '<', "$ARGV[0]") or die "Can't read file $ARGV[0]\n";
>   binmode(F);
102a104
> binmode(ZCAT);

Note that I checked this only for perl 5.8 and have no idea 
what happens with perl 6.x.
Comment 1 Paul Drain 2004-09-20 02:00:43 UTC
Agreed.

Patch has been applied in both GARNOME trees.