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

use strict; broken in some situations in 5.28+ #17254

Closed
simcop2387 opened this issue Nov 4, 2019 · 3 comments
Closed

use strict; broken in some situations in 5.28+ #17254

simcop2387 opened this issue Nov 4, 2019 · 3 comments

Comments

@simcop2387
Copy link
Contributor

simcop2387 commented Nov 4, 2019

Description
In a narrow situation, use strict allows some undeclared names to be used as string literals, when it previously didn't in pre-5.28 releases. This was initially reported by Lintian maintainer Felix Lechner on IRC earlier today. Ether did some digging and found that it was introduced in 5.27.6 and has given a guess that it's related to OP_MULTICONCAT but no bisection has happened yet to confirm this.

Steps to Reproduce
Reproduces: perl -wle'use strict; use warnings; sub foo { "foo" }; print foo() . SLASH . "bar"'
Doesn't Reproduce: perl -wle'use strict; use warnings; print "foo" . SLASH . "bar"'

Expected behavior
There should be an error from use strict about the use of SLASH in this manner

Perl configuration

Summary of my perl5 (revision 5 version 28 subversion 2) configuration:
   
  Platform:
    osname=linux
    osvers=5.1.11-x86_64-linode127
    archname=x86_64-linux
    uname='linux simcop2387.info 5.1.11-x86_64-linode127 #1 smp preempt mon jun 17 21:18:26 utc 2019 x86_64 gnulinux '
    config_args='-Dprefix=/home/perlbot/perl5/custom/5.28.2 -de -Dusedevel -Duseshrplib -Dusemymalloc=y -Accflags=-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb  -DPERL_EMERGENCY_SBRK -Aldflags=-Wl,-z,now -Wl,-zrelro -Wl,-z,noexecstack -A'eval:scriptdir=/home/perlbot/perl5/custom/5.28.2/bin''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=y
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb -DPERL_EMERGENCY_SBRK -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    optimize='-O2'
    cppflags='-fpie -fPIC -mtune=native -fstack-protector-all -pie -D_FORTIFY_SOURCE=2 -ggdb -DPERL_EMERGENCY_SBRK -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='8.3.0'
    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 =' -Wl,-z,now -Wl,-zrelro -Wl,-z,noexecstack -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.28.so
    so=so
    useshrplib=true
    libperl=libperl.so
    gnulibc_version='2.28'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E -Wl,-rpath,/home/perlbot/perl5/custom/5.28.2/lib/5.28.2/x86_64-linux/CORE'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    MYMALLOC
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_DEVEL
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
  Locally applied patches:
    Devel::PatchPerl 1.64
  Built under linux
  Compiled at Aug 23 2019 17:24:22
  %ENV:
    PERLBREW_HOME="/home/ryan/.perlbrew"
    PERLBREW_MANPATH="/home/ryan/perl5/perlbrew/perls/perlbot-mainbot/man"
    PERLBREW_PATH="/home/ryan/perl5/perlbrew/bin:/home/ryan/perl5/perlbrew/perls/perlbot-mainbot/bin"
    PERLBREW_PERL="perlbot-mainbot"
    PERLBREW_ROOT="/home/ryan/perl5/perlbrew"
    PERLBREW_SHELLRC_VERSION="0.84"
    PERLBREW_VERSION="0.84"
  @INC:
    /home/perlbot/perl5/custom/5.28.2/lib/site_perl/5.28.2/x86_64-linux
    /home/perlbot/perl5/custom/5.28.2/lib/site_perl/5.28.2
    /home/perlbot/perl5/custom/5.28.2/lib/5.28.2/x86_64-linux
    /home/perlbot/perl5/custom/5.28.2/lib/5.28.2

On IRC ether did a bit of diagnosis and work to try to identify what happened:

13:41:12 < ether> looks like it happened between 5.27.5 and 5.27.6. to get down to the exact commit requires a bisection in blead
13:41:24 < simcop2387> ether++
13:41:37 < ether> 5.27.6 was my release hangs head
...
13:42:49 < ether> demonstrates the issue: perl -wle'use strict; use warnings; sub foo { "foo" }; print foo() . SLASH . "bar"'
13:42:56 < ether> does not : perl -wle'use strict; use warnings; print "foo" . SLASH . "bar"'
13:43:16 < ether> so it's something peculiar in how the sub is parsed
...
13:48:04 < ether> 5.27.6 contained the first set of changes for OP_MULTICONCAT -- I bet it happened in there
13:48:28 < simcop2387> ether: that makes sense, that changed how a lot of the parsing went to optimize it right?
13:48:38 < ether> yup

@simcop2387
Copy link
Contributor Author

A quick demo of it on each stable branch is at https://perl.bot/p/5mxjc9

@wolfsage
Copy link
Contributor

wolfsage commented Nov 4, 2019

bad - zero exit from ./perl -Ilib -e use strict; sub f { "f" } my $x = f . zoo
e839e6ed99c6b25aee589f56bb58de2f8fa00f41 is the first bad commit
commit e839e6ed99c6b25aee589f56bb58de2f8fa00f41
Author: David Mitchell <davem@iabyn.com>
Date:   Tue Aug 8 18:42:14 2017 +0100

    Add OP_MULTICONCAT op

@tonycoz
Copy link
Contributor

tonycoz commented Nov 4, 2019

Fixed by a6d5b82

@tonycoz tonycoz closed this as completed Nov 4, 2019
nschloe pushed a commit to live-clones/lintian that referenced this issue Nov 6, 2019
…alculations.

The name of the directory 'basedir' was confusing because it was used
for the Lab, the Pool and for each group. This change clarifies when
the group directory is being used.

The group directory is the holding directory for all the analysis
related to a 'group' of files, which ordinarily derive from the same
source package and have the same version.

Also, a 'convenience function' for path calculations in Processable
was removed. This uses Path::Tiny for path calculations instead.

It may be possible to use string concatenation to avoid overhead and
module load times, except the author recently found a bug in Perl in
that circumstance:

    Perl/perl5#17254

Path::Tiny is well-tested module that may come in handy for other file
or path related operations in checks in the future.

Gbp-Dch: ignore
nschloe pushed a commit to live-clones/lintian that referenced this issue Nov 6, 2019
… path calculations.

The name of the directory 'basedir' was confusing because it was used
for the Lab, the Pool and for each group. This change clarifies when
the group directory is being used.

The group directory is the holding directory for all the analysis
related to a 'group' of files, which ordinarily derive from the same
source package and have the same version.

Also, a 'convenience function' for path calculations in Processable
was removed. This uses Path::Tiny for path calculations instead.

It may be possible to use string concatenation to avoid overhead and
module load times, except the author recently found a bug in Perl in
that circumstance:

    Perl/perl5#17254

Path::Tiny is well-tested module that may come in handy for other file
or path related operations for data consumers in the future.

Gbp-Dch: ignore
nschloe pushed a commit to live-clones/lintian that referenced this issue Nov 6, 2019
…for path calculations.

The name of the directory 'basedir' was confusing because it was used
for the Lab, the Pool and for each group. This change clarifies when
the group directory is being used.

The group directory is the holding directory for all the analysis
related to a 'group' of files, which ordinarily derive from the same
source package and have the same version.

Also, a 'convenience function' for path calculations in Processable
was removed. This uses Path::Tiny for path calculations instead.

It may be possible to use string concatenation to avoid overhead and
module load times, except the author recently found a bug in Perl in
that circumstance:

    Perl/perl5#17254

Path::Tiny is well-tested module that may come in handy for other file
or path related operations for data consumers in the future.

Gbp-Dch: ignore
nschloe pushed a commit to live-clones/lintian that referenced this issue Nov 6, 2019
… path calculations.

The name of the directory 'basedir' was confusing because it was used
for the Lab, the Pool and for each group. This change clarifies when
the group directory is being used.

The group directory is the holding directory for all the analysis
related to a 'group' of files, which ordinarily derive from the same
source package and have the same version.

Also, a 'convenience function' for path calculations in Processable
was removed. This uses Path::Tiny for path calculations instead.

It may be possible to use string concatenation to avoid overhead and
module load times, except the author recently found a bug in Perl in
that circumstance:

    Perl/perl5#17254

Path::Tiny is well-tested module that may come in handy for other file
or path related operations in Lintian::Tags in the future.

Gbp-Dch: ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants