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

"no warnings 'exec'" does not disable "Statement unlikely to be reached" #13024

Closed
p5pRT opened this issue Jun 12, 2013 · 7 comments
Closed

"no warnings 'exec'" does not disable "Statement unlikely to be reached" #13024

p5pRT opened this issue Jun 12, 2013 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 12, 2013

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

Searchable as RT118455$

@p5pRT
Copy link
Author

p5pRT commented Jun 12, 2013

From @rjbs

Created by @rjbs

I don't have a program called "lll" in my path.

  ~$ perl -Mwarnings -E 'exec "lll"; say "oops"'
  Statement unlikely to be reached at -e line 1.
  (Maybe you meant system() when you said exec()?)
  Can't exec "lll"​: No such file or directory at -e line 1.
  oops

I get two warnings, both "exec" category, as expected.

I don't want these. I will disable that category.

  perl -Mwarnings -E 'no warnings "exec"; exec "lll"; say "oops"'
  Statement unlikely to be reached at -e line 1.
  (Maybe you meant system() when you said exec()?)
  oops

I only managed to disable one of them!

The docs in perldiag make it clear how to disable this warning, and that
works. Fine. But why can't it also be disabled like any other lexical
warning?

More​:

With only unrelated warnings turned on, no warning. Great.

  ~$ perl -E 'use warnings "exiting"; exec "lll"; say "oops"'
  oops

Turning on the "exec" category does not *enable* the warning​:

  ~$ perl -E 'use warnings "exec"; exec "lll"; say "oops"'
  Can't exec "lll"​: No such file or directory at -e line 1.
  oops

Turning off all warnings *does* disable the warning​:

  ~$ perl -E 'use warnings; no warnings; exec "lll"; say "oops"'
  oops

Looking at the difference between the two warnings (in op.c and doio.c)
didn't make it obviously clear to me what differs.

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl 5.19.0:

Configured by rjbs at Mon May 20 10:59:20 EDT 2013.

Summary of my perl5 (revision 5 version 19 subversion 0) configuration:
   
  Platform:
    osname=darwin, osvers=12.3.0, archname=darwin-2level
    uname='darwin walrus.local 12.3.0 darwin kernel version 12.3.0: sun jan 6 22:37:10 pst 2013; root:xnu-2050.22.13~1release_x86_64 x86_64 '
    config_args='-de -Dprefix=/Users/rjbs/perl5/perlbrew/perls/19.0 -Dusedevel -Aeval:scriptdir=/Users/rjbs/perl5/perlbrew/perls/19.0/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.57))', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags =' -fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector'

Locally applied patches:
    


@INC for perl 5.19.0:
    /Users/rjbs/.perlbrew/libs/19.0@std/lib/perl5/darwin-2level
    /Users/rjbs/.perlbrew/libs/19.0@std/lib/perl5
    /Users/rjbs/perl5/perlbrew/perls/19.0/lib/site_perl/5.19.0/darwin-2level
    /Users/rjbs/perl5/perlbrew/perls/19.0/lib/site_perl/5.19.0
    /Users/rjbs/perl5/perlbrew/perls/19.0/lib/5.19.0/darwin-2level
    /Users/rjbs/perl5/perlbrew/perls/19.0/lib/5.19.0
    .


Environment for perl 5.19.0:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/rjbs
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/rjbs/.perlbrew/libs/19.0@std/bin:/Users/rjbs/perl5/perlbrew/bin:/Users/rjbs/perl5/perlbrew/perls/19.0/bin:/Users/rjbs/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/rjbs/code/hla
    PERL5LIB=/Users/rjbs/.perlbrew/libs/19.0@std/lib/perl5
    PERLBREW_BASHRC_VERSION=0.63
    PERLBREW_HOME=/Users/rjbs/.perlbrew
    PERLBREW_LIB=std
    PERLBREW_MANPATH=/Users/rjbs/.perlbrew/libs/19.0@std/man:/Users/rjbs/perl5/perlbrew/perls/19.0/man
    PERLBREW_PATH=/Users/rjbs/.perlbrew/libs/19.0@std/bin:/Users/rjbs/perl5/perlbrew/bin:/Users/rjbs/perl5/perlbrew/perls/19.0/bin
    PERLBREW_PERL=19.0
    PERLBREW_ROOT=/Users/rjbs/perl5/perlbrew
    PERLBREW_VERSION=0.63
    PERLDOC=-n/opt/local/bin/groff
    PERL_AUTOINSTALL=--skipdeps
    PERL_BADLANG (unset)
    PERL_LOCAL_LIB_ROOT=/Users/rjbs/.perlbrew/libs/19.0@std
    PERL_MAILERS=sendmail:/Users/rjbs/bin/sendmail
    PERL_MB_OPT=--install_base /Users/rjbs/.perlbrew/libs/19.0@std
    PERL_MM_OPT=INSTALL_BASE=/Users/rjbs/.perlbrew/libs/19.0@std
    SHELL=/opt/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jun 12, 2013

From @rjbs

I have pushed 3cf2ee4e44b339198562fa5f52af6a52e85d52a8 as smoke-me/rjbs/exec-
warning.

Please give it a look, anybody, and comment before I merge in a day or three.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Jun 12, 2013

@rjbs - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 13, 2013

From @cpansprout

On Wed Jun 12 12​:53​:10 2013, rjbs wrote​:

I have pushed 3cf2ee4e44b339198562fa5f52af6a52e85d52a8 as smoke-
me/rjbs/exec-
warning.

Please give it a look, anybody, and comment before I merge in a day or
three.

The fix looks perfectly correct to me.

Interestingly....

599cee7 (Aug 98) put it in the syntax category. eeb6a2c (Jan
2000, entitled ‘wrong category for exec() warning’) made it inconsistent.

So ‘use warnings "syntax"’ enables that warning. ‘use warnings FATAL =>
'exec'’ fatalizes it; but, of course, it is only fatal if it happens,
which is when ‘syntax’ warnings are enabled. Fascinating. :-)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 13, 2013

From @rjbs

* Father Chrysostomos via RT <perlbug-followup@​perl.org> [2013-06-12T21​:08​:04]

So ‘use warnings "syntax"’ enables that warning. ‘use warnings FATAL =>
'exec'’ fatalizes it; but, of course, it is only fatal if it happens,
which is when ‘syntax’ warnings are enabled. Fascinating. :-)

Yeah, once the ckWARN was pointed out, this behavior became clear, and I stared
slack-jawed at my oneliners for a while.

I will merge this fix tonight or tomorrow.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2013

From @cpansprout

On Thu Jun 13 06​:14​:07 2013, perl.p5p@​rjbs.manxome.org wrote​:

I will merge this fix tonight or tomorrow.

as 573d2b1.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jun 21, 2013

@cpansprout - Status changed from 'open' 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