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

deparse warning bits confusion #14404

Closed
p5pRT opened this issue Jan 7, 2015 · 4 comments
Closed

deparse warning bits confusion #14404

p5pRT opened this issue Jan 7, 2015 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 7, 2015

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

Searchable as RT123558$

@p5pRT
Copy link
Author

p5pRT commented Jan 7, 2015

From zefram@fysh.org

Created by zefram@fysh.org

Recent blead has acquired some bizarre behaviour around the
ambient_pragmas feature of the deparser​:

$ perl -le 'use B​::Deparse (); use warnings; $d = B​::Deparse->new; $d->ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo() })'
{
  foo();
}
$ perl -le 'use warnings; use B​::Deparse (); $d = B​::Deparse->new; $d->ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo() })'
{
  BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x05"}
  foo();
}
$ perl -le 'use warnings; use B​::Deparse (); use warnings; $d = B​::Deparse->new; $d->ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo() })'
{
  foo();
}

These situations should all be equivalent​: the code in question is
compiled with warnings "all" in effect, and the same pragmatic state
is declared as ambient for deparsing, so the deparser output should
not include anything setting the warning state. Yet in the second
case, where the warning state is set up before and not after loading
the deparser, the output does include a setting of the warning bits.
Previous versions of Perl did not misbehave in this manner.

This causes spurious test failures for Hash-SharedMem, as seen in these
test reports​:

http​://www.cpantesters.org/cpan/report/c5e167ea-9238-11e4-9827-205f3a6893cb
http​://www.cpantesters.org/cpan/report/8e72be90-9192-11e4-b4a2-c2bc3a6893cb
http​://www.cpantesters.org/cpan/report/f90158b4-90cc-11e4-8eb4-2b523a6893cb
http​://www.cpantesters.org/cpan/report/bb6b7a5e-8fee-11e4-af0a-a3765ef060ad

Perl Info

Flags:
    category=library
    severity=medium
    module=B::Deparse

Site configuration information for perl 5.21.8:

Configured by zefram at Tue Jan  6 23:50:17 GMT 2015.

Summary of my perl5 (revision 5 version 21 subversion 8) configuration:
  Commit id: 889df6895bc3b1d1658b4603a7a40f380f9f455c
  Platform:
    osname=linux, osvers=3.2.0-4-amd64, archname=x86_64-linux-thread-multi
    uname='linux barba.rous.org 3.2.0-4-amd64 #1 smp debian 3.2.57-3+deb7u1 x86_64 gnulinux '
    config_args='-des -Dprefix=/home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52 -Duselargefiles -Dusethreads -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib -Dusedevel -Uversiononly -Ui_db -DDEBUGGING'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.7.2', 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.7/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 -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.19.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.19'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52/lib/5.21.8/x86_64-linux-thread-multi/CORE'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'



@INC for perl 5.21.8:
    /home/zefram/usr/perl/pg/lib
    /home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52/lib/site_perl/5.21.8/x86_64-linux-thread-multi
    /home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52/lib/site_perl/5.21.8
    /home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52/lib/5.21.8/x86_64-linux-thread-multi
    /home/zefram/usr/perl/perl_install/perl-git-blead-i64-f52/lib/5.21.8
    .


Environment for perl 5.21.8:
    HOME=/home/zefram
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/home/zefram/usr/perl/pg
    LOGDIR (unset)
    PATH=/home/zefram/usr/perl/util:/home/zefram/pub/x86_64-unknown-linux-gnu/bin:/home/zefram/pub/common/bin:/usr/bin:/bin:/usr/local/bin:/usr/games
    PERL5LIB=/home/zefram/usr/perl/pg/lib
    PERLDOC=-oman
    PERL_BADLANG (unset)
    SHELL=/usr/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Feb 23, 2015

From @tonycoz

On Tue Jan 06 16​:17​:06 2015, zefram@​fysh.org wrote​:

Recent blead has acquired some bizarre behaviour around the
ambient_pragmas feature of the deparser​:

$ perl -le 'use B​::Deparse (); use warnings; $d = B​::Deparse->new; $d-

ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo()
})'
{
foo();
}
$ perl -le 'use warnings; use B​::Deparse (); $d = B​::Deparse->new; $d-
ambient_pragmas(warnings=>"all"); print $d->coderef2text(sub { foo()
})'
{
BEGIN {${^WARNING_BITS} =
"\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x54\x05"}
foo();
}
$ perl -le 'use warnings; use B​::Deparse (); use warnings; $d =
B​::Deparse->new; $d->ambient_pragmas(warnings=>"all"); print $d-
coderef2text(sub { foo() })'
{
foo();
}

These situations should all be equivalent​: the code in question is
compiled with warnings "all" in effect, and the same pragmatic state
is declared as ambient for deparsing, so the deparser output should
not include anything setting the warning state. Yet in the second
case, where the warning state is set up before and not after loading
the deparser, the output does include a setting of the warning bits.
Previous versions of Perl did not misbehave in this manner.

This was fixed by 3c3f8cd​:

commit 3c3f8cd
Author​: Ævar Arnfjörð Bjarmason <avar@​cpan.org>
Date​: Sun Jan 25 14​:10​:13 2015 +0000

  Revert the support for new warning categories outside of "all"
 
  This reverts & amends my v5.21.7-151-gea5519d and Karl Williamson's
  v5.21.7-183-g2f3cbe1, the latter was only need because of the
  former.
 
  I've also taken the opportunity to fix the long-standing trivial bug
  with misaligned code in warnings.{pm,h}. That was easier to commit along
  with this than to split it up from the other generated changes.
 
  Why revert this? See the "use warnings 'absolutely-all-almost';" thread
  on perl5-porters for the latest summary​:
 
  http​://www.nntp.perl.org/group/perl.perl5.porters/2015/01/msg225066.html
 
  Basically as I explained in v5.21.7-151-gea5519d the current design of
  the API makes it too contentious to freely add new warnings, but there's
  no consensus on how to solve that. I.e. whether we should just add them
  to "all", or do this change, or several other possible things outlined
  in that thread and elsewhere.
 
  Since the deadline for contentious changes for v5.22 is already past us
  I'm backing this out for now.

So closing.

Tony

@p5pRT
Copy link
Author

p5pRT commented Feb 23, 2015

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

@p5pRT p5pRT closed this as completed Feb 23, 2015
@p5pRT
Copy link
Author

p5pRT commented Feb 23, 2015

@tonycoz - 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