Skip to content

no warnings doesn't overrule use warnings #1621

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

Closed
p5pRT opened this issue Mar 30, 2000 · 6 comments
Closed

no warnings doesn't overrule use warnings #1621

p5pRT opened this issue Mar 30, 2000 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 30, 2000

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

Searchable as RT2859$

@p5pRT
Copy link
Author

p5pRT commented Mar 30, 2000

From @andk

Created by [email protected]

Thanks to a bugreport by Larry Virden I could track down various warnings that
sometimes appear during CPAN.pm's r command. These can be traced back to the
following smaller testcase. The testcase is based on code found in CGI​::Base.

% perl -we '
use warnings;
{
  my $eval = q[
  package ExtUtils​::MakeMaker​::_version;
  no strict;

  local $VERSION;
  $VERSION=undef; do {
  ($VERSION = $Revision) =~ s/.*(\d+\.\d+).*/$1/;
  }; $VERSION
  ];
  no warnings;
  eval($eval);
}
'
Use of uninitialized value in substitution (s///) at (eval 1) line 7.
%

I would expect that this should be silent.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.6.0:

Configured by k at Thu Mar 23 23:27:40 CET 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.15pre14, archname=i686-linux
    uname='linux ak-71.mind.de 2.2.15pre14 #1 smp wed mar 15 15:37:15 cet 2000 i686 unknown '
    config_args='-Dprefix=/usr/local/perl-5.6.0 -Doptimize=-g -Dusemymalloc -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='cc', optimize='-g', gccversion=egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt
    libc=/lib/libc-2.1.2.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr/local/perl-5.6.0/lib/5.6.0/i686-linux
    /usr/local/perl-5.6.0/lib/5.6.0
    /usr/local/perl-5.6.0/lib/site_perl/5.6.0/i686-linux
    /usr/local/perl-5.6.0/lib/site_perl/5.6.0
    /usr/local/perl-5.6.0/lib/site_perl
    .


Environment for perl v5.6.0:
    HOME=/home/k
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=en_US
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/k/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/perl/bin:/usr/X11/bin:/sbin:/usr/sbin:/usr/local/Office51/bin
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


@p5pRT
Copy link
Author

p5pRT commented Apr 2, 2000

From @pmqs

From​: Andreas J. Koenig [mailto​:k@​ak-71.mind.de]

...

Thanks to a bugreport by Larry Virden I could track down various warnings
that
sometimes appear during CPAN.pm's r command. These can be traced back to
the
following smaller testcase. The testcase is based on code found in
CGI​::Base.

% perl -we '
use warnings;
{
my $eval = q[
package ExtUtils​::MakeMaker​::_version;
no strict;

        local $VERSION;
        $VERSION=undef; do \{
            \($VERSION = $Revision\) =~ s/\.\*\(\\d\+\\\.\\d\+\)\.\*/$1/;
        \}; $VERSION
    \];

no warnings;
eval($eval);
}
'
Use of uninitialized value in substitution (s///) at (eval 1) line 7.
%

I would expect that this should be silent.

Good catch! I amazed that didn't get picked up before.

Here is a patch that fixes it.

Paul

begin 664 lexwarn.eval.patch.gz
M'XL("!YXYS@​"`VQE>'=A<FXN979A;"YP871C​:`#M7&MSFT87_FS_BA,[,R2Q
M);&+;N!IIVZBMNZT'M=VDW8ZK0>AE6`L`07D2S/Y[STL2`(+!!(@​Z;UHDECL
MGK/L>?9<GET<CN'P&&XM4&U[_`R>;KA@​JYZF*]A\<]N[`J+`>WU@​..!9V,W`
MM​::.Q@​!;F.99SG-])D@​5N)Z​:7$;@​H_%Q!+`=​:^2H$W@​T/#UR`Q@​​:8P​:J"X9I
M3ST<!<>Y&,*S-86!!​:;E@​​:X^Q(<Z!<,#KN]X8`V#6TW4>S​:[DZK=JR.&`WFZ
MZO&A--6$(>.W<ZP)UWAO36R'Z<QT#1S_BCEC.'<TW;^X9-ZCY=S[MNN>9RN-
MQN/C8]U&D;IF31KOK\XO&^K4TRW';?QHZ​:IY]Q%'54VW,9]%[​:G^7/=4IS[Z
MQS<HP$/M6SCZK]<_G8+P)("K6]/Q`/H,*%@​.Z,9(9TZ`0,)*<."LJ<='FKK,
MMSR*2K&52EVDY>7!#_3,@​7__*X>IDSX*^(V'0=<5G^Q`]5086N.Q]>@​&O0-C
M.(2​:AK="'&NM>KLN-FS[3O,05"'​:6C/9XZ+G\,(<L"<%ZO.FPW?OWD4N#VZG
M#'Y6'​:`$Q);2I`IM`Q5%\;!6JT7E;M#6<]L!1)MT%"(K1`SDWL4_?'R)MLDI
M_M,%W@​3\<W/^L??#Q>7MS9NW9V'3U4]WNF%Z+GSE?[7LVM>6?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z
M"A<S8]F*V*M%%J\1B;Q<Y-Q_WTG​:&T​:.X8/?AM[H&I8YPUX!4A>#/@​8C9C*'
M'P2$??&**,D*D8.*>`S?SV7[SXO!YF]X03_B8M=,FSKNXOTJ!G-1['?F8M]#
M^&*5,7M@​X[HN@​"32%L@​MJ=-JMV0"DD0[,LK9*#=_%0HAS7​:W@​U+-MDREE@​@​B
M$<5.IQ/();WDH=4A8B!/*&[M5\B'OR)"NRV​:3R%\8D>)U,FG,#\J08UV/I4%
M=2(=*B7I1/SBI0=$G"/F.?>82?[0'.8O8/HR_QEZCJ_.(\​:=3A3H(N\AW7​:W
/#1+.ATO\"S$WW[0@​20``
`
end

@p5pRT
Copy link
Author

p5pRT commented Apr 2, 2000

From @andk

On Sun, 2 Apr 2000 20​:22​:34 +0100 , "Marquess,P,Paul,NEL38 R" <paul.marquess@​bt.com> said​:

Here is a patch that fixes it.

Thanks, Paul. Amazing new tests, and

All tests successful.
u=1.82 s=0.68 cu=112.94 cs=13.59 scripts=230 tests=11830

@p5pRT
Copy link
Author

p5pRT commented Apr 24, 2000

From @gsar

On Thu, 30 Mar 2000 13​:38​:08 +0200, "Andreas J. Koenig" wrote​:

Thanks to a bugreport by Larry Virden I could track down various warnings that
sometimes appear during CPAN.pm's r command. These can be traced back to the
following smaller testcase. The testcase is based on code found in CGI​::Base.

% perl -we '
use warnings;
{
my $eval = q[
package ExtUtils​::MakeMaker​::_version;
no strict;

       local $VERSION;
       $VERSION=undef; do \{
           \($VERSION = $Revision\) =~ s/\.\*\(\\d\+\\\.\\d\+\)\.\*/$1/;
       \}; $VERSION
   \];

no warnings;
eval($eval);
}
'
Use of uninitialized value in substitution (s///) at (eval 1) line 7.
%

I would expect that this should be silent.

Try this patch.

Sarathy
gsar@​ActiveState.com

Inline Patch
-----------------------------------8<-----------------------------------
Change 5934 by gsar@auger on 2000/04/24 17:16:54

	propagate lexical warnings from surrounding scope correctly
	within string eval()

Affected files ...

... //depot/perl/pp_ctl.c#198 edit
... //depot/perl/t/pragma/warn/pp_ctl#11 edit

Differences ...

==== //depot/perl/pp_ctl.c#198 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c.~1~	Mon Apr 24 10:16:59 2000
+++ perl/pp_ctl.c	Mon Apr 24 10:16:59 2000
@@ -3261,9 +3261,11 @@
     SAVEHINTS();
     PL_hints = PL_op->op_targ;
     SAVESPTR(PL_compiling.cop_warnings);
-    if (!specialWARN(PL_compiling.cop_warnings)) {
-        PL_compiling.cop_warnings = newSVsv(PL_compiling.cop_warnings) ;
-        SAVEFREESV(PL_compiling.cop_warnings) ;
+    if (specialWARN(PL_curcop->cop_warnings))
+        PL_compiling.cop_warnings = PL_curcop->cop_warnings;
+    else {
+        PL_compiling.cop_warnings = newSVsv(PL_curcop->cop_warnings);
+        SAVEFREESV(PL_compiling.cop_warnings);
     }
 
     push_return(PL_op->op_next);

==== //depot/perl/t/pragma/warn/pp_ctl#11 (text) ====
Index: perl/t/pragma/warn/pp_ctl
--- perl/t/pragma/warn/pp_ctl.~1~	Mon Apr 24 10:16:59 2000
+++ perl/t/pragma/warn/pp_ctl	Mon Apr 24 10:16:59 2000
@@ -214,4 +214,17 @@
 { bless ['A'], 'Foo' for 1..10 }
 { bless ['B'], 'Foo' for 1..10 }
 EXPECT
-
+########
+# pp_ctl.c
+use warnings;
+eval 'print $foo';
+EXPECT
+Use of uninitialized value in print at (eval 1) line 1.
+########
+# pp_ctl.c
+use warnings;
+{
+    no warnings;
+    eval 'print $foo';
+}
+EXPECT
End of Patch.

@p5pRT
Copy link
Author

p5pRT commented Apr 24, 2000

From @gsar

On Mon, 24 Apr 2000 10​:25​:08 PDT, I wrote​:

Change 5934 by gsar@​auger on 2000/04/24 17​:16​:54

propagate lexical warnings from surrounding scope correctly
within string eval()

Wups, I missed the same fix that Paul had sent due to the different subject
line. I've added his much improved testsuite for the same.

Sarathy
gsar@​ActiveState.com

@p5pRT
Copy link
Author

p5pRT commented Apr 26, 2000

From @pmqs

From​: Gurusamy Sarathy [mailto​:gsar@​ActiveState.com]

On Mon, 24 Apr 2000 10​:25​:08 PDT, I wrote​:

Change 5934 by gsar@​auger on 2000/04/24 17​:16​:54

propagate lexical warnings from surrounding scope correctly
within string eval()

Wups, I missed the same fix that Paul had sent due to the different
subject
line. I've added his much improved testsuite for the same.

Thanks Sarathy.

Paul

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