Closed
Description
Module:
Description
Trying to use Encode
after POSIX::setlocale
has been changed to Polish, causes the following error:
Constants from lexical variables potentially modified elsewhere are no longer permitted at constant.pm line 41.
BEGIN failed--compilation aborted at constant.pm line 45.
Compilation failed in require at Encode.pm line 7.
BEGIN failed--compilation aborted at Encode.pm line 7.
Steps to Reproduce
(in case you have any of that set)
unset LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME LC_ADDRESS LC_IDENTIFICATION LC_MEASUREMENT LC_NAME LC_PAPER LC_TELEPHONE
LANG=pl_PL.UTF-8 perl -E'
BEGIN{
use POSIX;
setlocale(LC_ALL,"")
}
use Encode
'
you can also get the same error with:
LANG=pl_PL.utf8 perl -MPOSIX -E'
setlocale(LC_ALL,"");
eval q{
use constant X => $]
};
print $@
'
Expected behavior
use Encode
should not crash depending on the locale
Perl configuration
Summary of my perl5 (revision 5 version 39 subversion 6) configuration:
Snapshot of: c5f88297e0985be19f66e995b527ee4a001fc028
Platform:
osname=linux
osvers=6.6.3-1-default
archname=x86_64-linux-thread-multi
uname='linux d5421s.localdomain 6.6.3-1-default #1 smp preempt_dynamic wed nov 29 05:06:07 utc 2023 (d766c57) x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=~/perl5/perlbrew/perls/perl-blead -Duseshrplib -Dusethreads -Dusemultiplicity -Dusedevel -Aeval:scriptdir=~/perl5/perlbrew/perls/perl-blead/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='13.2.1 20231130 [revision 741743c028dc00f27b9c8b1d5211c1f602f2fddd]'
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/x86_64-suse-linux/lib /usr/lib /usr/lib64 /usr/local/lib64
libs=-lpthread -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=/lib/../lib64/libc.so.6
so=so
useshrplib=true
libperl=libperl.so
gnulibc_version='2.38'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E -Wl,-rpath,~/perl5/perlbrew/perls/perl-blead/lib/5.39.6/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_DEVEL
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 Dec 22 2023 14:39:29
%ENV:
PERLBREW_HOME="~/.perlbrew"
PERLBREW_MANPATH="~/perl5/perlbrew/perls/perl-blead/man"
PERLBREW_PATH="~/perl5/perlbrew/bin:~/perl5/perlbrew/perls/perl-blead/bin"
PERLBREW_PERL="perl-blead"
PERLBREW_ROOT="~/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="0.98"
PERLBREW_VERSION="0.98"
PERLDOC_PAGER="less -s"
PERL_LOCAL_LIB_ROOT="~/perl5/5.38.2"
PERL_MB_OPT="--install_base "~/perl5/5.38.2""
PERL_MM_OPT="INSTALL_BASE=~/perl5/5.38.2"
@INC:
~/perl5/perlbrew/perls/perl-blead/lib/site_perl/5.39.6/x86_64-linux-thread-multi
~/perl5/perlbrew/perls/perl-blead/lib/site_perl/5.39.6
~/perl5/perlbrew/perls/perl-blead/lib/5.39.6/x86_64-linux-thread-multi
~/perl5/perlbrew/perls/perl-blead/lib/5.39.6