Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<<>> operator introduction causes regression of behaviour of "readline" builtin. #14561

Closed
p5pRT opened this issue Mar 5, 2015 · 4 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Mar 5, 2015

Migrated from rt.perl.org#123990 (status was 'resolved')

Searchable as RT123990$

@p5pRT
Copy link
Author

p5pRT commented Mar 5, 2015

From @kentfredric

Perl 5.20.9​:

perl -e 'while(readline){ print $_ }' 'echo insecure |'
Can't open ls -la |​: No such file or directory at -e line 1.

perl 5.20.0​:

perl -e 'while(readline){ print $_ }' 'echo insecure |'
insecure

More over, deparsing this syntax ( and the <<>> syntax ) returns code that behaves differently to the syntax offered.


perl -e 'while(readline){ print $_ }' 'echo insecure |'
Can't open ls -la |​: No such file or directory at -e line 1.

perl -MO=Deparse -e 'while(readline){ print $_ }' 'echo insecure |'
while (defined($_ = <ARGV>)) {
  print $_;
}

perl -MO=Deparse -e 'while(<<>>){ print $_ }' 'echo hello |'
while (defined($_ = <ARGV>)) {
  print $_;
}

perl -MO=Deparse -e 'while(<>){ print $_ }' 'echo hello |'
while (defined($_ = <ARGV>)) {
  print $_;
}

perl -e 'while(defined($_ =<ARGV>)){ print $_ }' 'echo insecure |'
insecure



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.21.9​:

Configured by kent at Wed Feb 11 00​:16​:37 NZDT 2015.

Summary of my perl5 (revision 5 version 21 subversion 9) configuration​:
  Derived from​: 5904c5c
  Platform​:
  osname=linux, osvers=3.18.3-aufs, archname=x86_64-linux
  uname='linux katipo2 3.18.3-aufs #21 smp preempt mon jan 26 09​:49​:29 nzdt 2015 x86_64 intel(r) core(tm) i5-2410m cpu @​ 2.30ghz genuineintel gnulinux '
  config_args='-de -Dprefix=/home/kent/perl5/perlbrew/perls/5.21.8-c -Dusecbacktrace -Doptimize=-O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions -Dman1dir=none -Dman3dir=none -Dusedevel -Accflags=-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -Aldflags= -fprofile-use -lbfd -Aeval​:scriptdir=/home/kent/perl5/perlbrew/perls/5.21.8-c/bin'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  use64bitint=define, use64bitall=define, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -DUSE_C_BACKTRACE -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions',
  cppflags='-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
  ccversion='', gccversion='4.9.2', 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 =' -fprofile-use -lbfd -fstack-protector-strong -L/usr/local/lib'
  libpth=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include-fixed /usr/lib /usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
  libs=-lpthread -lnsl -lnm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
  perllibs=-lpthread -lnsl -lnm -ldl -lm -lcrypt -lutil -lc
  libc=libc-2.20.so, so=so, useshrplib=false, libperl=libperl.a
  gnulibc_version='2.20'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  cccdlflags='-fPIC', lddlflags='-shared -O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions -L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
  uncommitted-changes


@​INC for perl 5.21.9​:
  /home/kent/perl5/perlbrew/perls/5.21.8-c/lib/site_perl/5.21.9/x86_64-linux
  /home/kent/perl5/perlbrew/perls/5.21.8-c/lib/site_perl/5.21.9
  /home/kent/perl5/perlbrew/perls/5.21.8-c/lib/5.21.9/x86_64-linux
  /home/kent/perl5/perlbrew/perls/5.21.8-c/lib/5.21.9
  .


Environment for perl 5.21.9​:
  HOME=/home/kent
  LANG (unset)
  LANGUAGE=
  LC_CTYPE=en_NZ.UTF8
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/home/kent/perl5/perlbrew/bin​:/home/kent/perl5/perlbrew/perls/5.21.8-c/bin​:/home/kent/.perl6/2013.04/bin​:/home/kent/.gem/ruby/1.8/bin/​:/home/kent/.rvm/gems/ruby-2.1.2/bin​:/home/kent/.rvm/gems/ruby-2.1.2@​global/bin​:/home/kent/.rvm/rubies/ruby-2.1.2/bin​:/usr/local/bin​:/usr/bin​:/bin​:/opt/bin​:/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2​:/usr/games/bin​:/home/kent/.rvm/bin​:/home/kent/.rvm/bin
  PERLBREW_BASHRC_VERSION=0.72
  PERLBREW_HOME=/home/kent/.perlbrew
  PERLBREW_MANPATH=/home/kent/perl5/perlbrew/perls/5.21.8-c/man
  PERLBREW_PATH=/home/kent/perl5/perlbrew/bin​:/home/kent/perl5/perlbrew/perls/5.21.8-c/bin
  PERLBREW_PERL=5.21.8-c
  PERLBREW_ROOT=/home/kent/perl5/perlbrew
  PERLBREW_VERSION=0.72
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Mar 5, 2015

From @rgarcia

On 5 March 2015 at 14​:28, Kent Fredric <perlbug-followup@​perl.org> wrote​:

