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

Use SvLEN_set/SvCUR_set in a few extra locations #16171

Closed
p5pRT opened this issue Sep 25, 2017 · 10 comments
Closed

Use SvLEN_set/SvCUR_set in a few extra locations #16171

p5pRT opened this issue Sep 25, 2017 · 10 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 25, 2017

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

Searchable as RT132160$

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2017

From @atoomic

This is a bug report for perl from atoomic@​cpan.org,
generated with the help of perlbug 1.40 running under perl 5.27.5.


SvLEN was set without using the generic macro SvLEN_set.
Use it in three extra locations, and also use SvCUR_set
instead of SvCUR.

run test on linux using​: TEST_JOBS=10 make -j10 test_harness



Flags​:
  category=core
  severity=low


Site configuration information for perl 5.27.5​:

Configured by root at Mon Sep 25 13​:38​:40 CDT 2017.

Summary of my perl5 (revision 5 version 27 subversion 5) configuration​:
  Commit id​: 8dbf3fc
  Platform​:
  osname=linux
  osvers=3.10.0-693.2.2.el7.x86_64
  archname=x86_64-linux
  uname='linux nico-c7.dev.cpanel.net 3.10.0-693.2.2.el7.x86_64 #1 smp
tue sep 12 22​:26​:13 utc 2017 x86_64 x86_64 x86_64 gnulinux '
  config_args='-Dusedevel -des'
  hint=recommended
  useposix=true
  d_sigaction=define
  useithreads=undef
  usemultiplicity=undef
  use64bitint=define
  use64bitall=define
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  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
-D_FORTIFY_SOURCE=2'
  optimize='-O2'
  cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong
-I/usr/local/include'
  ccversion=''
  gccversion='4.8.5 20150623 (Red Hat 4.8.5-16)'
  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-strong -L/usr/local/lib'
  libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64 /lib
/lib64 /usr/lib64 /usr/local/lib64
  libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
  perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
  libc=libc-2.17.so
  so=so
  useshrplib=false
  libperl=libperl.a
  gnulibc_version='2.17'
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs
  dlext=so
  d_dlsymun=undef
  ccdlflags='-Wl,-E'
  cccdlflags='-fPIC'
  lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'


@​INC for perl 5.27.5​:
  lib
  /root/.dotfiles/perl-must-have/lib
  /root/perl5/lib/perl5/
  /usr/local/lib/perl5/site_perl/5.27.5/x86_64-linux
  /usr/local/lib/perl5/site_perl/5.27.5
  /usr/local/lib/perl5/5.27.5/x86_64-linux
  /usr/local/lib/perl5/5.27.5


Environment for perl 5.27.5​:
  HOME=/root
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)

PATH=/usr/local/cpanel/3rdparty/perl/526/bin​:/usr/local/cpanel/3rdparty/perl/524/bin​:/usr/local/cpanel/3rdparty/perl/522/bin​:/usr/local/cpanel/3rdparty/perl/514/bin​:/usr/local/cpanel/3rdparty/bin​:/root/bin/​:/opt/local/bin​:/opt/local/sbin​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/opt/cpanel/composer/bin​:/root/.dotfiles/bin​:/root/perl5/bin​:/root/.rvm/bin​:/root/bin
  PERL5DB=use Devel​::NYTProf
  PERL5LIB=/root/.dotfiles/perl-must-have/lib​::/root/perl5/lib/perl5/
  PERL_BADLANG (unset)
  PERL_CPANM_OPT=--quiet
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2017

From @atoomic

0001-Use-SvLEN_set-SvCUR_set-in-a-few-extra-locations.patch
From 8dbf3fcb11c15d2503dd8f6a902429bbd53e0acf Mon Sep 17 00:00:00 2001
From: Nicolas R <atoomic@cpan.org>
Date: Mon, 25 Sep 2017 13:37:06 -0500
Subject: [PATCH] Use SvLEN_set/SvCUR_set in a few extra locations

SvLEN was set without using the generic macro SvLEN_set.
Use it in three extra locations, and also use SvCUR_set
instead of SvCUR.
---
 gv.c        | 2 +-
 toke.c      | 4 ++--
 universal.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gv.c b/gv.c
index 6df78cc013..5a1bbd8608 100644
--- a/gv.c
+++ b/gv.c
@@ -1262,7 +1262,7 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags)
 	    sv_setsv_nomg((SV *)cv, tmpsv);
 	    SvTEMP_off(tmpsv);
 	    SvREFCNT_dec_NN(tmpsv);
-	    SvLEN(cv) = SvCUR(cv) + 1;
+	    SvLEN_set(cv, SvCUR(cv) + 1);
 	    SvCUR(cv) = ulen;
 	}
 	else {
diff --git a/toke.c b/toke.c
index a91a4fcfbe..74e0027f7d 100644
--- a/toke.c
+++ b/toke.c
@@ -4443,8 +4443,8 @@ Perl_filter_add(pTHX_ filter_t funcp, SV *datasv)
 		    PL_parser->last_uni = buf + last_uni_pos;
 		if (PL_parser->last_lop)
 		    PL_parser->last_lop = buf + last_lop_pos;
-		SvLEN(linestr) = SvCUR(linestr);
-		SvCUR(linestr) = s-SvPVX(linestr);
+		SvLEN_set(linestr, SvCUR(linestr));
+		SvCUR_set(linestr, s - SvPVX(linestr));
 		PL_parser->filtered = 1;
 		break;
 	    }
diff --git a/universal.c b/universal.c
index 65477fb775..2262939b8d 100644
--- a/universal.c
+++ b/universal.c
@@ -225,8 +225,8 @@ Perl_sv_does_sv(pTHX_ SV *sv, SV *namesv, U32 flags)
     /* create a PV with value "isa", but with a special address
      * so that perl knows we're really doing "DOES" instead */
     methodname = newSV_type(SVt_PV);
-    SvLEN(methodname) = 0;
-    SvCUR(methodname) = strlen(PL_isa_DOES);
+    SvLEN_set(methodname, 0);
+    SvCUR_set(methodname, strlen(PL_isa_DOES));
     SvPVX(methodname) = (char *)PL_isa_DOES; /* discard 'const' qualifier */
     SvPOK_on(methodname);
     sv_2mortal(methodname);
-- 
2.14.1

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2017

From @atoomic

inline patch

On Mon, 25 Sep 2017 11​:48​:15 -0700, atoomic@​cpan.org wrote​:

This is a bug report for perl from atoomic@​cpan.org,
generated with the help of perlbug 1.40 running under perl 5.27.5.

-----------------------------------------------------------------
SvLEN was set without using the generic macro SvLEN_set.
Use it in three extra locations, and also use SvCUR_set
instead of SvCUR.

run test on linux using​: TEST_JOBS=10 make -j10 test_harness
-----------------------------------------------------------------
---
Flags​:
category=core
severity=low
---
Site configuration information for perl 5.27.5​:

Configured by root at Mon Sep 25 13​:38​:40 CDT 2017.

Summary of my perl5 (revision 5 version 27 subversion 5)
configuration​:
Commit id​: 8dbf3fc
Platform​:
osname=linux
osvers=3.10.0-693.2.2.el7.x86_64
archname=x86_64-linux
uname='linux nico-c7.dev.cpanel.net 3.10.0-693.2.2.el7.x86_64 #1
smp
tue sep 12 22​:26​:13 utc 2017 x86_64 x86_64 x86_64 gnulinux '
config_args='-Dusedevel -des'
hint=recommended
useposix=true
d_sigaction=define
useithreads=undef
usemultiplicity=undef
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
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
-D_FORTIFY_SOURCE=2'
optimize='-O2'
cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-
strong
-I/usr/local/include'
ccversion=''
gccversion='4.8.5 20150623 (Red Hat 4.8.5-16)'
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-strong -L/usr/local/lib'
libpth=/usr/local/lib /usr/lib /lib/../lib64 /usr/lib/../lib64
/lib
/lib64 /usr/lib64 /usr/local/lib64
libs=-lpthread -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
-lgdbm_compat
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=libc-2.17.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.17'
Dynamic Linking​:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector-strong'

---
@​INC for perl 5.27.5​:
lib
/root/.dotfiles/perl-must-have/lib
/root/perl5/lib/perl5/
/usr/local/lib/perl5/site_perl/5.27.5/x86_64-linux
/usr/local/lib/perl5/site_perl/5.27.5
/usr/local/lib/perl5/5.27.5/x86_64-linux
/usr/local/lib/perl5/5.27.5

---
Environment for perl 5.27.5​:
HOME=/root
LANG=en_US.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)

PATH=/usr/local/cpanel/3rdparty/perl/526/bin​:/usr/local/cpanel/3rdparty/perl/524/bin​:/usr/local/cpanel/3rdparty/perl/522/bin​:/usr/local/cpanel/3rdparty/perl/514/bin​:/usr/local/cpanel/3rdparty/bin​:/root/bin/​:/opt/local/bin​:/opt/local/sbin​:/usr/local/sbin​:/usr/local/bin​:/usr/sbin​:/usr/bin​:/opt/cpanel/composer/bin​:/root/.dotfiles/bin​:/root/perl5/bin​:/root/.rvm/bin​:/root/bin
PERL5DB=use Devel​::NYTProf
PERL5LIB=/root/.dotfiles/perl-must-
have/lib​::/root/perl5/lib/perl5/
PERL_BADLANG (unset)
PERL_CPANM_OPT=--quiet
SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2017

From @atoomic

0001-Use-SvLEN_set-SvCUR_set-in-a-few-extra-locations.patch
From 8dbf3fcb11c15d2503dd8f6a902429bbd53e0acf Mon Sep 17 00:00:00 2001
From: Nicolas R <atoomic@cpan.org>
Date: Mon, 25 Sep 2017 13:37:06 -0500
Subject: [PATCH] Use SvLEN_set/SvCUR_set in a few extra locations

SvLEN was set without using the generic macro SvLEN_set.
Use it in three extra locations, and also use SvCUR_set
instead of SvCUR.
---
 gv.c        | 2 +-
 toke.c      | 4 ++--
 universal.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gv.c b/gv.c
index 6df78cc013..5a1bbd8608 100644
--- a/gv.c
+++ b/gv.c
@@ -1262,7 +1262,7 @@ Perl_gv_autoload_pvn(pTHX_ HV *stash, const char *name, STRLEN len, U32 flags)
 	    sv_setsv_nomg((SV *)cv, tmpsv);
 	    SvTEMP_off(tmpsv);
 	    SvREFCNT_dec_NN(tmpsv);
-	    SvLEN(cv) = SvCUR(cv) + 1;
+	    SvLEN_set(cv, SvCUR(cv) + 1);
 	    SvCUR(cv) = ulen;
 	}
 	else {
diff --git a/toke.c b/toke.c
index a91a4fcfbe..74e0027f7d 100644
--- a/toke.c
+++ b/toke.c
@@ -4443,8 +4443,8 @@ Perl_filter_add(pTHX_ filter_t funcp, SV *datasv)
 		    PL_parser->last_uni = buf + last_uni_pos;
 		if (PL_parser->last_lop)
 		    PL_parser->last_lop = buf + last_lop_pos;
-		SvLEN(linestr) = SvCUR(linestr);
-		SvCUR(linestr) = s-SvPVX(linestr);
+		SvLEN_set(linestr, SvCUR(linestr));
+		SvCUR_set(linestr, s - SvPVX(linestr));
 		PL_parser->filtered = 1;
 		break;
 	    }
diff --git a/universal.c b/universal.c
index 65477fb775..2262939b8d 100644
--- a/universal.c
+++ b/universal.c
@@ -225,8 +225,8 @@ Perl_sv_does_sv(pTHX_ SV *sv, SV *namesv, U32 flags)
     /* create a PV with value "isa", but with a special address
      * so that perl knows we're really doing "DOES" instead */
     methodname = newSV_type(SVt_PV);
-    SvLEN(methodname) = 0;
-    SvCUR(methodname) = strlen(PL_isa_DOES);
+    SvLEN_set(methodname, 0);
+    SvCUR_set(methodname, strlen(PL_isa_DOES));
     SvPVX(methodname) = (char *)PL_isa_DOES; /* discard 'const' qualifier */
     SvPOK_on(methodname);
     sv_2mortal(methodname);
-- 
2.14.1

@p5pRT
Copy link
Author

p5pRT commented Sep 25, 2017

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

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 2017

From @tonycoz

On Mon, 25 Sep 2017 11​:48​:15 -0700, atoomic@​cpan.org wrote​:

SvLEN was set without using the generic macro SvLEN_set.
Use it in three extra locations, and also use SvCUR_set
instead of SvCUR.

run test on linux using​: TEST_JOBS=10 make -j10 test_harness

Thanks, applied as 59c3c22.

Tony

@p5pRT
Copy link
Author

p5pRT commented Oct 19, 2017

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

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

@p5pRT p5pRT closed this as completed Jun 23, 2018
@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2018

From @atoomic

Thank you!

Le sam. 23 juin 2018 à 09​:31, Karl Williamson via RT <
perlbug-followup@​perl.org> a écrit :

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant