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

[PATCH] Test::Harness and Devel::Cover combine with overloading to cause infinite recursion in Carp.pm #8123

Closed
p5pRT opened this issue Sep 22, 2005 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Sep 22, 2005

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

Searchable as RT37233$

@p5pRT
Copy link
Author

p5pRT commented Sep 22, 2005

From @demerphq

Created by @demerphq

Attached is test case that when run under Test​::Harness and
Devel​::Cover will cause Carp to go into infinite recursion. Also
attached is a patch to Carp which will prevent the infinite
recursion. (Apparently defined() will trigger the overload, but ref() will not)

The combination of Devel​::Cover, Test​::Harness, overloading and if
modifiers cause overloading to be triggered, which in this case
results in Carp going haywire.

The first set of output is without Devel​::Cover, the second is with
it. For some reason overloading is triggered by the if modifier; the
same statement with if () BLOCK doesnt trigger the overloading.

Anyway, ive cc'ed this to the three parties who seem to be involved.
Sorry for the noise if that was wrong.

Example output​:

D​:\dev\DC_test\Dummy>set HARNESS_PERL_SWITCHES=

D​:\dev\DC_test\Dummy>nmake test

Microsoft (R) Program Maintenance Utility Version 7.00.9955
Copyright (C) Microsoft Corporation. All rights reserved.

  D​:\ASPerl\811\bin\perl.exe "-MExtUtils​::Command​::MM" "-e"
"test_harness(0, 'blib\lib', 'blib\arch')" t\Dummy.t
t\Dummy....ok
All tests successful.
Files=1, Tests=3, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00 CPU)

D​:\dev\DC_test\Dummy>set HARNESS_PERL_SWITCHES=-MDevel​::Cover

D​:\dev\DC_test\Dummy>nmake test

Microsoft (R) Program Maintenance Utility Version 7.00.9955
Copyright (C) Microsoft Corporation. All rights reserved.

  D​:\ASPerl\811\bin\perl.exe "-MExtUtils​::Command​::MM" "-e"
"test_harness(0, 'blib\lib', 'blib\arch')" t\Dummy.t
t\Dummy....ok 2/3
The overloaded method bool was called at t\Dummy.t line 11
  T​::__ANON__[t\Dummy.t​:11]('T=HASH(0x2296364)', 'undef', '')
called at D​:\dev\DC_test\Dummy\blib\lib/Dummy.pm line 20
  Dummy​::test('T=HASH(0x2296364)') called at t\Dummy.t line 5
# Looks like you planned 3 tests but only ran 2.
# Looks like your test died just after 2.
t\Dummy....dubious
  Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED test 3
  Failed 1/3 tests, 66.67% okay
Failed Test Stat Wstat Total Fail Failed List of Failed
-------------------------------------------------------------------------------
t\Dummy.t 255 65280 3 2 66.67% 3
Failed 1/1 test scripts, 0.00% okay. 1/3 subtests failed, 66.67% okay.
NMAKE : fatal error U1077​: 'D​:\ASPerl\811\bin\perl.exe' : return code '0x2'
Stop.

D​:\dev\DC_test\Dummy>

Perl Info

Flags:
    category=core
    severity=low

Site configuration information for perl v5.8.6:

Configured by ActiveState at Mon Dec 13 09:51:32 2004.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT  -DNO_HASH_SEED
-DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO
-DPERL_MSVCRT_READFIX',
    optimize='-MD -Zi -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    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:"D:\ASPerl\811\lib\CORE"  -machine:x86'
    libpth=\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 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 msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf  -libpath:"D:\ASPerl\811\lib\CORE"  -machine:x86'

Locally applied patches:
    ACTIVEPERL_LOCAL_PATCHES_ENTRY
    21540 Fix backward-compatibility issues in if.pm
    23565 Wrong MANIFEST.SKIP


@INC for perl v5.8.6:
    D:/ASPerl/811/lib
    D:/ASPerl/811/site/lib
    .


Environment for perl v5.8.6:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Util\UEdit;C:\dotNet\Common7\IDE;C:\dotNet\VC7\BIN;C:\dotNet\Common7\Tools;C:\dotNet\Common7\Tools\bin\prerelease;C:\dotNet\Common7\Tools\bin;C:\dotNet\FrameworkSDK\bin;C:\WINNT\Microsoft.NET\Framework\v1.0.3705;C:\Util\UEdit;c:\imagemagick-6.2.1-q16;D:\Py\Python24;D:\ASPerl\811\bin;D:\ASPerl\638\bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\system32\wbem;d:\svn\bin;C:\cygwin\bin;C:\Util\totalcmd;C:\Util\7-Zip;C:\Util\GTK\2.0\bin
    PERL_BADLANG (unset)
    SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Sep 22, 2005

