develooper Front page | perl.perl5.porters | Postings from April 2015

[perl #124420] [PATCH] $Carp::MaxArgNums off-by-one error

Thread Previous | Thread Next
From:
Alexander D'Archangel
Date:
April 29, 2015 12:24
Subject:
[perl #124420] [PATCH] $Carp::MaxArgNums off-by-one error
Message ID:
rt-4.0.18-15715-1430280965-1049.124420-75-0@perl.org
# New Ticket Created by  Alexander D'Archangel 
# Please include the string:  [perl #124420]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=124420 >


[NB:  I previously attempted to submit this via perlbug, but something seems to have gone wrong.  After not seeing it show up in the RT for more than two weeks, I'm trying a different route.  I apologize if this is a repeat post.]

$Carp::MaxArgNums is documented to be the number of arguments to display in
tracebacks, but it has a bug that means that the actual number of arguments
displayed is $MaxArgNums + 1 .  Attached is a patch that fixes the behavior,
improves tests to make the connection between $MaxArgNums and expected output
more obvious, and adds an explanation of how to suppress all arguments to the
documentation.

Arguably, $Carp::MaxArgNums = 0 should mean 'no arguments' instead of 'all
arguments', but this patch doesn't address that question.  Code that depends on
the incorrect behavior will be broken by this patch, but code that was written
as though the documentation was correct will work more correctly.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=low
    Type=Patch
    PatchStatus=HasPatch
    module=Carp
---
Site configuration information for perl 5.21.11:

Configured by darch at Mon Apr  6 00:01:06 PDT 2015.

Summary of my perl5 (revision 5 version 21 subversion 11) configuration:
  Commit id: c7a3a5b4b9527250c5493344fcb0e75d0d33dcb8
  Platform:
    osname=linux, osvers=2.6.32-5-xen-amd64, archname=x86_64-linux
    uname='linux etc 2.6.32-5-xen-amd64 #1 smp mon sep 23 23:29:01 utc 2013 x86_64 gnulinux '
    config_args='-de -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector -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 -I/usr/local/include'
    ccversion='', gccversion='4.7.2', 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 -L/usr/local/lib'
    libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.7/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib
    libs=-lpthread -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lgdbm_compat
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.13.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.13'
  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'


---
@INC for perl 5.21.11:
    lib
    /usr/local/lib/perl5/site_perl/5.21.11/x86_64-linux
    /usr/local/lib/perl5/site_perl/5.21.11
    /usr/local/lib/perl5/5.21.11/x86_64-linux
    /usr/local/lib/perl5/5.21.11
    .

---
Environment for perl 5.21.11:
    HOME=/home/darch
    LANG=en_US.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/darch/perl5/perlbrew/bin:/home/darch/perl5/perlbrew/perls/perl-5.18.2/bin:/home/darch/bin:/usr/local/perl6/languages/perl6/site/bin:/usr/local/perl6/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERLBREW_BASHRC_VERSION=0.59
    PERLBREW_HOME=/home/darch/.perlbrew
    PERLBREW_MANPATH=/home/darch/perl5/perlbrew/perls/perl-5.18.2/man
    PERLBREW_PATH=/home/darch/perl5/perlbrew/bin:/home/darch/perl5/perlbrew/perls/perl-5.18.2/bin
    PERLBREW_PERL=perl-5.18.2
    PERLBREW_ROOT=/home/darch/perl5/perlbrew
    PERLBREW_VERSION=0.59
    PERL_BADLANG (unset)
    SHELL=/bin/zsh
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About