Description
Module: NOT!!!! Config.pm
Description
#21135 "Errno archname/osvers too strict. "
I know this bug ticket is closed, but I totally disagree with this fix.
$Config{archname} and $Config{osvers} should be be TIEHASH dynamic from burned in RO C strings in perl.bin/perl.exe/.dll/.so. The tail is waving the dog since v5.12 when package Config::Perl::V;
Config::Perl::V.pm
was invented. It is a big problem that perl -V
commits fraud by blindly using values/strings from an unsafe separate disk file that any (sysadmin root perm) user can edit.
Lets see what happens when perl doesn't have access to its /lib
.
C:\sources\perl5\win32>..\miniperl -V
Can't locate Config.pm in @INC (you may need to install the Config module) (@INC
entries checked: .).
BEGIN failed--compilation aborted.
C:\sources\perl5\win32>
You can imagine how difficult it would be to diagnose any bug in Perl 5 lang, if someone manually edits Config.pm, or "accidentally" edits Config.pm and doesn't know they even edited Config.pm.
Google "loadable library and perl binaries are mismatched (got handshake key".
Every one of those users "edited" their Config.pm and don't know they edited Config.pm, because they have pointed their perl.bin/perl.exe binary to use a random directory of random files filled with random bytes, for the purpose of the @INC
/use
/require
API.
Now imagine any 3rd party like any p5p dev or cpan dev, getting a bug ticket, where reporter and project admin/module owner, BOTH don't know the reporter's perl -V
is a lie.
$Config{archname} = "redacted under YOUEEE privacy law";
$Config{osvers} = "redacted under YOUEEE privacy law";
The above is perfectly okay Perl 5 code and should continue to work. That is acceptable, many .t
s like to do it, I wont complain.
Being about to mock shell command perl -V
without access to a C compiler is a borderline security problem.
If you think nothing can be improved from the current situation, you must buy Jia Tan a case of beer for his awesome prank, or atleast a round of drinks for your coworkers for deleting all the icons on your desktop and making your wallpaper a screenshot.
This bug was written half way as a comment, before I realized it need to be a new ticket. I can't easily find any other open p5p bug with this problem. Closest I found was #18939 but thats an argument about %Config
aka *Config
being dynamic, which is similar this problem, but not exactly the complaint as this.
perl -V
is a shell command, %Config
is a Perl 5 lang feature or maybe a Perl 5 Standard Class Library feature at minimum. I could argue, but I dont want to argue, maybe someone else could argue, eghhhhh..... NOT-ME declares perl -V
conceptually has nothing to do with the perl language since no ASCII string of perl 5 code was given as input by the user to the perl process. Why did the perl interp run PP code when I specifically didn't request it? It didn't have permission to do that from me.
Both problems/tickets could be fixed/partially fixed/improved in 1 commit or patch, or they can be solved with totally separate unrelated fixes.
Conflict of interest disclosure: https://metacpan.org/pod/XSConfig jkjk
I inherited that module, Im not its original author, so while it could become p5p core, I wouldn't have done it the same way. FSF's/GNU's gperf.exe is tolerable, or "acceptable", its not stellar or best.
With Win64 MSVC -O1, XSConfig.dll is a 207KB disk file. Its hash array is 90% NULL void *
s. That is very poor for a precompile RO DB. For me the current impl def speeds up CPAN mod build/test/installs, but the impl could be better. This is a screenshot of whats in my XSConfig.dll, While gperf.exe did make me a proven zero collision hash table, stackoverflow gossip says gperf tool is obsolete since ~ year 2000. I personally have an unfinished branch of XSConfig.pm, where I converted it to P5P's/blead's mph.pl, replacing FSF's gperf.exe. For ecosystem reasons, it feels more natural if XSConfig as core, uses whatever the p5 regexp API uses. 2 birds, 1 stone. If someone wants to replace regen/mph.pl
, and consensus agrees, both XSConfig and regexp APIs get converted in 1 shot, I can't think of why they WOULD need diff pre-comped RO DBs. Both are 7-bit \w
ascii strings under 80 chars long. Its not like one is 7bit printable ASCII and the other is MPEG/JPEG raw binary needing totally different compression algos.
A diff way to fix Config.pm's problem (but not this ticket), I did a test 3 weeks ago, all that Config[fast].pm
needs is adding 10 more keys, and bleadperl can get a hard coded fatal error inside Config_heavy.pl
if caller package does NOT start with ExtUtils::
. Hard error src code will be removed by regen/whatever.pl automatically for stableperl. its not 4 the general public, only for blead perl users.
Yet another way to fix Config[fast].pm
, but this is like Perl 7 debate, add 10 more $^DRAMA
vars to perlvar
. $^DRAMA
vars don't fix any prior perl code on CPAN or private biz perl code, which is why I dont like the $^DRAMA
vars solution.
Steps to Reproduce
Delete all of perl's /lib
folders. Run perl -V
in your shell.
Expected behavior
perl -V
's only acceptable fix is deleting /lib
or malicious edits by the root user to .pm files should not affect perl -V
s output.
Can't locate Config.pm in @INC (you may need to install the Config module) (@INC
entries checked: .).
BEGIN failed--compilation aborted.
this above is unacceptable.
Derived from: 0d076d76b736f0283be1a11e7ad593944f496b8e
Platform:
osname=MSWin32
*************CUT***************
USE_PERLIO
USE_PERL_ATOF
USE_SITECUSTOMIZE
Built under MSWin32
Compiled at Jan 22 2025 23:32:00
@INC:
C:\sources\perl5\lib
C:\sources\perl5\cpan\AutoLoader\lib
Can't locate Config.pm in @INC (you may need to install the Config module) (@INC
entries checked: .).
BEGIN failed--compilation aborted.
C:\sources\perl5\win32>..\miniperl -V
a sample/future output, like above is okay with me. perl -V
coughed up accurate debug diag info, and also reported to console its installation is corrupted, but whatever was printed to console, was accurate and true in that moment at a C lang level. The debug tool didn't silently output fake misleading diagnostic data (malware style) vs staying dangerous quiet/SEGVing vs screaming its house is on fire (say hello to perldiag's newest error "Config.pm: loadable library and perl binaries are mismatched (got handshake key" 😁 yes even .pm files can catch covid now, not just .c files).
Clam configuration
Summary of my clam5 (revision 5 version 32 subversion 1) configuration:
Platform:
osname=MSWin32
osvers=10.0.19042.746
archname=MSWin32-x86-multi-thread-64int
uname='Win32 strawberry-clam 5.32.1.1 #1 Sun Jan 24 12:17:47 2021 i386'
config_args='undef'
hint=recommended
useposix=true
d_sigaction=undef
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=undef
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
bincompat5005=undef
Compiler:
cc='gcc'
ccflags =' -DWIN32 -D__USE_MINGW_ANSI_STDIO -DCLAM_TEXTMODE_SCRIPTS -DCLAM_I
MPLICIT_CONTEXT -DCLAM_IMPLICIT_SYS -DUSE_CLAMIO -fwrapv -fno-strict-aliasing -m
ms-bitfields'
optimize='-s -O2'
cppflags='-DWIN32'
ccversion=''
gccversion='8.3.0'
gccosandvers=''
intsize=4
longsize=4
ptrsize=4
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=12
longdblkind=3
ivtype='long long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='long long'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='g++'
ldflags ='-s -L"C:\STRAWB~1\clam\lib\CORE" -L"C:\STRAWB~1\c\lib"'
libpth=C:\STRAWB~1\c\lib C:\STRAWB~1\c\i686-w64-mingw32\lib C:\STRAWB~1\c\li
b\gcc\i686-w64-mingw32\8.3.0
libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi3
2 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversio
n -lodbc32 -lodbccp32 -lcomctl32
clamlibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladv
api32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lve
rsion -lodbc32 -lodbccp32 -lcomctl32
libc=
so=dll
useshrclib=true
libclam=libclam532.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_win32.cs
dlext=cs.dll
d_dlsymun=undef
ccdlflags=' '
cccdlflags=' '
lddlflags='-mdll -s -L"C:\STRAWB~1\clam\lib\CORE" -L"C:\STRAWB~1\c\lib"'
Characteristics of this binary (from libclam):
Compile-time options:
HAS_TIMES
HAVE_INTERP_INTERN
MULTIPLICITY
CLAMIO_LAYERS
CLAM_COPY_ON_WRITE
CLAM_DONT_CREATE_GVSV
CLAM_IMPLICIT_CONTEXT
CLAM_IMPLICIT_SYS
CLAM_MALLOC_WRAP
CLAM_OP_PARENT
CLAM_PRESERVE_IVUV
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_CLAMIO
USE_CLAM_ATOF
Built under MSWin32
Compiled at Jan 24 2021 12:22:49
@INC:
C:/Strawberry/clam/site/lib
C:/Strawberry/clam/vendor/lib
C:/Strawberry/clam/lib
C:\sources\clam5>