Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 78588

Summary: hang while reading a file in UTF-8 mode
Product: [Retired] Red Hat Linux Reporter: Christopher Blizzard <blizzard>
Component: perlAssignee: Warren Togami <wtogami>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0CC: mitr, pcormier
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-11 11:47:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
test script
none
test data none

Description Christopher Blizzard 2002-11-26 01:02:33 UTC
Description of Problem:

Hang when reading a UTF-8 file.

Version-Release number of selected component (if applicable):

perl-5.8.0-55

How Reproducible:

Every time.

Steps to Reproduce:
1. Use attached script and file.
2. Run script.

Actual Results:

Script hangs.

Expected Results:

Script should complete.

Additional Information:
	
This hangs in the line:

while (<FOO>)

so it's hanging while reading data from the file.

Comment 1 Christopher Blizzard 2002-11-26 01:07:34 UTC
Created attachment 86426 [details]
test script

Comment 2 Christopher Blizzard 2002-11-26 01:08:07 UTC
Created attachment 86427 [details]
test data

Comment 3 Christopher Blizzard 2002-11-26 01:21:13 UTC
This is preventing me from getting mozilla translations in for our translations
team.

Comment 4 Christopher Blizzard 2002-11-26 02:34:49 UTC
Seems to be getting stuck here:

#0  0x400eace4 in Perl_is_utf8_char ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#1  0x400eadf6 in Perl_is_utf8_string ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#2  0x4009b97f in Perl_sv_utf8_decode ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#3  0x400f04cf in XS_utf8_decode ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#4  0x400958c5 in Perl_pp_entersub ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#5  0x4008e059 in Perl_runops_standard ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#6  0x40036139 in S_call_body ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#7  0x40036047 in Perl_call_sv ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#8  0x400359f6 in Perl_call_method ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#9  0x40125fa9 in PerlIOEncode_fill ()
   from
/usr/lib/perl5/5.8.0/i386-linux-thread-multi/auto/PerlIO/encoding/encoding.so
#10 0x400f3c38 in Perl_PerlIO_fill ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
---Type <return> to continue, or q <return> to quit---
#11 0x400f447f in PerlIOBase_read ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#12 0x400f6129 in PerlIOBuf_read ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#13 0x400f38e6 in Perl_PerlIO_read ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#14 0x400f7bc2 in PerlIO_getc ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#15 0x400a03a7 in Perl_sv_gets ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#16 0x40092012 in Perl_do_readline ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#17 0x4008ebd2 in Perl_pp_readline ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#18 0x4008e059 in Perl_runops_standard ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#19 0x400355bb in S_run_body ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#20 0x40035355 in perl_run ()
   from /usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE/libperl.so
#21 0x08049173 in main ()
#22 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6


Comment 5 Chip Turner 2002-11-30 00:59:00 UTC
I'll submit this upstream, looks like a pretty definite and nasty bug.  In the
meantime, can you try this workaround?  instead of using binmode, open the file
in utf8 encoding:

open (FOO, "<:utf8", "contentAreaCommands.dtd") || die();

alternatively, if LANG is set to something resembling utf8, perl will default to
utf8 IO

Comment 6 Christopher Blizzard 2002-12-02 18:09:43 UTC
Using :utf8 works.  Thanks!

The encoding() example is actually from the perl documentation.

Comment 7 Chip Turner 2002-12-15 23:18:01 UTC
try rawhide's perl; it should fix your original problem (workaround should still
work, too, of course)