Perl 5.20.9​:

perl -e 'while(readline){ print $_ }' 'echo insecure |'
Can't open ls -la |​: No such file or directory at -e line 1.

perl 5.20.0​:

perl -e 'while(readline){ print $_ }' 'echo insecure |'
insecure

Good catch. This should be fixed by 0f6f92e.

More over, deparsing this syntax ( and the <<>> syntax ) returns code that behaves differently to the syntax offered.

---
perl -e 'while(readline){ print $_ }' 'echo insecure |'
Can't open ls -la |​: No such file or directory at -e line 1.

perl -MO=Deparse -e 'while(readline){ print $_ }' 'echo insecure |'
while (defined($_ = <ARGV>)) {
print $_;
}

perl -MO=Deparse -e 'while(<<>>){ print $_ }' 'echo hello |'
while (defined($_ = <ARGV>)) {
print $_;
}

perl -MO=Deparse -e 'while(<>){ print $_ }' 'echo hello |'
while (defined($_ = <ARGV>)) {
print $_;
}

perl -e 'while(defined($_ =<ARGV>)){ print $_ }' 'echo insecure |'
insecure
---

---
Flags​:
category=core
severity=low
---
Site configuration information for perl 5.21.9​:

Configured by kent at Wed Feb 11 00​:16​:37 NZDT 2015.

Summary of my perl5 (revision 5 version 21 subversion 9) configuration​:
Derived from​: 5904c5c
Platform​:
osname=linux, osvers=3.18.3-aufs, archname=x86_64-linux
uname='linux katipo2 3.18.3-aufs #21 smp preempt mon jan 26 09​:49​:29 nzdt 2015 x86_64 intel(r) core(tm) i5-2410m cpu @​ 2.30ghz genuineintel gnulinux '
config_args='-de -Dprefix=/home/kent/perl5/perlbrew/perls/5.21.8-c -Dusecbacktrace -Doptimize=-O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions -Dman1dir=none -Dman3dir=none -Dusedevel -Accflags=-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -Aldflags= -fprofile-use -lbfd -Aeval​:scriptdir=/home/kent/perl5/perlbrew/perls/5.21.8-c/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler​:
cc='cc', ccflags ='-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -DUSE_C_BACKTRACE -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions',
cppflags='-DPERL_HASH_FUNC_SDBM -DUSE_C_BACKTRACE_ON_ERROR -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong'
ccversion='', gccversion='4.9.2', 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 =' -fprofile-use -lbfd -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include-fixed /usr/lib /usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lpthread -lnsl -lnm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
perllibs=-lpthread -lnsl -lnm -ldl -lm -lcrypt -lutil -lc
libc=libc-2.20.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.20'
Dynamic Linking​:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O3 -march=native -mtune=native -g -ggdb3 -fprofile-use -finstrument-functions -L/usr/local/lib -fstack-protector-strong'

Locally applied patches​:
uncommitted-changes

---
@​INC for perl 5.21.9​:
/home/kent/perl5/perlbrew/perls/5.21.8-c/lib/site_perl/5.21.9/x86_64-linux
/home/kent/perl5/perlbrew/perls/5.21.8-c/lib/site_perl/5.21.9
/home/kent/perl5/perlbrew/perls/5.21.8-c/lib/5.21.9/x86_64-linux
/home/kent/perl5/perlbrew/perls/5.21.8-c/lib/5.21.9
.

---
Environment for perl 5.21.9​:
HOME=/home/kent
LANG (unset)
LANGUAGE=
LC_CTYPE=en_NZ.UTF8
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/kent/perl5/perlbrew/bin​:/home/kent/perl5/perlbrew/perls/5.21.8-c/bin​:/home/kent/.perl6/2013.04/bin​:/home/kent/.gem/ruby/1.8/bin/​:/home/kent/.rvm/gems/ruby-2.1.2/bin​:/home/kent/.rvm/gems/ruby-2.1.2@​global/bin​:/home/kent/.rvm/rubies/ruby-2.1.2/bin​:/usr/local/bin​:/usr/bin​:/bin​:/opt/bin​:/usr/x86_64-pc-linux-gnu/gcc-bin/4.9.2​:/usr/games/bin​:/home/kent/.rvm/bin​:/home/kent/.rvm/bin
PERLBREW_BASHRC_VERSION=0.72
PERLBREW_HOME=/home/kent/.perlbrew
PERLBREW_MANPATH=/home/kent/perl5/perlbrew/perls/5.21.8-c/man
PERLBREW_PATH=/home/kent/perl5/perlbrew/bin​:/home/kent/perl5/perlbrew/perls/5.21.8-c/bin
PERLBREW_PERL=5.21.8-c
PERLBREW_ROOT=/home/kent/perl5/perlbrew
PERLBREW_VERSION=0.72
PERL_BADLANG (unset)
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Mar 5, 2015

The RT System itself - Status changed from 'new' to 'open'

@p5pRT p5pRT closed this as completed Mar 5, 2015
@p5pRT
Copy link
Author

p5pRT commented Mar 5, 2015

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant