# New Ticket Created by Tim Bunce
# Please include the string: [perl #72942]
# in the subject line of all future correspondence about this issue.
# <URL:
http://rt.perl.org/rt3/Ticket/Display.html?id=72942 >
This is a bug report for perl from [email protected: Tim...@pobox.com]
generated with the help of perlbug 1.39 running under perl 5.10.1.
-----------------------------------------------------------------
[Please describe your issue here]
Basic operations on unicode strings don't work inside a Safe compartment:
perl -MSafe -MOpcode=full_opset -e '$a=Safe->new; $a->permit(full_opset()); $a->reval(q{ pack("U",0xC4) =~ /\\xE4/i; 1 }) or die $@ '
Undefined subroutine Safe::Root0::utf8::SWASHNEW called at (eval 5) line 1
Recent (unrelated) changes to Safe have exposed this problem in PostgreSQL
PL/Perl (a high-profile user of Safe). See the pgsql-bugs message
http://archives.postgresql.org/pgsql-bugs/2010-02/msg00163.phpand the following thread.
The thread includes an outline of what I've learnt from my investigation into
the issue.
I developed a patch to Safe that works around the issue by only sharing
utf8::SWASHNEW *iff* utf8 is loaded (unconditional sharing doesn't work,
see thread).
On reflection though, I think it would be better for Safe to simply *always*
require utf8 (and ensure utf8_heavy.pl is run) so it can always share
utf8::SWASHNEW. That's not only cleaner because it hides the implementation
details of perl unicode, but it also fixes the PostgreSQL problem.
I'll followup this post with a patch that does that.
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=library
severity=high
---
Site configuration information for perl 5.10.1:
Configured by timbo at Fri Feb 5 17:36:03 GMT 2010.
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
Commit id: 5348debf9fd57fc15c26529386769684fab96e57
Platform:
osname=darwin, osvers=10.2.0, archname=darwin-thread-multi-2level
uname='darwin timac.local 10.2.0 darwin kernel version 10.2.0: tue nov 3 10:37:10 pst 2009; root:xnu-1486.2.11~1release_i386 i386 '
config_args='-des -Doptimize=-g -DEBUGGING=both -Accflags=-DDEBUG_LEAKING_SCALARS -Dusethreads -Dusemultiplicity -Duseshrplib -Dusedevel -Uversiononly -Dprefix=/Users/timbo/pg/perl5101'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
optimize='-g',
cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -DDEBUG_LEAKING_SCALARS -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
libpth=/usr/local/lib /opt/local/lib /usr/lib
libs=-lgdbm -ldbm -ldl -lm -lutil -lc
perllibs=-ldl -lm -lutil -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'
Locally applied patches:
---
@INC for perl 5.10.1:
/Users/timbo/pg/perl5101/lib/5.10.1/darwin-thread-multi-2level
/Users/timbo/pg/perl5101/lib/5.10.1
/Users/timbo/pg/perl5101/lib/site_perl/5.10.1/darwin-thread-multi-2level
/Users/timbo/pg/perl5101/lib/site_perl/5.10.1
.
---
Environment for perl 5.10.1:
DYLD_LIBRARY_PATH=/usr/local/jogl-2.0-macosx-universal/lib::/opt/local/lib/mysql5/mysql:/Users/timbo/perl6/parrot/blib/lib
HOME=/Users/timbo
LANG=en_IE.UTF-8
LANGUAGE (unset)
LC_ALL=en_IE.UTF-8
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/usr/local/pgsql/bin:/Users/timbo/pg/perl5101/bin:/Users/timbo/pg/perl5100/bin:/Users/timbo/pg/perl598/bin:/Users/timbo/pg/perl5088/bin:/usr/local/bin:/opt/local/bin:/usr/bin:/bin:/opt/local/sbin:/usr/sbin:/sbin:/Users/timbo/bin
PERLCRITIC=/Users/timbo/.setdev/perlcriticrc
PERLTIDY=/Users/timbo/.setdev/perltidyrc
PERL_BADLANG (unset)
SHELL=/bin/bash