Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utf8 + "[a]a{2}" + /$.../ = panic: sv_len_utf8 cache #9026

Closed
p5pRT opened this issue Sep 10, 2007 · 7 comments
Closed

utf8 + "[a]a{2}" + /$.../ = panic: sv_len_utf8 cache #9026

p5pRT opened this issue Sep 10, 2007 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 10, 2007

Migrated from rt.perl.org#45337 (status was 'resolved')

Searchable as RT45337$

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2007

From webmasters@ctosonline.org

The following snippet works in 5.9.4 and earlier but fails in 5.10.0
patchlevel 31832​:

$ perl -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
ok
$ perl5.10.0 -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
panic​: sv_len_utf8 cache 3 real 2 for aa at -e line 1.

Apparently this error occurs when a string to be interpolated in a
regexp has the utf8 flag on and contains a character class followed
by literal text with a fixed quantifier > 1.

A binary search points to change #31246 as being the culprit.

I hope this helps.

Father Chrysostomos

perl5.10.0 -Mconstant=Just,0 -le'sub IO​::Handle​::a_japh{print*{$_[0]}
=~/([^​:]+)$/," another Perl hacker,"}"Just"->a_japh'


Flags​:
  category=core
  severity=high


Site configuration information for perl 5.10.0​:

Configured by neo at Sun Sep 9 11​:55​:38 PDT 2007.

Summary of my perl5 (revision 5 version 10 subversion 0 patch 31832)
configuration​:
  Platform​:
  osname=darwin, osvers=8.8.0, archname=darwin-2level
  uname='darwin treebeard.local 8.8.0 darwin kernel version 8.8.0​:
fri sep 8 17​:18​:57 pdt 2006; root​:xnu-792.12.6.obj~1release_ppc power
macintosh powerpc '
  config_args='-de'
  hint=previous, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  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 -
fno-strict-aliasing -pipe -I/usr/local/include',
  optimize='-O3',
  cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-
precomp -fno-strict-aliasing -pipe -I/usr/local/include -fno-common -
DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/
include -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-
aliasing -pipe -I/usr/local/include -fno-common -DPERL_DARWIN -no-cpp-
precomp -fno-strict-aliasing -pipe -I/usr/local/include -fno-common -
DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/
include'
  ccversion='', gccversion='4.0.0 20041026 (Apple Computer, Inc.
build 4061)', gccosandvers='darwin8'
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
  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 =' -L/usr/
local/lib'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lc
  perllibs=-ldl -lm -lc
  libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false,
libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/
usr/local/lib'

Locally applied patches​:
  DEVEL


@​INC for perl 5.10.0​:
  /usr/local/lib/perl5/5.9.5/darwin-2level
  /usr/local/lib/perl5/5.9.5
  /usr/local/lib/perl5/site_perl/5.9.5/darwin-2level
  /usr/local/lib/perl5/site_perl/5.9.5
  .


Environment for perl 5.10.0​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/neo
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/bin​:/sbin​:/usr/bin​:/usr/sbin​:/usr/TeX/bin/powerpc-
darwin6.8​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2007

From @iabyn

On Mon, Sep 10, 2007 at 01​:04​:59PM -0700, webmasters @​ ctosonline. org wrote​:

The following snippet works in 5.9.4 and earlier but fails in 5.10.0
patchlevel 31832​:

$ perl -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
ok
$ perl5.10.0 -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
panic​: sv_len_utf8 cache 3 real 2 for aa at -e line 1.

Apparently this error occurs when a string to be interpolated in a
regexp has the utf8 flag on and contains a character class followed
by literal text with a fixed quantifier > 1.

A binary search points to change #31246 as being the culprit.

A closer look reveals that that change (one of mine) accidentally
unconditionally enabled the utf8 cache debugging code, which then flagged
up the error. That's now fixed (#31842).

The regex/utf8 bug itself is older. I'll try to have a look at it sometime
if someone else doesn't beat me to it (hint hint).

--
Lady Nancy Astor​: If you were my husband, I would flavour your coffee
with poison.
Churchill​: Madam - if I were your husband, I would drink it.

@p5pRT
Copy link
Author

p5pRT commented Sep 10, 2007

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Sep 11, 2007

From @demerphq

On 9/10/07, Dave Mitchell <davem@​iabyn.com> wrote​:

On Mon, Sep 10, 2007 at 01​:04​:59PM -0700, webmasters @​ ctosonline. org wrote​:

The following snippet works in 5.9.4 and earlier but fails in 5.10.0
patchlevel 31832​:

$ perl -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
ok
$ perl5.10.0 -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
panic​: sv_len_utf8 cache 3 real 2 for aa at -e line 1.

Apparently this error occurs when a string to be interpolated in a
regexp has the utf8 flag on and contains a character class followed
by literal text with a fixed quantifier > 1.

A binary search points to change #31246 as being the culprit.

A closer look reveals that that change (one of mine) accidentally
unconditionally enabled the utf8 cache debugging code, which then flagged
up the error. That's now fixed (#31842).

The regex/utf8 bug itself is older. I'll try to have a look at it sometime
if someone else doesn't beat me to it (hint hint).

Assuming that was aimed at me Ill note that i have put this in my todo
list. However im extremely busy right now with $real_life stuff and
will have very little time over the near future.

Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"

@p5pRT
Copy link
Author

p5pRT commented Sep 12, 2007

From @hvds

Dave Mitchell <davem@​iabyn.com> wrote​:
:On Mon, Sep 10, 2007 at 01​:04​:59PM -0700, webmasters @​ ctosonline. org wrote​:
:> The following snippet works in 5.9.4 and earlier but fails in 5.10.0
:> patchlevel 31832​:
:>
:> $ perl -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
:> ok
:> $ perl5.10.0 -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
:> panic​: sv_len_utf8 cache 3 real 2 for aa at -e line 1.
:>
:> Apparently this error occurs when a string to be interpolated in a
:> regexp has the utf8 flag on and contains a character class followed
:> by literal text with a fixed quantifier > 1.
:>
:> A binary search points to change #31246 as being the culprit.
:
:A closer look reveals that that change (one of mine) accidentally
:unconditionally enabled the utf8 cache debugging code, which then flagged
:up the error. That's now fixed (#31842).
:
:The regex/utf8 bug itself is older. I'll try to have a look at it sometime
:if someone else doesn't beat me to it (hint hint).

So does that mean an error still occurs but is no longer flagged?
If so, what should the test case be to demonstrate the problem?

Hugo

@p5pRT
Copy link
Author

p5pRT commented Sep 14, 2007

From @iabyn

On Wed, Sep 12, 2007 at 01​:53​:39PM +0100, hv@​crypt.org wrote​:

Dave Mitchell <davem@​iabyn.com> wrote​:
:On Mon, Sep 10, 2007 at 01​:04​:59PM -0700, webmasters @​ ctosonline. org wrote​:
:> The following snippet works in 5.9.4 and earlier but fails in 5.10.0
:> patchlevel 31832​:
:>
:> $ perl -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
:> ok
:> $ perl5.10.0 -e'$s="[a]a{2}"; utf8​::upgrade $s; /$s/; print "ok\n"'
:> panic​: sv_len_utf8 cache 3 real 2 for aa at -e line 1.
:>
:> Apparently this error occurs when a string to be interpolated in a
:> regexp has the utf8 flag on and contains a character class followed
:> by literal text with a fixed quantifier > 1.
:>
:> A binary search points to change #31246 as being the culprit.
:
:A closer look reveals that that change (one of mine) accidentally
:unconditionally enabled the utf8 cache debugging code, which then flagged
:up the error. That's now fixed (#31842).
:
:The regex/utf8 bug itself is older. I'll try to have a look at it sometime
:if someone else doesn't beat me to it (hint hint).

Now fixed by #31867

So does that mean an error still occurs but is no longer flagged?
If so, what should the test case be to demonstrate the problem?

This enables the former behaviour​:

  ${^UTF8CACHE} = -1;

--
But Pity stayed his hand. "It's a pity I've run out of bullets",
he thought. -- "Bored of the Rings"

@p5pRT
Copy link
Author

p5pRT commented Mar 14, 2010

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant