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

[PATCH] -mpragma (eg strict) fail silent blindsiding #15998

Closed
p5pRT opened this issue Jun 6, 2017 · 8 comments
Closed

[PATCH] -mpragma (eg strict) fail silent blindsiding #15998

p5pRT opened this issue Jun 6, 2017 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 6, 2017

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

Searchable as RT131518$

@p5pRT
Copy link
Author

p5pRT commented Jun 6, 2017

From ronaldxs@software-path.com

Created by ronaldxs@software-path.com

document -mpragma (eg strict) fail silent

"perl -Mstrict" is used all the time and I noticed that "perl -mstrict"
(lower case -m) runs without "strict" being in effect. It seems to
me to be a potentially dangerous surprise and while the docs note that
"-m" uses an empty import list it also seems to currently take a little
too much expertise and digging to understand the effect of the empty
import list on pragma(ta|s).

A programmer using Perl should not need to know how to write a custom
pragma to understand that -mstrict does not work because of the empty
import list. This patch to perlrun.pod is a proposed remedy.

Perl Info

Flags:
     category=docs
     severity=low
     Type=Patch
     PatchStatus=HasPatch

Site configuration information for perl 5.26.0:

Configured by ron at Mon Jun  5 13:50:57 EDT 2017.

Summary of my perl5 (revision 5 version 26 subversion 0) configuration:
   Local Commit: b85ff045c4480eca8989420062c698a819c47105
   Ancestor: 5ad96e9e32a29f927d3e9dec23fd1d7d3e89665f
   Platform:
     osname=linux
     osvers=4.4.0-31-generic
     archname=x86_64-linux
     uname='linux ws-ubuntu 4.4.0-31-generic #50~14.04.1-ubuntu smp wed 
jul 13 01:07:32 utc 2016 x86_64 x86_64 x86_64 gnulinux '
     config_args=''
     hint=recommended
     useposix=true
     d_sigaction=define
     useithreads=undef
     usemultiplicity=undef
     use64bitint=define
     use64bitall=define
     uselongdouble=undef
     usemymalloc=n
     default_inc_excludes_dot=define
     bincompat5005=undef
   Compiler:
     cc='cc'
     ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
     optimize='-O2'
     cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector 
-I/usr/local/include'
     ccversion=''
     gccversion='4.8.4'
     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 =' -fstack-protector -L/usr/local/lib'
     libpth=/usr/local/lib 
/usr/lib/gcc/x86_64-linux-gnu/4.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 -ldl -lm -lcrypt -lutil -lc 
-lgdbm_compat
     perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
     libc=libc-2.19.so
     so=so
     useshrplib=false
     libperl=libperl.a
     gnulibc_version='2.19'
   Dynamic Linking:
     dlsrc=dl_dlopen.xs
     dlext=so
     d_dlsymun=undef
     ccdlflags='-Wl,-E'
     cccdlflags='-fPIC'
     lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'

Locally applied patches:
     b85ff045c4480eca8989420062c698a819c47105


@INC for perl 5.26.0:
     lib
     /usr/local/lib/perl5/site_perl/5.26.0/x86_64-linux
     /usr/local/lib/perl5/site_perl/5.26.0
     /usr/local/lib/perl5/5.26.0/x86_64-linux
     /usr/local/lib/perl5/5.26.0


Environment for perl 5.26.0:
     HOME=/home/ron
     LANG=en_US.UTF-8
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     
PATH=/home/ron/perl5/perlbrew/bin:/home/ron/.rvm/gems/ruby-2.4.0-rc1/bin:/home/ron/.rvm/gems/ruby-2.4.0-rc1@global/bin:/home/ron/.rvm/rubies/ruby-2.4.0-rc1/bin:/home/ron/.rakudobrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/ron/.rakudobrew/moar-nom/install/share/perl6/site/bin:/home/ron/bin:/home/ron/.rvm/bin
     PERLBREW_BASHRC_VERSION=0.78
     PERLBREW_HOME=/home/ron/.perlbrew
     PERLBREW_PATH=/home/ron/perl5/perlbrew/bin
     PERLBREW_ROOT=/home/ron/perl5/perlbrew
     PERLBREW_VERSION=0.78
     PERL_BADLANG (unset)
     SHELL=/bin/bash


@p5pRT
Copy link
Author

p5pRT commented Jun 6, 2017

From ronaldxs@software-path.com

0001-perlrun-warn-on-mpragma-eg-strict-blindsiding.patch
From b85ff045c4480eca8989420062c698a819c47105 Mon Sep 17 00:00:00 2001
From: Ronald Schmidt <ronaldxs@software-path.com>
Date: Mon, 29 May 2017 14:41:49 -0400
Subject: [PATCH] perlrun: warn on -mpragma (eg strict) blindsiding

A programmer using Perl should not need to know how to write a custom
pragma to understand that -mstrict does not work because of the empty
import list.
---
 pod/perlrun.pod | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/pod/perlrun.pod b/pod/perlrun.pod
index dff9f71..5edeb35 100644
--- a/pod/perlrun.pod
+++ b/pod/perlrun.pod
@@ -685,6 +685,11 @@ A consequence of this is that B<-MI<MODULE>=number> never does a version check,
 unless C<I<MODULE>::import()> itself is set up to do a version check, which
 could happen for example if I<MODULE> inherits from L<Exporter>.
 
+Lowercase B<-m> should not be expected to work for a pragma (eg C<strict>)
+since the empty import list - C<()> - prevents the call to import usually used
+by a pragma set active and other status for the current scope.  See
+L<perlpragma>.
+
 =item B<-n>
 X<-n>
 
-- 
1.9.1

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2017

From @jkeenan

On Tue, 06 Jun 2017 14​:44​:56 GMT, ronaldxs wrote​:

This is a bug report for perl from ronaldxs@​software-path.com,
generated with the help of perlbug 1.40 running under perl 5.26.0.

-----------------------------------------------------------------
[Please describe your issue here]
document -mpragma (eg strict) fail silent

"perl -Mstrict" is used all the time and I noticed that "perl
-mstrict"
(lower case -m) runs without "strict" being in effect. It seems to
me to be a potentially dangerous surprise and while the docs note that
"-m" uses an empty import list it also seems to currently take a
little
too much expertise and digging to understand the effect of the empty
import list on pragma(ta|s).

A programmer using Perl should not need to know how to write a custom
pragma to understand that -mstrict does not work because of the empty
import list. This patch to perlrun.pod is a proposed remedy.

I think your argument is correct and the patch should be applied. However, I think something is amiss in the syntax of this part​:

#####
... prevents the call to import usually used by a pragma set active and other status for the current scope
#####

Something about "set active and other status" doesn't sound right. Can you clarify?

Thank you very much.

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

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Dec 30, 2017

From zefram@fysh.org

Fixed with a different documentation edit in commit
e2bcc7d.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Jan 1, 2018

@xsawyerx - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

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

1 participant