From @demerphq

Carp_Heavy_pm.patch
--- lib\Carp\Heavy.pm.bak	2004-12-13 08:49:10.000000000 +0100
+++ lib\Carp\Heavy.pm	2005-09-09 21:03:52.187500000 +0200
@@ -43,11 +43,10 @@
 # Transform an argument to a function into a string.
 sub format_arg {
   my $arg = shift;
-  if (not defined($arg)) {
-    $arg = 'undef';
-  }
-  elsif (ref($arg)) {
+  if (ref($arg)) {
       $arg = defined($overload::VERSION) ? overload::StrVal($arg) : "$arg";
+  }elsif (not defined($arg)) {
+    $arg = 'undef';
   }
   $arg =~ s/'/\\'/g;
   $arg = str_len_trim($arg, $MaxArgLen);

@p5pRT
Copy link
Author

p5pRT commented Sep 22, 2005

From @demerphq

Dummy-1.tar.gz

@p5pRT
Copy link
Author

p5pRT commented Sep 26, 2005

@demerphq - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2005

From @smpeters

[demerphq - Thu Sep 22 11​:31​:01 2005]​:

This is a bug report for perl from demerphq@​gmail.com,
generated with the help of perlbug 1.35 running under perl v5.8.6.
-----------------------------------------------------------------
[Please enter your report here]

Attached is test case that when run under Test​::Harness and
Devel​::Cover will cause Carp to go into infinite recursion. Also
attached is a patch to Carp which will prevent the infinite
recursion. (Apparently defined() will trigger the overload, but ref()
will not)

The combination of Devel​::Cover, Test​::Harness, overloading and if
modifiers cause overloading to be triggered, which in this case
results in Carp going haywire.

The first set of output is without Devel​::Cover, the second is with
it. For some reason overloading is triggered by the if modifier; the
same statement with if () BLOCK doesnt trigger the overloading.

Anyway, ive cc'ed this to the three parties who seem to be involved.
Sorry for the noise if that was wrong.

Example output​:

D​:\dev\DC_test\Dummy>set HARNESS_PERL_SWITCHES=

D​:\dev\DC_test\Dummy>nmake test

Microsoft (R) Program Maintenance Utility Version 7.00.9955
Copyright (C) Microsoft Corporation. All rights reserved.

    D​:\\ASPerl\\811\\bin\\perl\.exe "\-MExtUtils​::Command​::MM" "\-e"

"test_harness(0, 'blib\lib', 'blib\arch')" t\Dummy.t
t\Dummy....ok
All tests successful.
Files=1, Tests=3, 0 wallclock secs ( 0.00 cusr + 0.00 csys = 0.00
CPU)

D​:\dev\DC_test\Dummy>set HARNESS_PERL_SWITCHES=-MDevel​::Cover

D​:\dev\DC_test\Dummy>nmake test

Microsoft (R) Program Maintenance Utility Version 7.00.9955
Copyright (C) Microsoft Corporation. All rights reserved.

    D​:\\ASPerl\\811\\bin\\perl\.exe "\-MExtUtils​::Command​::MM" "\-e"

"test_harness(0, 'blib\lib', 'blib\arch')" t\Dummy.t
t\Dummy....ok 2/3
The overloaded method bool was called at t\Dummy.t line 11
T​::__ANON__[t\Dummy.t​:11]('T=HASH(0x2296364)', 'undef', '')
called at D​:\dev\DC_test\Dummy\blib\lib/Dummy.pm line 20
Dummy​::test('T=HASH(0x2296364)') called at t\Dummy.t line 5
# Looks like you planned 3 tests but only ran 2.
# Looks like your test died just after 2.
t\Dummy....dubious
Test returned status 255 (wstat 65280, 0xff00)
DIED. FAILED test 3
Failed 1/3 tests, 66.67% okay
Failed Test Stat Wstat Total Fail Failed List of Failed


t\Dummy.t 255 65280 3 2 66.67% 3
Failed 1/1 test scripts, 0.00% okay. 1/3 subtests failed, 66.67% okay.
NMAKE : fatal error U1077​: 'D​:\ASPerl\811\bin\perl.exe' : return code
'0x2'
Stop.

D​:\dev\DC_test\Dummy>

Thanks! I applied this as change #25679.

@p5pRT p5pRT closed this as completed Oct 2, 2005
@p5pRT
Copy link
Author

p5pRT commented Oct 2, 2005

@smpeters - Status changed from 'open' to 'resolved'

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