Skip Menu |
Report information
Id: 132448
Status: rejected
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: tk [at] giga.or.at
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.26.1
Fixed In: (no value)



CC: tk [...] giga.or.at
Subject: Carp quoting issue
Date: Wed, 15 Nov 2017 00:29:50 +0100 (CET)
From: tk [...] giga.or.at
To: perlbug [...] perl.org
Download (untitled) / with headers
text/plain 4.8k
This is a bug report for perl from tk@giga.or.at, generated with the help of perlbug 1.40 running under perl 5.26.1. ----------------------------------------------------------------- [Please describe your issue here] One of the self tests of Function-Parameters fails with perl-5.26.1 and the included Carp-1.42. When reporting this upstream to the package author, he analyzed it and claimed that the bug is in Carp. The original bug report is at https://github.com/mauke/Function-Parameters/issues/33 The test program that fails and should not fail according to the Function-Parameters maintainer is: #!perl use strict; use warnings FATAL => 'all'; use Test::More; use Carp; my $file = __FILE__; my $line = __LINE__; { package Foo; #use Function::Parameters; sub foo { my ($x, $y) = @_; Carp::confess "$x $y"; } eval { foo("abc", "123"); }; my $line_confess = $line + 6; my $line_foo = $line + 10; ::like($@, qr/^abc 123 at \Q$file\E line $line_confess\.?\n\tFoo::foo\((["'])abc\1, 123\) called at \Q$file\E line $line_foo/); } SKIP: { skip "Sub::Name required", 1 unless eval { require Sub::Name }; { package Bar; #use Function::Parameters; *bar = Sub::Name::subname(bar => sub { my ($a, $b) = @_; Carp::confess($a + $b) }); eval { bar(4, 5); }; my $line_confess = $line + 24; my $line_bar = $line + 27; ::like($@, qr/^9 at \Q$file\E line $line_confess\.?\n\tBar::bar\(4, 5\) called at \Q$file\E line $line_bar/); } } done_testing; For me, on NetBSD-8.99.6/amd64 with perl-5.26.1 this gives: # perl test not ok 1 # Failed test at test line 25. # 'abc 123 at test line 15. # Foo::foo("\"abc\"", 123) called at test line 19 # eval {...} called at test line 18 # ' # doesn't match '(?^:^abc 123 at test line 15\.?\n\tFoo::foo\((["'])abc\1, 123\) called at test line 19)' ok 2 1..2 # Looks like you failed 1 test of 2. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=library severity=medium module=Carp --- Site configuration information for perl 5.26.1: Configured by root at Mon Oct 23 15:43:11 GMT 2017. Summary of my perl5 (revision 5 version 26 subversion 1) configuration: Platform: osname=netbsd osvers=8.99.5 archname=x86_64-netbsd-thread-multi uname='netbsd 8.99.5 amd64 ' config_args='-sde -Dldflags= -Wl,-z,relro -Wl,-z,now -pthread -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -Duseshrplib -Duseithreads -Uusemymalloc' hint=recommended useposix=true d_sigaction=define useithreads=define usemultiplicity=define use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n default_inc_excludes_dot=define bincompat5005=undef Compiler: cc='gcc' ccflags ='-O2 -g -D_FORTIFY_SOURCE=2 -fstack-check -pthread -I/usr/include -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong' optimize='-O2 -g -D_FORTIFY_SOURCE=2 -fstack-check -pthread -I/usr/include' cppflags='-O2 -g -D_FORTIFY_SOURCE=2 -fstack-check -pthread -I/usr/include -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong' ccversion='' gccversion='5.4.0' 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='gcc' ldflags =' -Wl,-z,relro -Wl,-z,now -pthread -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -fstack-protector-strong -L/usr/pkg/lib' libpth=/lib /usr/lib /usr/pkg/lib libs=-lm -lcrypt -lpthread perllibs=-lm -lcrypt -lpthread libc=/lib/libc.so so=so useshrplib=true libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs dlext=so d_dlsymun=undef ccdlflags='-Wl,-E -Wl,-R/usr/pkg/lib/perl5/5.26.0/x86_64-netbsd-thread-multi/CORE' cccdlflags='-DPIC -fPIC ' lddlflags='-shared -Wl,-z,relro -Wl,-z,now -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -fstack-protector-strong' --- @INC for perl 5.26.1: /archive/foreign/nfotex/nsl/lib /archive/foreign/nfotex/nsl/lib /usr/pkg/lib/perl5/site_perl/5.26.0/x86_64-netbsd-thread-multi /usr/pkg/lib/perl5/site_perl/5.26.0 /usr/pkg/lib/perl5/vendor_perl/5.26.0/x86_64-netbsd-thread-multi /usr/pkg/lib/perl5/vendor_perl/5.26.0 /usr/pkg/lib/perl5/5.26.0/x86_64-netbsd-thread-multi /usr/pkg/lib/perl5/5.26.0 --- Environment for perl 5.26.1: HOME=/home/wiz LANG (unset) LANGUAGE (unset) LC_CTYPE (unset) LC_TIME (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PERL_BADLANG (unset) SHELL=/bin/zsh
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 2.7k
On Tue, 14 Nov 2017 23:30:56 GMT, tk@giga.or.at wrote: Show quoted text
> This is a bug report for perl from tk@giga.or.at, > generated with the help of perlbug 1.40 running under perl 5.26.1. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > One of the self tests of Function-Parameters fails with perl-5.26.1 > and the included Carp-1.42. When reporting this upstream to the > package author, he analyzed it and claimed that the bug is in Carp. > > > The original bug report is at > https://github.com/mauke/Function-Parameters/issues/33 > > The test program that fails and should not fail according to > the Function-Parameters maintainer is: > > #!perl > use strict; > use warnings FATAL => 'all'; > use Test::More; > > use Carp; > > my $file = __FILE__; > my $line = __LINE__; > > { > package Foo; > #use Function::Parameters; > sub foo { my ($x, $y) = @_; > Carp::confess "$x $y"; > } > > eval { > foo("abc", "123"); > }; > > my $line_confess = $line + 6; > my $line_foo = $line + 10; > > ::like($@, qr/^abc 123 at \Q$file\E line > $line_confess\.?\n\tFoo::foo\((["'])abc\1, 123\) called at \Q$file\E > line $line_foo/); > } > > SKIP: { skip "Sub::Name required", 1 unless eval { require Sub::Name > }; > > { > package Bar; > #use Function::Parameters; > *bar = Sub::Name::subname(bar => sub { my ($a, $b) = @_; > Carp::confess($a + $b) }); > > eval { > bar(4, 5); > }; > > my $line_confess = $line + 24; > my $line_bar = $line + 27; > > ::like($@, qr/^9 at \Q$file\E line $line_confess\.?\n\tBar::bar\(4, > 5\) called at \Q$file\E line $line_bar/); > } > > } > > done_testing; > > For me, on NetBSD-8.99.6/amd64 with perl-5.26.1 this gives: > > # perl test > not ok 1 > # Failed test at test line 25. > # 'abc 123 at test line 15. > # Foo::foo("\"abc\"", 123) called at test line 19 > # eval {...} called at test line 18 > # ' > # doesn't match '(?^:^abc 123 at test line > 15\.?\n\tFoo::foo\((["'])abc\1, 123\) called at test line 19)' > ok 2 > 1..2 > # Looks like you failed 1 test of 2. > >
The second test -- the one where Sub::Name has been installed and is being used -- appears to be dependent on line numbers hard-coded into the file -- yet the test which is of concern is "failing" only with respect to line numbers. You can get the second test to "pass" simply by manipulating the numbers assigned in these two lines: ##### my $line_confess = $line + 24; my $line_bar = $line + 27; ##### And since it's only the second test that is failing, it is just as likely that this is a bug in Sub::Name (not part of the core distribution) as it is in Carp. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.7k
On Wed, 15 Nov 2017 08:15:52 -0800, jkeenan wrote: Show quoted text
> On Tue, 14 Nov 2017 23:30:56 GMT, tk@giga.or.at wrote:
> > For me, on NetBSD-8.99.6/amd64 with perl-5.26.1 this gives: > > > > # perl test > > not ok 1 > > # Failed test at test line 25. > > # 'abc 123 at test line 15. > > # Foo::foo("\"abc\"", 123) called at test line 19 > > # eval {...} called at test line 18 > > # ' > > # doesn't match '(?^:^abc 123 at test line > > 15\.?\n\tFoo::foo\((["'])abc\1, 123\) called at test line 19)' > > ok 2 > > 1..2 > > # Looks like you failed 1 test of 2. > >
> > The second test -- the one where Sub::Name has been installed and is > being used -- appears to be dependent on line numbers hard-coded into > the file -- yet the test which is of concern is "failing" only with > respect to line numbers. You can get the second test to "pass" simply > by manipulating the numbers assigned in these two lines: > > ##### > my $line_confess = $line + 24; > my $line_bar = $line + 27; > ##### > > And since it's only the second test that is failing, it is just as > likely that this is a bug in Sub::Name (not part of the core > distribution) as it is in Carp.
The test output is: not ok 1 ok 2 The second test is not failing; the first test is. And the line numbers in the failure are identical: # Failed test at test line 25. # 'abc 123 at test line 15. # Foo::foo("\"abc\"", 123) called at test line 19 # eval {...} called at test line 18 # ' # doesn't match '(?^:^abc 123 at test line 15\.?\n\tFoo::foo\((["'])abc\1, 123\) called at test line 19)' "... line 15" and "... line 19" match. The problem is that what should have been pretty-printed as Foo::foo("abc", 123) by Carp::confess got emitted as Foo::foo("\"abc\"", 123) instead.
To: James E Keenan via RT <perlbug-followup [...] perl.org>
From: Thomas Klausner <tk [...] giga.or.at>
Date: Wed, 15 Nov 2017 18:36:23 +0100
Subject: Re: [perl #132448] Carp quoting issue
Download (untitled) / with headers
text/plain 3.2k
On Wed, Nov 15, 2017 at 08:15:52AM -0800, James E Keenan via RT wrote: Show quoted text
> On Tue, 14 Nov 2017 23:30:56 GMT, tk@giga.or.at wrote:
> > This is a bug report for perl from tk@giga.or.at, > > generated with the help of perlbug 1.40 running under perl 5.26.1. > > > > > > ----------------------------------------------------------------- > > [Please describe your issue here] > > > > One of the self tests of Function-Parameters fails with perl-5.26.1 > > and the included Carp-1.42. When reporting this upstream to the > > package author, he analyzed it and claimed that the bug is in Carp. > > > > > > The original bug report is at > > https://github.com/mauke/Function-Parameters/issues/33 > > > > The test program that fails and should not fail according to > > the Function-Parameters maintainer is: > > > > #!perl > > use strict; > > use warnings FATAL => 'all'; > > use Test::More; > > > > use Carp; > > > > my $file = __FILE__; > > my $line = __LINE__; > > > > { > > package Foo; > > #use Function::Parameters; > > sub foo { my ($x, $y) = @_; > > Carp::confess "$x $y"; > > } > > > > eval { > > foo("abc", "123"); > > }; > > > > my $line_confess = $line + 6; > > my $line_foo = $line + 10; > > > > ::like($@, qr/^abc 123 at \Q$file\E line > > $line_confess\.?\n\tFoo::foo\((["'])abc\1, 123\) called at \Q$file\E > > line $line_foo/); > > } > > > > SKIP: { skip "Sub::Name required", 1 unless eval { require Sub::Name > > }; > > > > { > > package Bar; > > #use Function::Parameters; > > *bar = Sub::Name::subname(bar => sub { my ($a, $b) = @_; > > Carp::confess($a + $b) }); > > > > eval { > > bar(4, 5); > > }; > > > > my $line_confess = $line + 24; > > my $line_bar = $line + 27; > > > > ::like($@, qr/^9 at \Q$file\E line $line_confess\.?\n\tBar::bar\(4, > > 5\) called at \Q$file\E line $line_bar/); > > } > > > > } > > > > done_testing; > > > > For me, on NetBSD-8.99.6/amd64 with perl-5.26.1 this gives: > > > > # perl test > > not ok 1 > > # Failed test at test line 25. > > # 'abc 123 at test line 15. > > # Foo::foo("\"abc\"", 123) called at test line 19 > > # eval {...} called at test line 18 > > # ' > > # doesn't match '(?^:^abc 123 at test line > > 15\.?\n\tFoo::foo\((["'])abc\1, 123\) called at test line 19)' > > ok 2 > > 1..2 > > # Looks like you failed 1 test of 2. > > > >
> > The second test -- the one where Sub::Name has been installed and is being used -- appears to be dependent on line numbers hard-coded into the file -- yet the test which is of concern is "failing" only with respect to line numbers. You can get the second test to "pass" simply by manipulating the numbers assigned in these two lines: > > ##### > my $line_confess = $line + 24; > my $line_bar = $line + 27; > ##### > > And since it's only the second test that is failing, it is just as likely that this is a bug in Sub::Name (not part of the core distribution) as it is in Carp. > > Thank you very much.
I think there is a misunderstanding here. The second test passes fine for me. The first test fails. From the test output above: Show quoted text
> not ok 1 > ok 2
And when you look at the 'Failed test' lines you see that they containt 'foo' and not 'bar'. Thomas
Date: Thu, 16 Nov 2017 05:04:03 +0000
Subject: Re: [perl #132448] Carp quoting issue
To: perl5-porters [...] perl.org
From: Zefram <zefram [...] fysh.org>
Download (untitled) / with headers
text/plain 228b
Both tests pass for me, on perl 5.26.1 with Carp 1.42 on amd64 Linux. I agree that the test is reasonable. This looks more likely to be a core thing than Carp per se, but it's difficult to tell without seeing it fail. -zefram
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 514b
Dana Wed, 15 Nov 2017 21:04:24 -0800, zefram@fysh.org reče: Show quoted text
> Both tests pass for me, on perl 5.26.1 with Carp 1.42 on amd64 Linux. > I agree that the test is reasonable. This looks more likely to be a core > thing than Carp per se, but it's difficult to tell without seeing it fail.
NetBSD's perl is patched. See ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/ and especially ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/patch-dist_Carp_lib_Carp.pm Regards, Slaven
To: perl5-porters [...] perl.org
From: Zefram <zefram [...] fysh.org>
Date: Thu, 16 Nov 2017 07:52:11 +0000
Subject: Re: [perl #132448] Carp quoting issue
Download (untitled) / with headers
text/plain 807b
slaven@rezic.de via RT wrote: Show quoted text
>ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/patch-dist_Carp_lib_Carp.pm
Aha! Applying that patch makes the test case fail for me, both on 5.26.1 and on blead. The fault lies purely in that patch: it's introducing a layer of format_arg() in addition to the one that already exists a few lines later. The double quoting is exactly what should be expected from that mistake. It looks like the patch is derived from a patch for an older version of Carp, where it was modifying the single layer of format_arg(). Carp changed, moving the format_arg() call after the argument list truncation (commit e7eb9d6b8a020c216e2fe51ba09dd7561a729258 in late 2012), and the attempt to update the patch for the new Carp was botched. No bug relevant to p5p. -zefram
CC: perl5-porters [...] perl.org
To: perlbug-followup [...] perl.org
From: Sawyer X <xsawyerx [...] gmail.com>
Date: Thu, 16 Nov 2017 10:40:59 +0100
Subject: Re: [perl #132448] Carp quoting issue
Download (untitled) / with headers
text/plain 604b
On 11/16/2017 08:36 AM, slaven@rezic.de via RT wrote: Show quoted text
> Dana Wed, 15 Nov 2017 21:04:24 -0800, zefram@fysh.org reče:
>> Both tests pass for me, on perl 5.26.1 with Carp 1.42 on amd64 Linux. >> I agree that the test is reasonable. This looks more likely to be a core >> thing than Carp per se, but it's difficult to tell without seeing it fail.
> NetBSD's perl is patched. See ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/ and especially ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/patch-dist_Carp_lib_Carp.pm
Does anyone know the Perl porters in NetBSD? :)
From: Thomas Klausner <tk [...] giga.or.at>
To: Sawyer X via RT <perlbug-followup [...] perl.org>
Subject: Re: [perl #132448] Carp quoting issue
Date: Thu, 16 Nov 2017 10:48:32 +0100
Download (untitled) / with headers
text/plain 834b
On Thu, Nov 16, 2017 at 01:41:25AM -0800, Sawyer X via RT wrote: Show quoted text
> > > On 11/16/2017 08:36 AM, slaven@rezic.de via RT wrote:
> > Dana Wed, 15 Nov 2017 21:04:24 -0800, zefram@fysh.org reče:
> >> Both tests pass for me, on perl 5.26.1 with Carp 1.42 on amd64 Linux. > >> I agree that the test is reasonable. This looks more likely to be a core > >> thing than Carp per se, but it's difficult to tell without seeing it fail.
> > NetBSD's perl is patched. See ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/ and especially ftp://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/lang/perl5/patches/patch-dist_Carp_lib_Carp.pm
> > Does anyone know the Perl porters in NetBSD? :) >
I can remove the patch from perl in pkgsrc. Is there a better version available, or should it just be removed without replacement? Thomas
Subject: Re: [perl #132448] Carp quoting issue
Date: Thu, 16 Nov 2017 10:22:26 +0000
CC: perl5-porters [...] perl.org
From: Zefram <zefram [...] fysh.org>
To: Thomas Klausner <tk [...] giga.or.at>
Download (untitled) / with headers
text/plain 383b
Thomas Klausner wrote: Show quoted text
>Is there a better version available, or should it just be removed >without replacement?
It would best be removed without replacement. It is not a successful workaround for the problem that it's attempting to address, nor can it ever be made to work. The underlying problem is in the core of perl, and cannot be fixed anywhere other than the core. -zefram
CC: perl5-porters [...] perl.org
From: Sawyer X <xsawyerx [...] gmail.com>
To: Zefram <zefram [...] fysh.org>, Thomas Klausner <tk [...] giga.or.at>
Subject: Re: [perl #132448] Carp quoting issue
Date: Thu, 16 Nov 2017 11:24:57 +0100
Download (untitled) / with headers
text/plain 485b
On 11/16/2017 11:22 AM, Zefram wrote: Show quoted text
> Thomas Klausner wrote:
>> Is there a better version available, or should it just be removed >> without replacement?
> It would best be removed without replacement. It is not a successful > workaround for the problem that it's attempting to address, nor can it > ever be made to work. The underlying problem is in the core of perl, > and cannot be fixed anywhere other than the core.
Thank you everyone. I'm marking the ticket as rejected.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org