develooper Front page | perl.perl5.porters | Postings from January 2014

[perl #120950] Apparent failure to localize %^H

karl williamson
January 7, 2014 21:58
[perl #120950] Apparent failure to localize %^H
Message ID:
# New Ticket Created by  karl williamson 
# Please include the string:  [perl #120950]
# in the subject line of all future correspondence about this issue. 
# <URL: >

This is a bug report for perl from khw@karl.(none),
generated with the help of perlbug 1.39 running under perl 5.19.8.

Thanks to Matthew Horsfall for helping diagnose this

This program:

     use Data::Dumper;
     my $x;
     #my $y = uc(chr(256));
     BEGIN { $x = \%^H; }
     print Dumper($x);

     sub { tr/\x{345}/\x{370}/ }

prints out

     $VAR1 = {
               'reflags' => 0,
               'reflags_charset' => 4

If the commented line is uncommented-out, it instead prints

     $VAR1 = {};

What is happening is that $x points to the hints hash at compile time, 
and tr/\x{100}/\x{200} happens at compile time, but after the BEGIN 
block has executed.  So $x continues to hold a reference and the tr// 
modifies what it points to.  What it points to is items from the 'use re 
"/aa"' called by which is called by the tr///.

The 'uc', if included, causes utf8_heavy to run before the tr/// calls 
it.  And subsequent utf8_heavy calls don't exhibit the problem.  Thus 
there appears to be some initialization that is skipped on subsequent 
utf8_heavy calls.

It seems to me that the hints hash is not getting localized properly. 
(Matthew allows for the possibly that it is not a bug, but bizarre 
action at a distance.)

Reordering the tests in B::Deparse.t causes this to show up.  The order 
they are currently in in blead masks the issue, just as the 'uc' in the 
program above does.

Site configuration information for perl 5.19.8:

Configured by khw at Tue Jan  7 07:43:12 MST 2014.

Summary of my perl5 (revision 5 version 19 subversion 8) configuration:
   Commit id: 6efa4e81fc0ed6e9f7c2d9da5f6b394809f24bb3
     osname=linux, osvers=2.6.35-32-generic-pae, 
     uname='linux karl 2.6.35-32-generic-pae #67-ubuntu smp mon mar 5 
21:23:19 utc 2012 i686 gnulinux '
     config_args='-des -Dprefix=/home/khw/blead -Dusedevel 
-D'optimize=-ggdb3' -A'optimize=-ggdb3' -A'optimize=-O0' 
-Accflags='-DPERL_BOOL_AS_CHAR' -Dman1dir=none -Dman3dir=none 
-DDEBUGGING -Dcc=g++ -Dusemorebits -Dusethreads'
     hint=recommended, useposix=true, d_sigaction=define
     useithreads=define, usemultiplicity=define
     use64bitint=define, use64bitall=undef, uselongdouble=define
     usemymalloc=n, bincompat5005=undef
     cc='g++', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DPERL_BOOL_AS_CHAR 
-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
     optimize=' -ggdb3 -O0',
-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector 
     ccversion='', gccversion='4.4.5', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
     ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, 
Off_t='off_t', lseeksize=8
     alignbytes=4, prototype=define
   Linker and Libraries:
     ld='g++', ldflags =' -fstack-protector -L/usr/local/lib'
     libpth=/usr/local/lib /lib/../lib /usr/lib/../lib /lib /usr/lib 
     libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
   Dynamic Linking:
     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
     cccdlflags='-fPIC', lddlflags='-shared -ggdb3 -ggdb3 -O0 
-L/usr/local/lib -fstack-protector'

@INC for perl 5.19.8:

Environment for perl 5.19.8:
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PERL_BADLANG (unset)
     SHELL=/bin/ksh Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About