# New Ticket Created by "Todd Rinaldo" # Please include the string: [perl #133795] # in the subject line of all future correspondence about this issue. # <URL: https://rt.perl.org/Ticket/Display.html?id=133795 > This is a bug report for perl from toddr@cpan.org, generated with the help of perlbug 1.41 running under perl 5.28.0. ----------------------------------------------------------------- [Please describe your issue here] We've been experimenting with virtualizing directory interaction in Test::MockFile by overriding Core::GLOBAL::readdir. I got a report about a problem with implcit assignment to $_ not working via https://github.com/CpanelInc/Test-MockFile/issues/32 To try to clarify the problem we came up with this perl script. --- use strict; use warnings; BEGIN { *CORE::GLOBAL::readdir = sub { $_[0] } } print "*** readdir assigns to \$_ implicitly\n"; while (readdir 'foo') { print; last; } print "*** readdir undef\n"; while (readdir undef) { # doesn't implicitly check defined() print; last; } print "*** \$_ = readdir 'foo'\n"; while ($_ = readdir 'foo') { print; last; } --- I would have expected foo 2 times but instead I got this. The uninitialized check should't have happened either. *** readdir assigns to $_ implicitly Use of uninitialized value $_ in print at projects/Test-MockFile/foo.pl line 8. *** readdir undef *** $_ = readdir 'foo' [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.28.0: Configured by cPanel at Tue Nov 27 16:50:45 CST 2018. Summary of my perl5 (revision 5 version 28 subversion 0) configuration: Platform: osname=linux osvers=3.10.0-123.20.1.el7.x86_64 archname=x86_64-linux-64int uname='linux rpmbuild-64-centos-7.dev.cpanel.net 3.10.0-123.20.1.el7.x86_64 #1 smp thu jan 29 18:05:33 utc 2015 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dusedevel -Darchname=x86_64-linux-64int -Dcc=/usr/bin/gcc -Dcpp=/usr/bin/cpp -Dusemymalloc=n -DDEBUGGING=none -Doptimize=-Os -Accflags=-m64 -Dccflags=-DPERL_DISABLE_PMC -fPIC -DPIC -Duseshrplib -Duselargefiles=yes -Duseposix=true -Dhint=recommended -Duseperlio=yes -Dprefix=/usr/local/cpanel/3rdparty/perl/528 -Dsiteprefix=/opt/cpanel/perl5/528 -Dsitebin=/opt/cpanel/perl5/528/bin -Dsitelib=/opt/cpanel/perl5/528/site_lib -Dusevendorprefix=true -Dvendorbin=/usr/local/cpanel/3rdparty/perl/528/bin -Dvendorprefix=/usr/local/cpanel/3rdparty/perl/528/lib/perl5 -Dvendorlib=/usr/local/cpanel/3rdparty/perl/528/lib/perl5/cpanel_lib -Dprivlib=/usr/local/cpanel/3rdparty/perl/528/lib/perl5/5.28.0 -Dman1dir=none -Dman3dir=none -Dscriptdir=/usr/local/cpanel/3rdparty/perl/528/bin -Dscriptdirexp=/usr/local/cpanel/3rdparty/perl/528/bin -Dsiteman1dir=none -Dsiteman3dir=none -Dinstallman1dir=none -Dversiononly=no -Dinstallusrbinperl=no -Dcf_by=cPanel -Dmyhostname=localhost -Dperladmin=root@localhost -Dcf_email= support@cpanel.net -DDB_File=true -Ud_dosuid -Uuserelocatableinc -Umad -Uusethreads -Uusemultiplicity -Uusesocks -Uuselongdouble -Duse64bitint -Uuse64bitall' hint=recommended useposix=true d_sigaction=define useithreads=undef usemultiplicity=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='/usr/bin/gcc' ccflags ='-DPERL_DISABLE_PMC -fPIC -DPIC -m64 -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='-Os' cppflags='-DPERL_DISABLE_PMC -fPIC -DPIC -m64 -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='' gccversion='4.8.2 20140120 (Red Hat 4.8.2-16)' 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='/usr/bin/gcc' ldflags =' -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64 libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.17.so so=so useshrplib=true libperl=libperl.so gnulibc_version='2.17' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E -Wl,-rpath,/usr/local/cpanel/3rdparty/perl/528/lib/perl5/5.28.0/x86_64-linux-64int/CORE' cccdlflags='-fPIC' lddlflags='-shared -Os -L/usr/local/lib -fstack-protector-strong' Locally applied patches: cPanel - disable man installs cPanel - cPanel INC PATH --- @INC for perl 5.28.0: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/528/lib/perl5/cpanel_lib/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/528/lib/perl5/cpanel_lib /usr/local/cpanel/3rdparty/perl/528/lib/perl5/5.28.0/x86_64-linux-64int /usr/local/cpanel/3rdparty/perl/528/lib/perl5/5.28.0 /opt/cpanel/perl5/528/site_lib/x86_64-linux-64int /opt/cpanel/perl5/528/site_lib --- Environment for perl 5.28.0: HOME=/root LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/bin PERL_BADLANG (unset) PERL_USE_UNSAFE_INC=0 SHELL=/bin/zshThread Previous