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

sv_force_normal_flags shrinks SvLEN on de-cow #14239

Closed
p5pRT opened this issue Nov 14, 2014 · 4 comments
Closed

sv_force_normal_flags shrinks SvLEN on de-cow #14239

p5pRT opened this issue Nov 14, 2014 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 14, 2014

Migrated from rt.perl.org#123207 (status was 'open')

Searchable as RT123207$

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2014

From @bulk88

Created by @bulk88

I am debugging an issue in an ancient, horribly written, unmaintained,
module called Win32API​::Registry.

In this block of macro code there is SvPV_force (I added all the printfs)
--------------------------------------------------------------------------------------
  grow_buf_pl( osName,osNameSV,char *, iolName,iolNameSV,DWORD * );
...............................
/* Grow a buffer where we have a pointer to its size in bytes​: */
#define grow_buf_pl( sBuf,svBuf,tpBuf, plSize,svSize,tpSize ) STMT_START { \
  Debug(("grow_buf_pl( %s==0x%lX,[%s​:%ld/%ld, %s==0x%lX​:%ld,[%s )\n",\
  string(sBuf),sBuf,strchr(string(svBuf),'('),SvPOK(svBuf)? \
  SvCUR(svBuf)​:-1,SvPOK(svBuf)?SvLEN(svBuf)​:-1,string(plSize), \
  plSize,plSize?*plSize​:-1,strchr(string(svSize),'('))); \
  if( null_arg(svBuf) ) { \
  sBuf= NULL; \
  } else { \
  STRLEN n_a; \
  if( NULL == plSize ) \
  *( plSize= CAST(tpSize,TempAlloc(sizeof(*plSize))) )= 0;\
  printf( "" #sBuf " b4 sv_setpvn SvLEN %u\n", SvLEN(svBuf));\
  if( ! SvOK(svBuf) ){ \
  sv_setpvn(svBuf,"",0); \
  printf( "" #sBuf " sv_setpvn SvLEN %u\n", SvLEN(svBuf));\
  } \
  (void) SvPV_force( svBuf, n_a ); \
  printf( "" #sBuf " SvPV_force SvLEN %u\n", SvLEN(svBuf));\
  sBuf= CAST( tpBuf, lSvGROW( svBuf, *plSize ) ); \
  printf( "" #sBuf " SvLEN %u\n", SvLEN(svBuf));\
  if( autosize(svSize) ) *plSize= SvLEN(svBuf) - 1; \
  Debug(("more buf_pl( %s==0x%lX,[%s​:%ld/%ld, %s==0x%lX​:%ld,[%s )\n",\
  string(sBuf),sBuf,strchr(string(svBuf),'('),SvPOK(svBuf)? \
  SvCUR(svBuf)​:-1,SvPOK(svBuf)?SvLEN(svBuf)​:-1,string(plSize),\
  plSize,plSize?*plSize​:-1,strchr(string(svSize),'('))); \
  } } STMT_END

--------------------------------------------------------------------
  perl521.dll!S_sv_uncow(interpreter * my_perl=0x00364634, sv * const
sv=0x00b0e7cc, const unsigned long flags=0) Line 5228 C
  perl521.dll!Perl_sv_force_normal_flags(interpreter *
my_perl=0x00364634, sv * const sv=0x00b0e7cc, const unsigned long
flags=0) Line 5277 + 0x11 C
  perl521.dll!Perl_sv_pvn_force_flags(interpreter * my_perl=0x00364634,
sv * const sv=0x00b0e7cc, unsigned int * const lp=0x0012fb0c, const long
flags=2) Line 9777 + 0xf C
  Registry.dll!XS_Win32API__Registry__RegEnumKeyExA(interpreter *
my_perl=0x00364634, cv * cv=0x009f9924) Line 1145 + 0x1f0 C
  perl521.dll!Perl_pp_entersub(interpreter * my_perl=0x00364634) Line
2835 + 0x10 C
  perl521.dll!Perl_runops_debug(interpreter * my_perl=0x00364634) Line
2242 + 0xd C
  perl521.dll!S_run_body(interpreter * my_perl=0x00364634, long
oldscope=1) Line 2420 + 0xd C
  perl521.dll!perl_run(interpreter * my_perl=0x00364634) Line 2346 C
  perl521.dll!RunPerl(int argc=2, char * * argv=0x00362478, char * *
env=0x00362a20) Line 258 + 0x9 C
  perl.exe!main(int argc=2, char * * argv=0x00362478, char * *
env=0x00362d80) Line 24 + 0x12 C
  perl.exe!mainCRTStartup() Line 398 + 0xe C
  kernel32.dll!_BaseProcessStart@​4() + 0x23

--------------------------------------------------------------------
  SvPV_set(sv, NULL);
  SvCUR_set(sv, 0);
  SvLEN_set(sv, 0);
  if (flags & SV_COW_DROP_PV) {
  /* OK, so we don't need to copy our buffer. */
  SvPOK_off(sv);
  } else {
  SvGROW(sv, cur + 1);<<<<<<<<<THIS EXECUTES IT USES CUR
NOT LEN<<<<<<<<
  Move(pvx,SvPVX(sv),cur,char);
  SvCUR_set(sv, cur);
  *SvEND(sv) = '\0';
  }
--------------------------------------------------------------------

before the uncow

+ xmg_stash 0x00000000 {sv_any=??? any_dbg={_1_5iv=??? _2_6nv=???
_3pv=??? ...} sv_refcnt=??? ...} hv *
+ xmg_u {xmg_magic=0x0000000a {mg_moremagic=??? mg_virtual=???
mg_private=??? ...} xmg_ourstash=0x0000000a {sv_any=???
any_dbg={_1_5iv=??? _2_6nv=??? _3pv=??? ...} sv_refcnt=??? ...}
xmg_hash_index=10 } _xmgu
  xpv_cur 12 unsigned int
+ xpv_len_u {xpvlenu_len=18 xpvlenu_pv=0x00000012 <Bad Ptr> } xpv​::__unnamed
- flags_dbg {type=3 f_IOK=0 f_NOK=0 ...} sv​::__unnamed​::__unnamed
  type 3 unsigned long
  f_IOK 0 unsigned long
  f_NOK 0 unsigned long
  f_POK 1 unsigned long
  f_ROK 0 unsigned long
  p_IOK 0 unsigned long
  p_NOK 0 unsigned long
  p_POK 1 unsigned long
  p_SCREAM_phv_CLONEABLE_pgv_GP_prv_PCS_IMPORTED_pad_NAMELIST 0 unsigned long
  f_PROTECT 0 unsigned long
  s_PADTMP_s_PADSTALE_pad_TYPED 0 unsigned long
  s_PADMY_pad_OUR 0 unsigned long
  s_TEMP 0 unsigned long
  s_OBJECT 0 unsigned long
  s_GMG 0 unsigned long
  s_SMG 0 unsigned long
  s_RMG 0 unsigned long
  f_FAKE 0 unsigned long
  f_OOK 0 unsigned long
  f_BREAK 0 unsigned long
  f_READONLY 0 unsigned long
  f_IsCOW_AMAGIC 1 unsigned long
  f_UTF8_phv_SHAREKEYS 0 unsigned long
  pav_REAL_phv_LAZYDEL_pbm_VALID_repl_EVAL 0 unsigned long
  f_IVisUV_pav_REIFY_phv_HASKFLAGS_pbm_TAIL_prv_WEAKREF_pad_STATE 0
unsigned long

after

+ xmg_stash 0x00000000 {sv_any=??? any_dbg={_1_5iv=??? _2_6nv=???
_3pv=??? ...} sv_refcnt=??? ...} hv *
+ xmg_u {xmg_magic=0x0000000a {mg_moremagic=??? mg_virtual=???
mg_private=??? ...} xmg_ourstash=0x0000000a {sv_any=???
any_dbg={_1_5iv=??? _2_6nv=??? _3pv=??? ...} sv_refcnt=??? ...}
xmg_hash_index=10 } _xmgu
  xpv_cur 12 unsigned int
+ xpv_len_u {xpvlenu_len=14 xpvlenu_pv=0x0000000e <Bad Ptr> } xpv​::__unnamed
- flags_dbg {type=3 f_IOK=0 f_NOK=0 ...} sv​::__unnamed​::__unnamed
  type 3 unsigned long
  f_IOK 0 unsigned long
  f_NOK 0 unsigned long
  f_POK 1 unsigned long
  f_ROK 0 unsigned long
  p_IOK 0 unsigned long
  p_NOK 0 unsigned long
  p_POK 1 unsigned long
  p_SCREAM_phv_CLONEABLE_pgv_GP_prv_PCS_IMPORTED_pad_NAMELIST 0 unsigned long
  f_PROTECT 0 unsigned long
  s_PADTMP_s_PADSTALE_pad_TYPED 0 unsigned long
  s_PADMY_pad_OUR 0 unsigned long
  s_TEMP 0 unsigned long
  s_OBJECT 0 unsigned long
  s_GMG 0 unsigned long
  s_SMG 0 unsigned long
  s_RMG 0 unsigned long
  f_FAKE 0 unsigned long
  f_OOK 0 unsigned long
  f_BREAK 0 unsigned long
  f_READONLY 0 unsigned long
  f_IsCOW_AMAGIC 0 unsigned long
  f_UTF8_phv_SHAREKEYS 0 unsigned long
  pav_REAL_phv_LAZYDEL_pbm_VALID_repl_EVAL 0 unsigned long
  f_IVisUV_pav_REIFY_phv_HASKFLAGS_pbm_TAIL_prv_WEAKREF_pad_STATE 0
unsigned long

The code using CUR in S_sv_uncow is from 2002 commit

http​://perl5.git.perl.org/perl.git/commitdiff/765f542df20317f47bb284c276cd0abfb50dcfd6

Since the deCOW code uses CUR, and a vicious loop starts (I can't figure
out how due to how Win32API​::Registry is written, it was written
entirely with macros, and the author thought static functions were
unportable I presume in 1997) that shrinks the buffer in the SV between
calls.

here is a log produced on 5.21, notice osName's SvLEN keeps shrinking
-------------------------------------------------------
osClass b4 sv_setpvn SvLEN 10
osClass SvPV_force SvLEN 10
grow 9
osClass SvLEN 10
$VAR1 = 24;
$VAR2 = 1;
osName b4 sv_setpvn SvLEN 10
osName SvPV_force SvLEN 10
grow 25
grow 25
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 10
osClass SvPV_force SvLEN 10
grow 2
osClass SvLEN 10
EKey ONE 27 9 idx 0
namesize 3 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 4
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 10
osClass SvPV_force SvLEN 10
grow 128
grow 128
osClass SvLEN 132
EKey ONE 27 131 idx 1
namesize 8 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 9
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 27 131 idx 2
namesize 9 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 10
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 27 131 idx 3
namesize 13 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 14
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 27 131 idx 4
namesize 8 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 9
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 27 131 idx 5
namesize 23 class 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 25
grow 24
osName SvLEN 25
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 24 131 idx 6
namesize 6 class 0
osName b4 sv_setpvn SvLEN 25
osName SvPV_force SvLEN 25
grow 7
osName SvLEN 25
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 24 131 idx 7
namesize 5 class 0
osName b4 sv_setpvn SvLEN 25
osName SvPV_force SvLEN 25
grow 6
osName SvLEN 25
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 24 131 idx 8
namesize 18 class 0
osName b4 sv_setpvn SvLEN 25
osName SvPV_force SvLEN 20
grow 19
osName SvLEN 20
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 19 131 idx 9
namesize 16 class 0
osName b4 sv_setpvn SvLEN 20
osName SvPV_force SvLEN 18
grow 17
osName SvLEN 18
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 17 131 idx 10
namesize 12 class 0
osName b4 sv_setpvn SvLEN 18
osName SvPV_force SvLEN 14
grow 13
osName SvLEN 14
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 13 131 idx 11
namesize 12 class 0
osName b4 sv_setpvn SvLEN 14
osName SvPV_force SvLEN 14
grow 13
osName SvLEN 14
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 128
osClass SvLEN 132
EKey ONE 13 131 idx 12
osName b4 sv_setpvn SvLEN 14
osName SvPV_force SvLEN 14
grow 14
osName SvLEN 14
osClass b4 sv_setpvn SvLEN 132
osClass SvPV_force SvLEN 132
grow 132
osClass SvLEN 132
EKey TWO 13 131 <<<<<<<FAILED BUFFER TOO SMALL at Idx 12
-----------------------------------------------------------------

now on 5.10, note osName's SvLEN stays stable past Idx 12 (I trimmed the
result at Idx 16)

-----------------------------------------------------------------
osClass b4 sv_setpvn SvLEN 4
osClass SvPV_force SvLEN 4
grow 9
grow 9
osClass SvLEN 12
osName b4 sv_setpvn SvLEN 4
osName SvPV_force SvLEN 4
grow 25
grow 25
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 4
osClass SvPV_force SvLEN 4
grow 2
osClass SvLEN 4
EKey ONE 27 3 idx 0
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 4
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 4
osClass SvPV_force SvLEN 4
grow 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 1
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 9
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 2
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 10
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 3
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 14
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 4
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 9
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 5
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 24
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 6
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 7
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 7
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 6
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 8
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 19
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 9
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 17
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 10
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 13
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 11
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 13
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 12
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 19
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 13
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 13
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 14
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 23
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 15
osName b4 sv_setpvn SvLEN 28
osName SvPV_force SvLEN 28
grow 14
osName SvLEN 28
osClass b4 sv_setpvn SvLEN 128
osClass SvPV_force SvLEN 128
grow 128
osClass SvLEN 128
EKey ONE 27 127 idx 16
-------------------------------------------------------------------------

So, whose fault is this? The module's or is this a core bug? Did we ever
guarentee how many unused but alloced bytes there will be after SvCUR
after sv_force_normal_flags (or theoretically, sv_grow)?

Perl Info

Flags:
     category=core
     severity=low

Site configuration information for perl 5.21.6:

Configured by Owner at Thu Nov 13 18:20:06 2014.

Summary of my perl5 (revision 5 version 21 subversion 6) configuration:
   Derived from: 5e1acb3ae8d10f0a0404ec4d30afb925b08b53fd
   Ancestor: b255a112693312907754193cdbc1648d9182cb0d
   Platform:
     osname=MSWin32, osvers=5.1, archname=MSWin32-x86-multi-thread
     uname=''
     config_args='undef'
     hint=recommended, useposix=true, d_sigaction=undef
     useithreads=define, usemultiplicity=define
     use64bitint=undef, use64bitall=undef, uselongdouble=undef
     usemymalloc=n, bincompat5005=undef
   Compiler:
     cc='cl', ccflags ='-nologo -GF -W3 -Od -MD -Zi -DDEBUGGING -G7 -GL 
-DWIN32 -D_CONSOLE -DNO_STRICT  -DPERL_TEXTMODE_SCRIPTS 
-DPERL_HASH_FUNC_ONE_AT_A_TIME -DNO_MATHOMS -DPERL_IMPLICIT_CONTEXT 
-DPERL_IMPLICIT_SYS -DUSE_PERLIO -D_USE_32BIT_TIME_T',
     optimize='-Od -MD -Zi -DDEBUGGING -G7 -GL',
     cppflags='-DWIN32'
     ccversion='13.10.6030', gccversion='', gccosandvers=''
     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234, 
doublekind=3
     d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8, 
longdblkind=0
     ivtype='long', ivsize=4, nvtype='double', nvsize=8, 
Off_t='__int64', lseeksize=8
     alignbytes=8, prototype=define
   Linker and Libraries:
     ld='link', ldflags ='-nologo -nodefaultlib -debug  -opt:ref,icf 
-libpath:"c:\perl521\lib\CORE"  -machine:x86'
     libpth="C:\Program Files\Microsoft Visual Studio .NET 2003\VC7\lib"
     libs=oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib 
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib 
netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib  version.lib 
odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
     perllibs=oldnames.lib kernel32.lib user32.lib gdi32.lib 
winspool.lib  comdlg32.lib advapi32.lib shell32.lib ole32.lib 
oleaut32.lib  netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib 
version.lib odbc32.lib odbccp32.lib comctl32.lib msvcrt.lib
     libc=msvcrt.lib, so=dll, useshrplib=true, libperl=perl521.lib
     gnulibc_version=''
   Dynamic Linking:
     dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
     cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug 
-opt:ref,icf  -libpath:"c:\perl521\lib\CORE"  -machine:x86'

Locally applied patches:
     uncommitted-changes
     02b4b73f6c4578c66ae7106592964b8853d4db30
     45e05eceb42cd889a80ef0875887fcb62181cbb6
     225b72a0c1e8cf621f10ed445e0260410082bfc6
     7f871da7cac3993a56343b032f9d7eff91422224
     0b68901531d0a01506365798f883b5f08b1adb89
     a87204c1df9892bf05451407ab107a76ece4810b
     5e1acb3ae8d10f0a0404ec4d30afb925b08b53fd


@INC for perl 5.21.6:
     C:/perl521/site/lib
     C:/perl521/lib
     .


Environment for perl 5.21.6:
     HOME (unset)
     LANG (unset)
     LANGUAGE (unset)
     LD_LIBRARY_PATH (unset)
     LOGDIR (unset)
     PATH=C:\perl521\bin;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\IDE;C:\Program Files\Microsoft Visual Studio .NET 
2003\VC7\BIN;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools;C:\Program Files\Microsoft Visual Studio .NET 
2003\Common7\Tools\bin\prerelease;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\wbem;
     PERL_BADLANG (unset)
     SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2014

From @cpansprout

On Thu Nov 13 16​:19​:33 2014, bulk88 wrote​:

So, whose fault is this? The module's

Yes.

or is this a core bug?

I’d say it’s a core *feature*.

If a string gets shrunk and then copied many times, you don’t want all those other copies to allocate extra unneeded memory when written to, especially if the buffer is particularly large.

If some other code can’t handle it, I think it’s a bug elsewhere.

Did we
ever
guarentee how many unused but alloced bytes there will be after SvCUR
after sv_force_normal_flags (or theoretically, sv_grow)?

Not as far as I know.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Nov 14, 2014

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

@toddr
Copy link
Member

toddr commented Feb 13, 2020

@bulk88 if I understand @cpansprout 's response, we're saying there is no core bug here and it is working by design. Please re-open this case if you would like to discuss it futher.

@toddr toddr closed this as completed Feb 13, 2020
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

2 participants