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

sub calls show as gv(IV \) #15662

Closed
p5pRT opened this issue Oct 16, 2016 · 12 comments
Closed

sub calls show as gv(IV \) #15662

p5pRT opened this issue Oct 16, 2016 · 12 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 16, 2016

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

Searchable as RT129892$

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2016

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?

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Oct 16, 2016

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

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2017

From zefram@fysh.org

Fixed in commit a1c09da.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2017

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").

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2017

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

@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