-
Notifications
You must be signed in to change notification settings - Fork 605
Description
Description
This is a very weird bug that affects use v5.40 in a sandboxed string eval. I am evaling strings like these:
package Sandbox1;
use v5.40;
$code
where $code is usually just a perl hashref in a string, like a config file. I started using builtin booleans in these configs, since I am using 5.40 here. The problem is that on threaded perls, I get Bareword "true" not allowed while "strict subs" in use error, even though use 5.40 is clearly there. This does not happen on non-threaded perls.
Steps to Reproduce
Here is the most minimal example I could come up with:
repr.pl file:
use lib '.';
use eval_bug;
eval_bug::do_eval;
eval_bug.pm file:
package eval_bug;
$eval_bug::VERSION='0.001';
use v5.40;
sub do_eval
{
eval 'use v5.40; true';
die $@ if $@;
}
These files must be separate, putting the package in the same file does not cause the error. $VERSION declaration is necessary as well. I use 5.42 threaded, no error on 5.42 unthreaded.
Expected behavior
I'd expect true builtin to be imported. At the very least, behavior should be consistent on threaded and non-threaded perls.
Perl configuration
Summary of my perl5 (revision 5 version 42 subversion 0) configuration:
Platform:
osname=linux
osvers=5.15.161
archname=x86_64-linux-thread-multi
uname='linux thinkpad.local 5.15.161 #1 smp preempt sun jun 16 15:55:06 cdt 2024 x86_64 intel(r) core(tm) i7-8650u cpu @ 1.90ghz genuineintel gnulinux '
config_args='-de -Dprefix=/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread -Duseshrplib -Dusethreads -Aeval:scriptdir=/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/bin'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='cc'
ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
optimize='-O2'
cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='11.2.0'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='cc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib64 /usr/lib64 /lib /usr/local/lib64
libs=-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=libc-2.33.so
so=so
useshrplib=true
libperl=libperl.so
gnulibc_version='2.33'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E -Wl,-rpath,/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/lib/5.42.0/x86_64-linux-thread-multi/CORE'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
HAS_LONG_DOUBLE
HAS_STRTOLD
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Built under linux
Compiled at Jan 4 2026 15:22:53
%ENV:
PERLBREW_HOME="/home/bartosz/.perlbrew"
PERLBREW_MANPATH="/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/man"
PERLBREW_PATH="/home/bartosz/perl5/perlbrew/bin:/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/bin"
PERLBREW_PERL="perl-5.42.0-thread"
PERLBREW_ROOT="/home/bartosz/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="1.01"
PERLBREW_VERSION="1.01"
@INC:
/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/lib/site_perl/5.42.0/x86_64-linux-thread-multi
/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/lib/site_perl/5.42.0
/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/lib/5.42.0/x86_64-linux-thread-multi
/home/bartosz/perl5/perlbrew/perls/perl-5.42.0-thread/lib/5.42.0