Skip to content

sub calls show as gv(IV \) #15662

Closed
Closed

Description

@p5pRT

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

Searchable as RT129892$

Activity

  1. p5pRT commented on Oct 16, 2016

    @p5pRT
    Author

    From @mauke

    Created by @mauke

    $ perl -MO=Concise -e 'sub foo {} foo()'
    6 <@​> leave[1 ref] vKP/REFC ->(end)
    1 <0> enter ->2
    2 <;> nextstate(main 3 -e​:1) v​:{ ->3
    5 <1> entersub vKS ->6
    - <1> ex-list K ->5
    3 <0> pushmark s ->4
    - <1> ex-rv2cv sK/1 ->-
    4 <$> gv(IV \) s ->5
    -e syntax OK

    The last line shows "gv(IV \)". "IV \" is B​::Concise's way of saying that
    there's some kind of reference here, but it doesn't show what. This is
    unfortunate.

    Perl Info
    
    Flags:
        category=library
        severity=low
        module=B::Concise
    
    Site configuration information for perl 5.24.0:
    
    Configured by mauke at Mon May  9 21:21:33 CEST 2016.
    
    Summary of my perl5 (revision 5 version 24 subversion 0) configuration:
       
      Platform:
        osname=linux, osvers=4.4.5-1-arch, archname=i686-linux
        uname='linux simplicio 4.4.5-1-arch #1 smp preempt thu mar 10 07:54:30 cet 2016 i686 gnulinux '
        config_args=''
        hint=previous, useposix=true, d_sigaction=define
        useithreads=undef, usemultiplicity=undef
        use64bitint=undef, use64bitall=undef, uselongdouble=undef
        usemymalloc=n, bincompat5005=undef
      Compiler:
        cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
        optimize='-O2 -flto',
        cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
        ccversion='', gccversion='6.1.1 20160501', gccosandvers=''
        intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, doublekind=3
        d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12, longdblkind=3
        ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
        alignbytes=4, prototype=define
      Linker and Libraries:
        ld='cc', ldflags ='-fstack-protector-strong -L/usr/local/lib -flto'
        libpth=/usr/local/lib /usr/lib/gcc/i686-pc-linux-gnu/6.1.1/include-fixed /usr/lib /lib /usr/local/lib /usr/lib/gcc/i686-pc-linux-gnu/6.1.1/include-fixed /usr/lib
        libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
        perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
        libc=libc-2.23.so, so=so, useshrplib=false, libperl=libperl.a
        gnulibc_version='2.23'
      Dynamic Linking:
        dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
        cccdlflags='-fPIC', lddlflags='-shared -O2 -flto -L/usr/local/lib -fstack-protector-strong'
    
    
    
    @INC for perl 5.24.0:
        /home/mauke/usr/lib/perl5/site_perl/5.24.0/i686-linux
        /home/mauke/usr/lib/perl5/site_perl/5.24.0
        /home/mauke/usr/lib/perl5/5.24.0/i686-linux
        /home/mauke/usr/lib/perl5/5.24.0
        .
    
    
    Environment for perl 5.24.0:
        HOME=/home/mauke
        LANG=en_US.UTF-8
        LANGUAGE=en_US
        LC_COLLATE=C
        LC_MONETARY=de_DE.UTF-8
        LC_TIME=de_DE.UTF-8
        LD_LIBRARY_PATH (unset)
        LOGDIR (unset)
        PATH=/home/mauke/perl5/perlbrew/bin:/home/mauke/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
        PERLBREW_BASHRC_VERSION=0.73
        PERLBREW_HOME=/home/mauke/.perlbrew
        PERLBREW_ROOT=/home/mauke/perl5/perlbrew
        PERL_BADLANG (unset)
        PERL_UNICODE=SAL
        SHELL=/bin/bash
    
    
  2. p5pRT commented on Oct 16, 2016

    @p5pRT
    Author

    From @mauke

    On Sun Oct 16 07​:28​:46 2016, mauke- wrote​:

    [Please describe your issue here]

    $ perl -MO=Concise -e 'sub foo {} foo()'
    6 <@​> leave[1 ref] vKP/REFC ->(end)
    1 <0> enter ->2
    2 <;> nextstate(main 3 -e​:1) v​:{ ->3
    5 <1> entersub vKS ->6
    - <1> ex-list K ->5
    3 <0> pushmark s ->4
    - <1> ex-rv2cv sK/1 ->-
    4 <$> gv(IV \) s ->5
    -e syntax OK

    The last line shows "gv(IV \)". "IV \" is B​::Concise's way of saying
    that
    there's some kind of reference here, but it doesn't show what. This is
    unfortunate.

    The attached patch changes this to "gv(IV \&main​::foo)" but I'm not familiar with this code. Comments?

  3. p5pRT commented on Oct 16, 2016

    @p5pRT
    Author

    From @mauke

    0001-B-Concise-display-CVs-as-pkgname-subname-perl-129892.patch
    From 88ea550b6bec566bc7f913e0dcef3d49a54f7cb0 Mon Sep 17 00:00:00 2001
    From: Lukas Mai <l.mai@web.de>
    Date: Sun, 16 Oct 2016 16:28:55 +0200
    Subject: [PATCH] B::Concise: display CVs as &pkgname::subname [perl #129892]
    
    ---
     ext/B/B/Concise.pm         | 2 ++
     ext/B/t/optree_constants.t | 4 ++--
     2 files changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm
    index 315e00a..1409225 100644
    --- a/ext/B/B/Concise.pm
    +++ b/ext/B/B/Concise.pm
    @@ -739,6 +739,8 @@ sub concise_sv {
     	    $hr->{svval} .= cstring($sv->PV);
     	} elsif (class($sv) eq "HV") {
     	    $hr->{svval} .= 'HASH';
    +	} elsif (class($sv) eq "CV") {
    +	    $hr->{svval} .= '&' . $sv->GV->STASH->NAME . '::' . $sv->GV->SAFENAME;
     	}
     
     	$hr->{svval} = 'undef' unless defined $hr->{svval};
    diff --git a/ext/B/t/optree_constants.t b/ext/B/t/optree_constants.t
    index 865eed1..ca98de0 100644
    --- a/ext/B/t/optree_constants.t
    +++ b/ext/B/t/optree_constants.t
    @@ -44,8 +44,8 @@ my $want = {	# expected types, how value renders in-line, todos (maybe)
         myhref	=> [ $RV_class, '\\\\HASH'],
         pi		=> [ 'NV', pi ],
         myglob	=> [ $RV_class, '\\\\' ],
    -    mysub	=> [ $RV_class, '\\\\' ],
    -    myunsub	=> [ $RV_class, '\\\\' ],
    +    mysub	=> [ $RV_class, '\\\\&main::ok' ],
    +    myunsub	=> [ $RV_class, '\\\\&main::nosuch' ],
         # these are not inlined, at least not per BC::Concise
         #myyes	=> [ $RV_class, ],
         #myno	=> [ $RV_class, ],
    -- 
    2.10.0
    
    
  4. p5pRT commented on Oct 16, 2016

    @p5pRT
    Author

    From @cpansprout

    On Sun Oct 16 07​:33​:53 2016, mauke- wrote​:

    On Sun Oct 16 07​:28​:46 2016, mauke- wrote​:

    [Please describe your issue here]

    $ perl -MO=Concise -e 'sub foo {} foo()'
    6 <@​> leave[1 ref] vKP/REFC ->(end)
    1 <0> enter ->2
    2 <;> nextstate(main 3 -e​:1) v​:{ ->3
    5 <1> entersub vKS ->6
    - <1> ex-list K ->5
    3 <0> pushmark s ->4
    - <1> ex-rv2cv sK/1 ->-
    4 <$> gv(IV \) s ->5
    -e syntax OK

    The last line shows "gv(IV \)". "IV \" is B​::Concise's way of saying
    that
    there's some kind of reference here, but it doesn't show what. This
    is
    unfortunate.

    The attached patch changes this to "gv(IV \&main​::foo)" but I'm not
    familiar with this code. Comments?

    $sv->GV here will call CvGV internally, which will vivify the GV if there isn’t one already.

    It might be better to borrow some code from B​::Deparse​::gv_name. Maybe some of that code could be moved into B itself.

    This is the part I am talking about​:

      my $cv = $gv->FLAGS & SVf_ROK ? $gv->RV : 0;
      my $stash = ($cv || $gv)->STASH->NAME;
      my $name = $raw
      ? $cv ? $cv->NAME_HEK || $cv->GV->NAME : $gv->NAME
      : $cv
      ? B​::safename($cv->NAME_HEK || $cv->GV->NAME)
      : $gv->SAFENAME;

    --

    Father Chrysostomos

  5. p5pRT commented on Oct 16, 2016

    @p5pRT
    Author

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

  6. p5pRT commented on Nov 14, 2017

    @p5pRT
    Author

    From zefram@fysh.org

    Fixed in commit a1c09da.

    -zefram

  7. p5pRT commented on Nov 14, 2017

    @p5pRT
    Author

    From @mauke

    On Mon, 13 Nov 2017 22​:57​:09 -0800, zefram@​fysh.org wrote​:

    Fixed in commit a1c09da.

    Heh. Your commit message ("... Fixes [perl #129892]") got wrapped with a newline before "#", which caused git to treat the rest of the line as a comment (so now it ends with "Fixes [perl").

  8. p5pRT commented on Nov 14, 2017

    @p5pRT
    Author

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

  9. p5pRT commented on Nov 14, 2017

    @p5pRT
    Author

    From @cpansprout

    On Tue, 14 Nov 2017 09​:24​:26 -0800, mauke- wrote​:

    On Mon, 13 Nov 2017 22​:57​:09 -0800, zefram@​fysh.org wrote​:

    Fixed in commit a1c09da.

    Heh. Your commit message ("... Fixes [perl #129892]") got wrapped with
    a newline before "#", which caused git to treat the rest of the line
    as a comment (so now it ends with "Fixes [perl").

    That is one of the most annoying misfeatures of git. I have gotten into the habit of always piping my commit messages to ‘git commit -F -’

    Incidentally, since I use a Mac, I copy it to the clipboard and use ‘pbpaste|git commit...’.

    --

    Father Chrysostomos

  10. p5pRT commented on Nov 14, 2017

    @p5pRT
    Author

    From @Smylers

    Father Chrysostomos via RT writes​:

    On Tue, 14 Nov 2017 09​:24​:26 -0800, mauke- wrote​:

    Heh. Your commit message ("... Fixes [perl #129892]") got wrapped
    with a newline before "#", which caused git to treat the rest of the
    line as a comment (so now it ends with "Fixes [perl").

    That is one of the most annoying misfeatures of git.

    You can turn it off with​:

      $ git config --global commit.cleanup whitespace
      $ git config --global commit.template false

    The first says to restrict clean-up in commit messages to removing
    superfluous whitespace, but leaving lines starting with a hash alone.

    If you use that, you probably want the second as well, which says to
    start commit messages empty, rather than with a bunch of comments about
    its current state. If the comments are useful to you, you can leave this
    true, but then you have to make sure you delete the comment lines before
    saving your message.

    Smylers

  11. p5pRT commented on Jun 23, 2018

    @p5pRT
    Author

    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.

  12. p5pRT commented on Jun 23, 2018

    @p5pRT
    Author

    @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions