develooper Front page | perl.perl5.porters | Postings from December 2002

[perl #19135] string eval turns off readonlyness on lexicals

From:
Nicholas Clark
Date:
December 14, 2002 21:58
Subject:
[perl #19135] string eval turns off readonlyness on lexicals
Message ID:
rt-19135-45385.19.8283956291102@bugs6.perl.org
# New Ticket Created by  Nicholas Clark 
# Please include the string:  [perl #19135]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=19135 >



This is a bug report for perl from nick@ccl4.org,
generated with the help of perlbug 1.34 running under perl v5.8.0.


-----------------------------------------------------------------
[Please enter your report here]

Without ithreads, a lexical stays readonly when it is referenced inside
a string eval:

$ perl5.8.0-32 -MDevel::Peek -wle 'my $k = "!"; Internals::SvREADONLY $k, 1; Dump $k; eval "print \$k"; Dump $k'
SV = PV(0x8112460) at 0x8112210
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,READONLY,pPOK)
  PV = 0x8111120 "!"\0
  CUR = 1
  LEN = 2
!
SV = PV(0x8112460) at 0x8112210
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,READONLY,pPOK)
  PV = 0x8111120 "!"\0
  CUR = 1
  LEN = 2

With ithreads it loses its readonlyness:

perl5.8.0-32-i -MDevel::Peek -wle 'my $k = "!"; Inter
nals::SvREADONLY $k, 1; Dump $k; eval "print \$k"; Dump $k'
SV = PV(0x8125c60) at 0x8125a28
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,READONLY,pPOK)
  PV = 0x8137120 "!"\0
  CUR = 1
  LEN = 2
!
SV = PV(0x8125c60) at 0x8125a28
  REFCNT = 1
  FLAGS = (PADBUSY,PADMY,POK,pPOK)
  PV = 0x8137120 "!"\0
  CUR = 1
  LEN = 2


This is still true in blead. It seems wrong. (It's also the source of a
copy on write bug in blead)

I think it's the code at the line /* could be a freed constant */ in
Perl_pad_free (formerly of op.c, now in pad.c) that's responsible for this.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
This perlbug was built using Perl v5.8.0 - Sat Jul 13 15:53:56 BST 2002
It is being executed now by  Perl v5.8.0 - Fri Jul 19 22:00:42 BST 2002.

Site configuration information for perl v5.8.0:

Configured by nick at Fri Jul 19 22:00:42 BST 2002.

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.4.18-rmk7, archname=armv4l-linux
    uname='linux bagpuss.unfortu.net 2.4.18-rmk7 #10 sun jun 23 21:43:05 bst 2002 armv4l unknown '
    config_args='-Dcc=ccache gcc-3.0 -Dld=gcc-3.0 -Ubincompat5005 -Uinstallusrbinperl -Dcf_email=nick@ccl4.org -Dperladmin=nick@ccl4.org -Dinc_version_list=  -Dinc_version_list_init=0 -Doptimize=-Os -de -Uusethreads'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef 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='ccache gcc-3.0', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-Os',
    cppflags='-fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.0.4', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc-3.0', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldbm -ldb -ldl -lm -lc -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lcrypt -lutil
    libc=/lib/libc-2.2.4.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.2.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL17513

---
@INC for perl v5.8.0:
    /usr/local/lib/perl5/5.8.0/armv4l-linux
    /usr/local/lib/perl5/5.8.0
    /usr/local/lib/perl5/site_perl/5.8.0/armv4l-linux
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.8.0:
    HOME=/home/nick
    LANG (unset)
    LANGUAGE (unset)
    LC_CTYPE=en_GB.ISO-8859-1
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/nick/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/sbin:/usr/sbin:/usr/local/sbin
    PERL_BADLANG (unset)
    SHELL=/bin/bash





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