Skip to content

Possible %main:: unexpected pollution (question) #20596

@jddurand

Description

@jddurand

This is a bug report for perl from [email protected],
generated with the help of perlbug 1.43 running under perl 5.37.6.


Win32API::File is doing a call that seems to pollute %main:: namespace

Although I am not expert, I wonder if these lines in Win32API/File.pm:

	my $tied = !defined($^]) || $^] < 5.008
					   ? eval "tied *{$file}"
					   : tied *{$file};

should not be rewriten using $] ? Though the real issue for me is that I use Win32API::File in a sitecustomize that triggers a %main:: namespace problem with B::Keywords, c.f. rurban/b-keywords#7 .

This can be reproduced with this little script:

#!env perl
use Devel::Peek;
my %before;
BEGIN {
	%before = map { $_ => 1 } keys %main::;
}
my $dummy = defined($^]);
foreach (sort keys %main::) {
	next if exists $before{$_};
	Dump($_) 
}

Output is:

SV = PV(0x14f4514) at 0x150c904
  REFCNT = 2
  FLAGS = (POK,IsCOW,pPOK)
  PV = 0x154bdd0 "\x1D"
  CUR = 1
  LEN = 0

I /guess/ that %main:: namespace should not have a new entry with "\x1D" but just calling the defined() builtin like this - though I wanted to ask the question: I am not sure if there is an issue here, and will be glad if experts can answer.


Flags

  • category=core
  • severity=low

Perl configuration

Site configuration information for perl 5.37.6:

Configured by jddfr at Sat Dec	3 11:02:01 2022.

Summary of my perl5 (revision 5 version 37 subversion 6) configuration:
   
  Platform:
    osname=MSWin32
    osvers=10.0.19045.2251
    archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended
    useposix=true
    d_sigaction=undef
    useithreads=define
    usemultiplicity=define
    use64bitint=undef
    use64bitall=undef
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
  Compiler:
    cc='cl'
    ccflags ='-nologo -GF -W3 -MD -DWIN32 -D_CONSOLE -DNO_STRICT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_WINSOCK_DEPRECATED_NO_WARNINGS  -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DMULTIPLICITY -DPERL_IMPLICIT_SYS'
    optimize='-O1 -Zi -GL'
    cppflags='-DWIN32'
    ccversion='19.32.31332'
    gccversion=''
    gccosandvers=''
    intsize=4
    longsize=4
    ptrsize=4
    doublesize=8
    byteorder=1234
    doublekind=3
    d_longlong=undef
    longlongsize=8
    d_longdbl=define
    longdblsize=8
    longdblkind=0
    ivtype='long'
    ivsize=4
    nvtype='double'
    nvsize=8
    Off_t='__int64'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='link'
    ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"C:\cl-perl-5.37.6-32bit\lib\CORE"  -machine:x86 -subsystem:console,"5.01"'
    libpth="C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\\lib\x86"
    libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib	version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib vcruntime.lib ucrt.lib
    perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib	netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib vcruntime.lib ucrt.lib
    libc=ucrt.lib
    so=dll
    useshrplib=true
    libperl=perl537.lib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs
    dlext=dll
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags='-dll -nologo -nodefaultlib -debug -opt:ref,icf -ltcg  -libpath:"C:\cl-perl-5.37.6-32bit\lib\CORE"  -machine:x86 -subsystem:console,"5.01"'


---
@INC for perl 5.37.6:
    C:/Windows/Temp/cl-perl-5.37.6-32bit/site/lib
    C:/Windows/Temp/cl-perl-5.37.6-32bit/lib

---
Environment for perl 5.37.6:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Windows\Temp\cl-perl-5.37.6-32bit\bin;C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\HostX86\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\VCPackages;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer;C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\bin\Roslyn;C:\Program Files\Microsoft Visual Studio\2022\Community\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools;C:\Program Files (x86)\Windows
Kits\10\bin\10.0.19041.0\\x86;C:\Program Files (x86)\Windows Kits\10\bin\\x86;C:\Program Files\Microsoft Visual Studio\2022\Community\\MSBuild\Current\Bin\amd64;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\;C:\Program Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\150\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Users\jddfr\AppData\Local\Microsoft\WindowsApps;C:\Users\jddfr\.dotnet\tools;C:\Program Files (x86)\Dr. Memory\bin\;C:\Program Files\Microsoft Visual
Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\Linux\bin\ConnectionManagerExe
    PERL_BADLANG (unset)
    PERL_SIZECUSTOMIZE_DEBUG=1
    SHELL (unset)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions