develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #116907] perl doesn't handle m{}g for >= 2GB files even with largefiles and 64bitall

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
July 20, 2013 18:06
Subject:
[perl #116907] perl doesn't handle m{}g for >= 2GB files even with largefiles and 64bitall
Message ID:
rt-3.6.HEAD-25042-1374343551-1396.116907-15-0@perl.org
On Sat Feb 23 15:25:15 2013, jhi wrote:
> To replicate one way is to first generate a big XML file:
> 
> perl -e 'for (0..2**27){print "<id>$_</id>\n"}' > big.xml
> 
> This generates a (rather boring) XML of 2439025741 bytes, safely north 
> of 2**31 bytes.
> 
> This works, printing "--0--\n" etc.:
> 
> dd if=big.xml bs=1048576 count=2047 | perl -wlne 'BEGIN{undef $/};print
> length;while(m{<id>(.+?)</id>}g){print "--$1--"}'|head
> 
> This doesn't, the only thing output from perl is the length():
> 
> dd if=big.xml bs=1048576 count=2048 | perl -wlne 'BEGIN{undef $/};print
> length;while(m{<id>(.+?)</id>}g){print "--$1--"}'|head
> 
> I originally had m{}gs since I was looking for multiline things but 
> managed to shave it down to this.
> 
> Verified to happen in 5.16.2 (in Ubuntu Precise Pangolin) x86_64, and in 
> bleadperl in whatever is the latest OS X.  In both cases:
> 
> useperlio=define,uselargefiles=define,use64bitint=define,
use64bitall=define
> 

I think this demonstrates the problem more clearly:

$ ./perl -lIlib -e '$x=" "x(2**31+20); pos $x = 2**31-5; for(1..10){
print pos $x; ++pos $x}'
2147483643
2147483644
2147483645
2147483646
2147483647

1
2
3
4


-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=116907

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About