From Bugzilla Helper: User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5) Gecko/20031007 Description of problem: I wanted to cut apart a large file into smaller blocks using a simple Perl program: ----------------------------------------- #!/usr/bin/perl $increment = 1000*1024; $buffer = undef; $count = 0; while ($len = sysread(STDIN,$buffer,$increment)) { print "$len -> " . length($buffer); if (!defined $len) { die "System read error: $!\n"; } $name = substr("000000$count",-4,4); open(OUT,">out.$name") or die "Could not open: $!"; $written = syswrite(OUT, $buffer, $len); print " -> $written\n"; close OUT or die "Could not close: $!"; $count++; $buffer = undef; } ----------------------------------------- Running it using $ perl -w cutter.pl < largefile produces out.NNNN files of 1024000 byte in principle. On RH9.0, the resulting files have varying length. This length is for real, I checked with 'od': -rw-r--r-- 1 root root 1539448 Nov 23 12:48 out.0000 -rw-r--r-- 1 root root 1540050 Nov 23 12:48 out.0001 -rw-r--r-- 1 root root 1553310 Nov 23 12:48 out.0002 -rw-r--r-- 1 root root 1554432 Nov 23 12:48 out.0003 -rw-r--r-- 1 root root 1538554 Nov 23 12:48 out.0004 -rw-r--r-- 1 root root 1541371 Nov 23 12:48 out.0005 -rw-r--r-- 1 root root 1542505 Nov 23 12:48 out.0006 -rw-r--r-- 1 root root 1540096 Nov 23 12:48 out.0007 -rw-r--r-- 1 root root 1545507 Nov 23 12:48 out.0008 -rw-r--r-- 1 root root 1564212 Nov 23 12:48 out.0009 -rw-r--r-- 1 root root 1569600 Nov 23 12:48 out.0010 -rw-r--r-- 1 root root 1552672 Nov 23 12:48 out.0011 The length of the files is consistent from run to run. Also, the lengths seem to depend on the file contents. This has been tested on two different RH9.0 systems (both with software RAID). I also tested on a RH7.3 system: no problem -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0000 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0001 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0002 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0003 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0004 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0005 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0006 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0007 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0008 -rw-r--r-- 1 root root 1024000 Nov 23 14:55 out.0009 Version-Release number of selected component (if applicable): How reproducible: Always Steps to Reproduce: 1. Run perl program 2. Shock! Actual Results: Length of files is arbitrary but larger than it should be. Expected Results: Length of files should be 1024000. Additional info:
Ok, while looking through my notes of last year, I came accross this and having hear about them Perl Internationalization problems, I decided to test the above with 'LANG=C'. Looks like that fixes it. Is that good or bad news ;-)
RH9 is no longer supported and has been transferred to the legacy project so closing this bug. Please REOPEN only if you can reproduce this on RHEL3, RHEL4, FC3 or FC4.