Skip to content

Commit

Permalink
fix wrong 5.14 binary check in t/names.t
Browse files Browse the repository at this point in the history
  • Loading branch information
Reini Urban committed Mar 30, 2015
1 parent df63f15 commit 3dff81c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions t/names.t
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ use Sub::Name 'subname';

my @test_ordinals = ( 1 .. 255 );

# 5.14 is the first perl to start properly handling \0 in identifiers
# 5.16 is the first perl to start handling \0 in identifiers
# and it's a bit safer to use since 5.22, but still not fully supported.
push @test_ordinals, 0
unless $] < 5.014;
unless $] < 5.016;

# This is a mess. Yes, the stash supposedly can handle unicode, yet
# on < 5.16 the behavior is literally undefined (with crashes beyond
Expand Down

2 comments on commit 3dff81c

@ribasushi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 5.16 figure pertaining to \0 is certainly incorrect. A bisect with:

  require B;
  *foo:: = *{"foo\0bar::"};
  exit(
    B::svref_2object(eval "package foo; sub { (caller(0))[3] }")->GV->STASH->NAME =~ /foo\0bar/
      ? 0
      : 1
  )

highlighted 435e8dd0d (shipped in 5.13.7) as the first commit where \0 worked as expected.

Please revise your logic in Name.xs as well.

@rurban
Copy link
Owner

@rurban rurban commented on 3dff81c Apr 2, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I figured it out eventually.
Binary GvNAMEs were possible to store since gv_fetchpvn and gv_fetchsv (5.8.9).
And UTF8 names are possible since 5.8.4 (USE_UTF8_IN_NAMES).
From 5.10 - 5.16 stored via negative HEK_LEN. But B had this bug which didn't know about the negative length and therefore crashed.

Please sign in to comment.