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

Exporter doesn't check that the exported symbols exist #15935

Open
p5pRT opened this issue Mar 28, 2017 · 5 comments
Open

Exporter doesn't check that the exported symbols exist #15935

p5pRT opened this issue Mar 28, 2017 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 28, 2017

Migrated from rt.perl.org#131070 (status was 'open')

Searchable as RT131070$

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2017

From steve@yewtc.demon.co.uk

Created by steve@yewtc.demon.co.uk

Someone accidently deleted the first character of an entry in the
@​EXPORT array for one of our modules. Is was surprised that the
code compiled successfully without warnings. Not even perlcritic
in it's most severe level picked it up. I realise that it could be
that the symbols could be created later with say AUTOLOAD, but that
is probably a rare case. Most times something is in the @​EXPORT
array the elements should correspond to real subs or whatver.
Probably there ought to be an Exporter option for "scrict" mode
- or something else. This happens with perl 5.10.1 and 5.24.1.

Perl Info

Flags:
    category=library
    severity=low
    module=Exporter

This perlbug was built using Perl 5.24.1 - Wed Mar  8 16:26:10 UTC 2017
It is being executed now by  Perl 5.24.1 - Wed Mar  8 16:20:44 UTC 2017.

Site configuration information for perl 5.24.1:

Configured by Red Hat, Inc. at Wed Mar  8 16:20:44 UTC 2017.

Summary of my perl5 (revision 5 version 24 subversion 1) configuration:
   
  Platform:
    osname=linux, osvers=4.10.1-1.fc25.x86_64, archname=x86_64-linux-thread-multi
    uname='linux buildvm-27.phx2.fedoraproject.org 4.10.1-1.fc25.x86_64 #1 smp mon feb 27 20:37:34 utc 2017 x86_64 x86_64 x86_64 gnulinux '
    config_args='-des -Doptimize=none -Dccflags=-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches  -m64 -mtune=generic -Dldflags=-Wl,-z,relro  -Dccdlflags=-Wl,--enable-new-dtags -Wl,-z,relro  -Dlddlflags=-shared -Wl,-z,relro  -Dshrpdir=/usr/lib64 -DDEBUGGING=-g -Dversion=5.24.1 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallu
 srbinper
 l=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize -Duse64bitint1'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='  -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='6.3.1 20161221 (Red Hat 6.3.1-1)', 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='gcc', ldflags ='-Wl,-z,relro  -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib64 /lib64 /usr/lib64 /usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib
    libs=-lpthread -lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lresolv -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.24.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.24'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-z,relro '
    cccdlflags='-fPIC', lddlflags='-shared -Wl,-z,relro  -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    Fedora Patch1: Removes date check, Fedora/RHEL specific
    Fedora Patch3: support for libdir64
    Fedora Patch4: use libresolv instead of libbind
    Fedora Patch5: USE_MM_LD_RUN_PATH
    Fedora Patch6: Provide MM::maybe_command independently (bug #1129443)
    Fedora Patch7: Dont run one io test due to random builder failures
    Fedora Patch15: Define SONAME for libperl.so
    Fedora Patch16: Install libperl.so to -Dshrpdir value
    Fedora Patch22: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)
    Fedora Patch26: Make *DBM_File desctructors thread-safe (RT#61912)
    Fedora Patch27: Make PadlistNAMES() lvalue again (CPAN RT#101063)
    Fedora Patch28: Make magic vtable writable as a work-around for Coro (CPAN RT#101063)
    Fedora Patch30: Replace EU::MakeMaker dependency with EU::MM::Utils in IPC::Cmd (bug #1129443)
    Fedora Patch31: Fix a memory leak in compiling a POSIX class (RT#128313)
    Fedora Patch32: Do not mangle errno from failed socket calls (RT#128316)
    Fedora Patch33: Fix compiling regular expressions like /\X*(?0)/ (RT#128109)
    Fedora Patch34: Do not use unitialized memory in $h{\const} warnings (RT#128189)
    Fedora Patch35: Fix precedence in hv_ename_delete (RT#128086)
    Fedora Patch36: Do not treat %: as a stash (RT#128238)
    Fedora Patch37: Do not crash when inserting a non-stash into a stash (RT#128238)
    Fedora Patch38: Fix line numbers with perl -x (RT#128508)
    Fedora Patch40: Fix a crash when vivifying a stub in a deleted package (RT#128532)
    Fedora Patch41: Fix a crash in "Subroutine redefined" warning (RT#128257)
    Fedora Patch42: Fix a crash in lexical scope warnings (RT#128597)
    Fedora Patch43: Fix handling \N{} in tr for characters in range 128--255 (RT#128734)
    Fedora Patch45: Fix crash in "evalbytes S" (RT#129196)
    Fedora Patch46: Fix crash in "evalbytes S" (RT#129196)
    Fedora Patch47: Fix crash in "evalbytes S" (RT#129196)
    Fedora Petch48: Fix crash in splice (RT#129164, RT#129166, RT#129167)
    Fedora Patch49: Fix string overrun in Perl_gv_fetchmethod_pvn_flags (RT#129267)
    Fedora Patch50: Fix string overrun in Perl_gv_fetchmethod_pvn_flags (RT#129267)
    Fedora Patch51: Fix string overrun in Perl_gv_fetchmethod_pvn_flags (RT#129267)
    Fedora Patch52: Fix string overrun in Perl_gv_fetchmethod_pvn_flags (RT#129267)
    Fedora Patch53: Fix string overrun in Perl_gv_fetchmethod_pvn_flags (RT#129267)
    Fedora Patch54: Fix crash when matching UTF-8 string with non-UTF-8 substrings (RT#129350)
    Fedora Patch55: Fix parsing perl options in shell bang line (RT#129336)
    Fedora Patch56: Fix firstchar bitmap under UTF-8 with prefix optimization (RT#129950)
    Fedora Patch57: Avoid infinite loop in h2xs tool if enum and type have the same name (RT130001)
    Fedora Patch58: Fix stack handling when calling chdir without an argument (RT#129130)
    Fedora Patch59: Fix crash in Storable when deserializing malformed code reference (RT#68348, RT#130098)
    Fedora Patch60: Fix crash on explicit return from regular expression substitution (RT#130188)
    Fedora Patch61: Fix assigning split() return values to an array
    Fedora Patch62: Fix const correctness in hv_func.h (RT#130169)
    Fedora Patch63: Fix a crash in optimized evaluation of "or ((0) x 0))" (RT#130247)
    Fedora Patch64: Fix a memory leak in IO::Poll (RT#129788)
    Fedora Patch65: Fix regular expression matching (RT#130307)
    Fedora Patch66: Fix a buffer overflow in split in scalar context (RT#130262)
    Fedora Patch67: Fix a heap overflow with pack "W" (RT129149)
    Fedora Patch69: Fix a use-after-free when processing scalar variables in forms (RT#129125)
    Fedora Patch70: Fix a heap overflow if invalid octal or hexadecimal number is used in transliteration expression (RT#129342)
    Fedora Patch71: Fix out-of-bound read in case of unmatched regexp backreference (RT#129377)
    Fedora Patch72: Fix UTF-8 string handling in & operator (RT#129287)
    Fedora Patch73: Fix recreation of *:: (RT#129869)
    Fedora Patch74: Fix a memory leak in B::RHE->HASH method (RT#130504)
    Fedora Patch75: Fix parsing goto statements in multicalled subroutine (RT#113938)
    Fedora Patch76: Fix a heap overlow in parsing $# (RT#129274)
    Fedora Patch77: Fix a crash when compiling a regexp with impossible quantifiers (RT#130561)
    Fedora Patch80: Fix a buffer overrun with format and "use bytes" (RT#130703)
    Fedora Patch81: Fix a buffer overflow when studying some regexps repeatedly (RT#129281, RT#129061)
    Fedora Patch83: Fix a heap buffer overflow when evaluating regexps with embedded code blocks from more than one source, RT#129881
    Fedora Patch84: Fix a memory leak in list assignment from or to magic values, (RT#130766)
    Fedora Patch85: Fix a null-pointer dereference on malformed code (RT#130815)
    Fedora Patch86: Fix an use-after-free in substr() that modifies a magic variable (RT#129340)
    Fedora Patch87: Fix a memory leak leak in Perl_reg_named_buff_fetch() (RT#130822)
    Fedora Patch88: Fix an invalid memory read when parsing a loop variable (RT#130814)
    Fedora Patch92: Fix a heap-use-after-free in four-arguments substr call (RT#130624)
    Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux
    Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux


@INC for perl 5.24.1:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5


Environment for perl 5.24.1:
    HOME=/home/steve
    LANG=en_GB.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/opt/android-studio/bin:/opt/rakudo-star-2016.07/bin:/opt/rakudo-star-2016.07/share/perl6/site/bin:/home/steve/.local/bin:/home/steve/bin:/opt/android-studio/bin:/opt/rakudo-star-2016.07/bin:/opt/rakudo-star-2016.07/share/perl6/site/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2017

From @jkeenan

On Tue, 28 Mar 2017 11​:44​:43 GMT, steve@​yewtc.demon.co.uk wrote​:

This is a bug report for perl from steve@​yewtc.demon.co.uk,
generated with the help of perlbug 1.40 running under perl 5.24.1.

-----------------------------------------------------------------
[Please describe your issue here]
Someone accidently deleted the first character of an entry in the
@​EXPORT array for one of our modules. Is was surprised that the
code compiled successfully without warnings. Not even perlcritic
in it's most severe level picked it up. I realise that it could be
that the symbols could be created later with say AUTOLOAD, but that
is probably a rare case. Most times something is in the @​EXPORT
array the elements should correspond to real subs or whatver.
Probably there ought to be an Exporter option for "scrict" mode
- or something else. This happens with perl 5.10.1 and 5.24.1.

Can you supply more details or a short program that reproduces the problem?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Mar 29, 2017

From steve@yewtc.demon.co.uk

On 28/03/17 13​:41, James E Keenan via RT wrote​:

On Tue, 28 Mar 2017 11​:44​:43 GMT, steve@​yewtc.demon.co.uk wrote​:

This is a bug report for perl from steve@​yewtc.demon.co.uk,
generated with the help of perlbug 1.40 running under perl 5.24.1.

-----------------------------------------------------------------
[Please describe your issue here]
Someone accidently deleted the first character of an entry in the
@​EXPORT array for one of our modules. Is was surprised that the
code compiled successfully without warnings. Not even perlcritic
in it's most severe level picked it up. I realise that it could be
that the symbols could be created later with say AUTOLOAD, but that
is probably a rare case. Most times something is in the @​EXPORT
array the elements should correspond to real subs or whatver.
Probably there ought to be an Exporter option for "scrict" mode
- or something else. This happens with perl 5.10.1 and 5.24.1.

Can you supply more details or a short program that reproduces the problem?
Interestingly if we do "sub1" as opposed to "sub1()" it gives a warning that
it can't find main​::sub1;

Steve

@p5pRT
Copy link
Author

p5pRT commented Mar 29, 2017

From steve@yewtc.demon.co.uk

### BadExporter.pm
package BadExporter;
use strict;
use warnings;

require Exporter;
our @​ISA = qw(Exporter);
our @​EXPORT = qw(
  ub1
  sub2
);

sub sub1 {
  print "sub1\n";
}

sub sub2 {
  print "sub2\n";
}

1;

###### bad_importing.pl
#!/usr/bin/env perl
use strict;
use warnings;

use BadExporter;

sub2();

sub1();

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

2 participants