Skip Menu |

This queue is for tickets about the IO-String CPAN distribution.

Report information
The Basics
Id: 2556
Status: resolved
Priority: 0/
Queue: IO-String

People
Owner: Nobody in particular
Requestors: pdenis [...] fotango.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.02
Fixed in: (no value)



Subject: Errors with some jpeg files - makes Image::Info to fail
Greetings, The problem occurs under perl 5.8 The test script below generates a message: "Malformed UTF-8 character (unexpected end of string) at /usr/lib/perl5/site_perl/5.8.0/IO/String.pm line 286." when reading the attached jpeg. This makes in turn Image::Info to fail. I may have missed an important point, but this behaviour seems dubious. Nota: no error message when using the test jpeg of Image::Info. It doesn't happen with all jpegs and the Image::Info tests do succeed. ======================== #!/usr/bin/perl use strict; use warnings; use IO::String; my $head; my $filename = 'test.jpg'; my $binary = loadfile( $filename ); my $source = IO::String->new($binary); read($source, $head, 32) == 32 or die $!; sub loadfile { my $name = shift; local $/ = undef; open FILE, $name or die $!; my $content = <FILE>; close FILE; $content; } ======================== Regards, Pierre Denis Fotango
Download test.jpg
image/jpeg 134.6k
test.jpg
Subject: Platform details
From: pdenis [...] fotango.com
These is the platform I tested on (basically it's a rh9). I've tested the previous version of IO::String with the same result. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.20-2.48smp, archname=i386-linux-thread-multi uname='linux str' config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -g -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef' useithreads=define usemultiplicity= useperlio= d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=un uselongdouble= usemymalloc=, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1)', gccosandvers='' gccversion='3.2.2 200302' intsize=e, longsize= , ptrsize=p, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long' k', ivsize=4' ivtype='long' known_ext, nvtype='double' o_nonbl', nvsize=, Off_t='', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc' l', ldflags =' -L/usr/local/lib' ldf' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil perllibs= libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libper gnulibc_version='2.3.1' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE' cccdlflags='-fPIC' ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s Unicode/Normalize XS/A' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Locally applied patches: MAINT18379 Built under linux Compiled at Feb 18 2003 22:19:53 @INC: /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .
Subject: Unicodes settings in RH
From: pdenis [...] fotango.com
The underlying reason is because RH9 sets everything as unicode by default. Hence, the binary data is read as unicode which may make IO::String to fail. This can be fixed by changing /etc/profile locale http://dev.perl.org/perl5/list-summaries/p5p-200210-5.pod.html But I think this could be fixed by adding binmode($fh) in IO::String - I'm not sure... Regards