Constants from lexical variables potentially modified elsewhere are no longer permitted at /usr/share/perl5/core_perl/constant.pm line 41.
TimoStolz opened this issue · 11 comments
Today, I installed version 1.4.0 on archlinux using sudo cpanm --force App::Sqitch
. It was necessary to use --force
because of failing tests during build (still #767).
When I run sqitch --version
afterwards, the following error occurs:
Constants from lexical variables potentially modified elsewhere are no longer permitted at /usr/share/perl5/core_perl/constant.pm line 41.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/constant.pm line 45.
Compilation failed in require at /usr/share/perl5/core_perl/Getopt/Long.pm line 222.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/Getopt/Long.pm line 222.
Compilation failed in require at /usr/share/perl5/site_perl/App/Sqitch.pm line 9.
BEGIN failed--compilation aborted at /usr/share/perl5/site_perl/App/Sqitch.pm line 9.
Compilation failed in require at /usr/bin/site_perl/sqitch line 13.
BEGIN failed--compilation aborted at /usr/bin/site_perl/sqitch line 13.
I can fix this error by patching /usr/bin/site_perl/sqitch
to
#!/usr/bin/perl -w -CAS
our $VERSION = 'v1.4.0'; # VERSION
#use POSIX qw(setlocale);
BEGIN {
if ($^O eq 'MSWin32') {
require Win32::Locale;
setlocale POSIX::LC_ALL, Win32::Locale::get_locale();
} else {
#setlocale POSIX::LC_ALL, '';
}
}
use App::Sqitch;
exit App::Sqitch->go;
I basically skipped the lines use POSIX qw(setlocale);
and setlocale POSIX::LC_ALL, '';
. Then, it was working again.
Oh, and perl -v
gives This is perl 5, version 38, subversion 1 (v5.38.1) built for x86_64-linux-thread-multi
It was necessary to use --force because of failing tests during build (still #767).
Tests still fail on v1.4.0? It should have been fixed in bcf0250, which is included in v1.4.0.
I'm not able to replicate this issue; it's odd that it would come up now, since this exception shipped in Perl 5.32. What's on /usr/share/perl5/core_perl/Getopt/Long.pm line 222
?
I have the same issue (NixOS/nixpkgs#275647):
[root@mymachine:~]# sqitch --version
.sqitch-wrapped (App::Sqitch) v1.4.0
[root@mymachine:~]# LC_NUMERIC="en_US.UTF-8" sqitch --version
.sqitch-wrapped (App::Sqitch) v1.4.0
[root@mymachine:~]# LC_NUMERIC="en_GB.UTF-8" sqitch --version
.sqitch-wrapped (App::Sqitch) v1.4.0
[root@mymachine:~]# LC_NUMERIC="nb_NO.UTF-8" sqitch --version
Constants from lexical variables potentially modified elsewhere are no longer permitted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 41.
BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/constant.pm line 45.
Compilation failed in require at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
BEGIN failed--compilation aborted at /nix/store/afz9z2iczjx13i66ymwwinwp2zvgc1ck-perl-5.38.0/lib/perl5/5.38.0/Getopt/Long.pm line 222.
Compilation failed in require at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
BEGIN failed--compilation aborted at /nix/store/f18qfbr6y94k43g7nija4rhvg1xjnggr-perl5.38.0-App-Sqitch-1.4.0/lib/perl5/site_perl/5.38.0/App/Sqitch.pm line 9.
Compilation failed in require at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
BEGIN failed--compilation aborted at /nix/store/bij7i7q4bwy5jr0a5kyb85hq9awnj8gv-sqitch-pg-1.4.0/bin/.sqitch-wrapped line 13.
In my case, it's
$ locale
LANG=de_DE.UTF-8
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
Replicated with
LC_ALL="de_DE.UTF-8" ./t/sqitch --version
Fascinating that setting the locale triggers it.
Here's an example without Sqitch:
❯ LC_ALL="de_DE.UTF-8" perl -E 'use POSIX(setlocale); BEGIN { setlocale POSIX::LC_ALL, "" } use File::Spec'
Constants from lexical variables potentially modified elsewhere are no longer permitted at /Users/david/.plenv/versions/5.38.1/lib/perl5/5.38.1/constant.pm line 41.
BEGIN failed--compilation aborted at /Users/david/.plenv/versions/5.38.1/lib/perl5/5.38.1/constant.pm line 45.
Compilation failed in require at /Users/david/.plenv/versions/5.38.1/lib/perl5/5.38.1/darwin-multi-2level/File/Spec/Unix.pm line 115.
BEGIN failed--compilation aborted at /Users/david/.plenv/versions/5.38.1/lib/perl5/5.38.1/darwin-multi-2level/File/Spec/Unix.pm line 115.
Compilation failed in require at /Users/david/.plenv/versions/5.38.1/lib/perl5/5.38.1/darwin-multi-2level/File/Spec.pm line 21.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Would you try this patch, please? Let me know if it no longer properly localizes messages, too.
--- a/bin/sqitch
+++ b/bin/sqitch
@@ -1,15 +1,6 @@
#!perl -w -CAS
# VERSION
-use POSIX qw(setlocale);
-BEGIN {
- if ($^O eq 'MSWin32') {
- require Win32::Locale;
- setlocale POSIX::LC_ALL, Win32::Locale::get_locale();
- } else {
- setlocale POSIX::LC_ALL, '';
- }
-}
+use locale;
use App::Sqitch;
-
exit App::Sqitch->go;
Thank you very much! Is there a way to install 1.4.1-dev using cpanminus?
Not to my knowledge. I'll try to make a new release this weekend.
v1.4.1 out now.