Skip Menu |
Report information
Id: 33752
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: nicholas <nick [at] ccl4.org>
Cc:
AdminCc:

Operating System: All
PatchStatus: HasPatch
Severity: low
Type:
Perl Version: 5.9.2
Fixed In: (no value)



Subject: B::Deparse fails with utf8 and our
Date: Mon, 10 Jan 2005 22:58:44 +0000
To: perlbug [...] perl.org
From: Nicholas Clark <nick [...] etla.org>
Download (untitled) / with headers
text/plain 3.5k
This is a bug report for perl from nick@ccl4.org, generated with the help of perlbug 1.35 running under perl v5.9.2. ----------------------------------------------------------------- [Please enter your report here] ./perl -Ilib -MO=Deparse born While deparsing born near line 3, Unexpected our($人) CHECK failed--call queue aborted. born is one of the examples from t/run/freshperl.t use strict; use utf8; our $人 = 2; # 0xe4 0xba 0xba: U+4eba, "human" in CJK ideograph $人++; # a child is born print $人, "\n"; I assume that Deparse should be able to handle it. Nicholas Clark [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=low --- Site configuration information for perl v5.9.2: Configured by nick at Mon Jan 10 20:06:31 GMT 2005. Summary of my perl5 (revision 5 version 9 subversion 2 patch 22511) configuration: Platform: osname=freebsd, osvers=5.3-release-p2, archname=i386-freebsd-thread-multi uname='freebsd saigo.etla.org 5.3-release-p2 freebsd 5.3-release-p2 #1: wed dec 15 21:05:13 gmt 2004 root@saigo.etla.org:usrobjusrsrcsyssaigo i386 ' config_args='-Dusedevel=y -Dcc=ccache gcc -Dld=gcc -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list= -Dinc_version_list_init=0 -Doptimize=-O2 -g -Accccflags=-DPERL_COPY_ON_WRITE -Dusethreads -Uuse64bitint -Uusemymalloc -Dprefix=~/Sandpit/snap5.9.x-23780 -Dinstallman1dir=none -Dinstallman3dir=none -Duseperlio -de' hint=recommended, useposix=true, d_sigaction=define usethreads=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='ccache gcc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O2 -g', cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.4.2 [FreeBSD] 20040728', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags ='-Wl,-E -L/usr/local/lib' libpth=/usr/lib /usr/local/lib libs=-lm -lcrypt -lutil -lc_r perllibs=-lm -lcrypt -lutil -lc_r libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' ' cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib' Locally applied patches: DEVEL22511 --- @INC for perl v5.9.2: lib /home/nick/Sandpit/snap5.9.x-23780/lib/perl5/5.9.2/i386-freebsd-thread-multi /home/nick/Sandpit/snap5.9.x-23780/lib/perl5/5.9.2 /home/nick/Sandpit/snap5.9.x-23780/lib/perl5/site_perl/5.9.2/i386-freebsd-thread-multi /home/nick/Sandpit/snap5.9.x-23780/lib/perl5/site_perl/5.9.2 /home/nick/Sandpit/snap5.9.x-23780/lib/perl5/site_perl . --- Environment for perl v5.9.2: HOME=/home/nick LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/nick/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/home/nick/bin:/usr/local/sbin:/sbin:/usr/sbin PERL_BADLANG (unset) SHELL=/usr/local/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 419b
On Mon Jan 10 14:59:13 2005, nicholas wrote: Show quoted text
> > ./perl -Ilib -MO=Deparse born > While deparsing born near line 3, > Unexpected our($人) > CHECK failed--call queue aborted. > > born is one of the examples from t/run/freshperl.t > > use strict; > use utf8; > our $人 = 2; # 0xe4 0xba 0xba: U+4eba, "human" in CJK ideograph > $人++; # a child is born > print $人, "\n";
The attached patch fixes this.
Download open_0tUPua5v.txt
text/plain 1.6k
diff -Nurp blead-33752-unideparse.base/dist/B-Deparse/Deparse.pm blead-33752-unideparse/dist/B-Deparse/Deparse.pm --- blead-33752-unideparse.base/dist/B-Deparse/Deparse.pm 2010-09-20 22:06:11.000000000 -0700 +++ blead-33752-unideparse/dist/B-Deparse/Deparse.pm 2010-10-16 10:01:58.000000000 -0700 @@ -1041,9 +1041,11 @@ sub maybe_local { and not $self->{'avoid_local'}{$$op}) { my $our_local = ($op->private & OPpLVAL_INTRO) ? "local" : "our"; if( $our_local eq 'our' ) { - # XXX This assertion fails code with non-ASCII identifiers, - # like ./ext/Encode/t/jperl.t - die "Unexpected our($text)\n" unless $text =~ /^\W(\w+::)*\w+\z/; + if ( $text !~ /^\W(\w+::)*\w+\z/ + and !utf8::decode($text) || $text !~ /^\W(\w+::)*\w+\z/ + ) { + die "Unexpected our($text)\n"; + } $text =~ s/(\w+::)+//; } if (want_scalar($op)) { diff -Nurp blead-33752-unideparse.base/dist/B-Deparse/t/deparse.t blead-33752-unideparse/dist/B-Deparse/t/deparse.t --- blead-33752-unideparse.base/dist/B-Deparse/t/deparse.t 2010-09-20 22:06:11.000000000 -0700 +++ blead-33752-unideparse/dist/B-Deparse/t/deparse.t 2010-10-16 16:48:47.000000000 -0700 @@ -17,7 +17,7 @@ BEGIN { require feature; feature->import(':5.10'); } -use Test::More tests => 90; +use Test::More tests => 91; use Config (); use B::Deparse; @@ -166,6 +166,19 @@ eval <<EOFCODE and test($x); 1 EOFCODE +# [perl #33752] +{ + my $code = <<"EOCODE"; +{ + our \$\x{1e1f}\x{14d}\x{14d}; +} +EOCODE + my $deparsed + = $deparse->coderef2text(eval "sub { our \$\x{1e1f}\x{14d}\x{14d} }" ); + s/$ \n//x for $deparsed, $code; + is $deparsed, $code, 'our $funny_Unicode_chars'; +} + __DATA__ # 2 1;
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 548b
On Sun Oct 17 13:09:33 2010, sprout wrote: Show quoted text
> On Mon Jan 10 14:59:13 2005, nicholas wrote:
> > > > ./perl -Ilib -MO=Deparse born > > While deparsing born near line 3, > > Unexpected our($人) > > CHECK failed--call queue aborted. > > > > born is one of the examples from t/run/freshperl.t > > > > use strict; > > use utf8; > > our $人 = 2; # 0xe4 0xba 0xba: U+4eba, "human" in CJK ideograph > > $人++; # a child is born > > print $人, "\n";
> > The attached patch fixes this.
Applied as 640d5d412e67683edc19515df4462d7bb4739ae2.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org