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

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

From:
karl williamson
Date:
January 7, 2014 21:58
Subject:
[perl #120950] Apparent failure to localize %^H
Message ID:
rt-4.0.18-12898-1389131914-437.120950-75-0@perl.org
# New Ticket Created by  karl williamson 
# Please include the string:  [perl #120950]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=120950 >



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 utf8_heavy.pl 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.


-----------------------------------------------------------------
---
Flags:
     category=core
     severity=medium
---
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
   Platform:
     osname=linux, osvers=2.6.35-32-generic-pae, 
archname=i686-linux-thread-multi-64int-ld
     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
   Compiler:
     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',
     cppflags='-D_REENTRANT -D_GNU_SOURCE -DPERL_BOOL_AS_CHAR 
-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include'
     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 
/usr/lib/i686-linux-gnu
     libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
     libc=/lib/libc-2.12.1.so, so=so, useshrplib=false, libperl=libperl.a
     gnulibc_version='2.12'
   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:
 
/home/khw/blead/lib/perl5/site_perl/5.19.8/i686-linux-thread-multi-64int-ld
     /home/khw/blead/lib/perl5/site_perl/5.19.8
     /home/khw/blead/lib/perl5/5.19.8/i686-linux-thread-multi-64int-ld
     /home/khw/blead/lib/perl5/5.19.8
     /home/khw/blead/lib/perl5/site_perl
     .

---
Environment for perl 5.19.8:
     HOME=/home/khw
     LANG=en_US.UTF-8
     LANGUAGE=en_US:en
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
 
PATH=/home/khw/bin:/home/khw/perl5/perlbrew/bin:/home/khw/print/bin:/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/usr/games:/home/khw/cxoffice/bin
     PERL5OPT=-w
     PERL_BADLANG (unset)
     PERL_POD_PEDANTIC=1
     SHELL=/bin/ksh




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