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

Problems with Carp::longmess() in 5.17.10 and before #12914

Open
p5pRT opened this issue Apr 15, 2013 · 22 comments
Open

Problems with Carp::longmess() in 5.17.10 and before #12914

p5pRT opened this issue Apr 15, 2013 · 22 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 15, 2013

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

Searchable as RT117613$

@p5pRT
Copy link
Author

p5pRT commented Apr 15, 2013

From @schwern

Created by @schwern

Carp​::longmess() has a new problem in 5.17.10. If called outside
a subroutine it doesn't have a file or line and throws undefined
variable warnings. This is a regression and unpleasant.

Also longmess() behaves differently from any other Carp function. It's
one stack frame up. It appears to have been this way since at least
1.10/5.8.9. I'd argue it's a long standing bug, shortmess is the
non-printing version of carp/croak. longmess is the non-printing
version of cluck/confess. Their messages below shouldn't differ.

$ cat ~/tmp/test.plx
#!/usr/bin/env perl

use v5.10;
use strict;
use warnings;

use Carp qw(longmess cluck shortmess carp);

say "Outside a subroutine";
print STDERR shortmess("shortmess");
carp("carp");
print STDERR longmess("longmess");
cluck("cluck");
say("");

sub foo {
  say "Inside a subroutine";
  print STDERR shortmess("shortmess");
  carp("carp");
  print STDERR longmess("longmess");
  cluck("cluck");
}
foo();

$ perl5.16.2 ~/tmp/test.plx
Outside a subroutine
shortmess at /Users/schwern/tmp/test.plx line 10.
carp at /Users/schwern/tmp/test.plx line 11.
longmess at /Users/schwern/tmp/test.plx line 12.
cluck at /Users/schwern/tmp/test.plx line 13.

Inside a subroutine
shortmess at /Users/schwern/tmp/test.plx line 18.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23
carp at /Users/schwern/tmp/test.plx line 19.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23
longmess at /Users/schwern/tmp/test.plx line 23.
cluck at /Users/schwern/tmp/test.plx line 21.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23

$ perl5.17.10 ~/tmp/test.plx
Outside a subroutine
shortmess at /Users/schwern/tmp/test.plx line 10.
carp at /Users/schwern/tmp/test.plx line 11.
Use of uninitialized value in concatenation (.) or string at
/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10/Carp.pm
line 307.
Use of uninitialized value in concatenation (.) or string at
/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10/Carp.pm
line 307.
longmess at line .
cluck at /Users/schwern/tmp/test.plx line 13.

Inside a subroutine
shortmess at /Users/schwern/tmp/test.plx line 18.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23
carp at /Users/schwern/tmp/test.plx line 19.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23
longmess at /Users/schwern/tmp/test.plx line 23.
cluck at /Users/schwern/tmp/test.plx line 21.
  main​::foo() called at /Users/schwern/tmp/test.plx line 23

Perl Info

Flags:
    category=library
    severity=medium
    module=Carp

Site configuration information for perl 5.17.10:

Configured by schwern at Fri Apr 12 23:49:21 BST 2013.

Summary of my perl5 (revision 5 version 17 subversion 10) configuration:

  Platform:
    osname=darwin, osvers=12.3.0, archname=darwin-2level
    uname='darwin windhund 12.3.0 darwin kernel version 12.3.0: sun jan
6 22:37:10 pst 2013; root:xnu-2050.22.13~1release_x86_64 x86_64 i386
macbookpro8,1 darwin '
    config_args='-de
-Dprefix=/Users/schwern/perl5/perlbrew/perls/perl-5.17.10 -Dusedevel
-Aeval:scriptdir=/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing
-pipe -fstack-protector -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe
-fstack-protector -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 4.2
(clang-425.0.27)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='
-fstack-protector -L/opt/local/lib'
    libpth=/opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-L/opt/local/lib -fstack-protector'

Locally applied patches:



@INC for perl 5.17.10:

/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/site_perl/5.17.10/darwin-2level
    /Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/site_perl/5.17.10

/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10/darwin-2level
    /Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10
    .


Environment for perl 5.17.10:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/schwern
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)

PATH=/Users/schwern/perl5/perlbrew/bin:/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/bin:/Users/schwern/.rbenv/shims:/Users/schwern/.rbenv/bin:/opt/local/bin:/opt/local/sbin:/opt/local/libexec/gnubin:/Users/schwern/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/MacGPG2/bin
    PERLBREW_BASHRC_VERSION=0.62
    PERLBREW_HOME=/Users/schwern/.perlbrew
    PERLBREW_MANPATH=/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/man

PERLBREW_PATH=/Users/schwern/perl5/perlbrew/bin:/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/bin
    PERLBREW_PERL=perl-5.17.10
    PERLBREW_ROOT=/Users/schwern/perl5/perlbrew
    PERLBREW_VERSION=0.62
    PERL_AUTOINSTALL=--defaultdeps
    PERL_BADLANG (unset)
    SHELL=/bin/bash


@p5pRT
Copy link
Author

p5pRT commented Apr 15, 2013

From @schwern

I did a little debugging and discovered the difference between 5.17.10
and 5.16.2 is Carp​::long_error_loc() is returning 2 in 5.17.10 and 1 in
5.16.2 causing Carp to look one level too high on the stack.

@p5pRT
Copy link
Author

p5pRT commented Apr 15, 2013

From @iabyn

On Mon, Apr 15, 2013 at 01​:34​:14AM +0100, Michael G. Schwern wrote​:

I did a little debugging and discovered the difference between 5.17.10
and 5.16.2 is Carp​::long_error_loc() is returning 2 in 5.17.10 and 1 in
5.16.2 causing Carp to look one level too high on the stack.

The "uninit var" warnings bisect to​:

5bbc4d5 is the first bad commit
commit 5bbc4d5
Author​: Jesse Luehrs <doy@​tozt.net>
Date​: Wed Mar 28 21​:44​:41 2012 -0500

  fix Carp stacktraces after deleting a stash
 
  When a stash is deleted, caller() will return undef in the package slot
  for any stack level for which the deleted stash was the current package.
  This made Carp confused in some cases, so fix that.

--
Fire extinguisher (n) a device for holding open fire doors.

@p5pRT
Copy link
Author

p5pRT commented Apr 15, 2013

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

@p5pRT
Copy link
Author

p5pRT commented Apr 17, 2013

From @schwern

On 4/15/13 1​:31 PM, Dave Mitchell via RT wrote​:

The "uninit var" warnings bisect to​:

Thanks, I also found this in the comments...

sub longmess {
  # Icky backwards compatibility wrapper. :-(
  #
  # The story is that the original implementation hard-coded the
  # number of call levels to go back, so calls to longmess were off
  # by one. Other code began calling longmess and expecting this
  # behaviour, so the replacement has to emulate that behaviour.

So I guess we're stuck with this behavior. I propose three things.

1) Fix the uninit warning. If we're going to support it, let's support it.
2) Document the misfeature of longmess().
3) Create a replacement for longmess() which DTRT.

@p5pRT
Copy link
Author

p5pRT commented Apr 18, 2013

From @rurban

On Wed, Apr 17, 2013 at 1​:50 PM, Michael G. Schwern <schwern@​pobox.com> wrote​:

On 4/15/13 1​:31 PM, Dave Mitchell via RT wrote​:

The "uninit var" warnings bisect to​:

Thanks, I also found this in the comments...

sub longmess {
# Icky backwards compatibility wrapper. :-(
#
# The story is that the original implementation hard-coded the
# number of call levels to go back, so calls to longmess were off
# by one. Other code began calling longmess and expecting this
# behaviour, so the replacement has to emulate that behaviour.

So I guess we're stuck with this behavior. I propose three things.

1) Fix the uninit warning. If we're going to support it, let's support it.
2) Document the misfeature of longmess().
3) Create a replacement for longmess() which DTRT.

4) longmess should be converted to an op.
It's ridiculous to destabilize an already unstable system (inside an exception)
by loading DynaLoader and Carp friends just to show the callstack of
the failure.

It's on my todo list since a few years, but got not enough encouragement so far.
--
Reini Urban
http​://cpanel.net/ http​://www.perl-compiler.org/

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2013

From @rjbs

On Wed Apr 17 11​:51​:24 2013, schwern wrote​:

So I guess we're stuck with this behavior. I propose three things.

Does this mean that you believe this is not blocking 5.18.0? I agree that it's icky and it would be
nice to have some sane means to get what we want, whether it's fixing the code or adding
something new. If this is a misfeature and not a regression, though, we're okay to ship like this,
right-o?

Thanks.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Apr 23, 2013

From @schwern

On 4/22/13 8​:09 PM, Ricardo SIGNES via RT wrote​:

On Wed Apr 17 11​:51​:24 2013, schwern wrote​:

So I guess we're stuck with this behavior. I propose three things.

Does this mean that you believe this is not blocking 5.18.0? I agree that it's icky and it would be
nice to have some sane means to get what we want, whether it's fixing the code or adding
something new. If this is a misfeature and not a regression, though, we're okay to ship like this,
right-o?

I would like to see the warning and top level mistake fixed. That is a
clear regression. The rest can wait.

$ perl -wle 'use Carp; print Carp​::longmess("Foo")'
Foo at -e line 1.

$ perlbrew use perl-5.17.10

$ perl -wle 'use Carp; print Carp​::longmess("Foo")'
Use of uninitialized value in concatenation (.) or string at
/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10/Carp.pm
line 307.
Use of uninitialized value in concatenation (.) or string at
/Users/schwern/perl5/perlbrew/perls/perl-5.17.10/lib/5.17.10/Carp.pm
line 307.
Foo at line .

Let me poke at it again now.

@p5pRT
Copy link
Author

p5pRT commented May 1, 2013

From @rjbs

* "Michael G. Schwern" <schwern@​pobox.com> [2013-04-23T11​:00​:07]

I would like to see the warning and top level mistake fixed. That is a
clear regression. The rest can wait.

$ perl -wle 'use Carp; print Carp​::longmess("Foo")'
Foo at -e line 1.

$ perlbrew use perl-5.17.10

$ perl -wle 'use Carp; print Carp​::longmess("Foo")'
Use of uninitialized value in concatenation (.) or string at
[…]
Let me poke at it again now.

Any luck? :)

I did some poking and talking, too. You mention the "icky compatibility
wrapper," which does this​:

  local $CarpLevel = $CarpLevel + 1;

...for non-Internal callers. Frustratingly, there are no tests for this
behavior. If we remove that line, all the tests pass *and* your oneliner does
the right thing again. The "the story is" comment was introduced by​:

  commit d735c2e
  Author​: Ben Tilly <ben_tilly@​operamail.com>
  Date​: Sun Oct 22 07​:07​:23 2006 -0700

  Re​: Why aren't %Carp​::Internal and %Carp​::CarpInternal documented?
  From​: "Ben Tilly" <btilly@​gmail.com>
  Message-ID​: <acc274b30610221407o39e0157gad44ad5828c2bc21@​mail.gmail.com>

That message is​:

  http​://www.nntp.perl.org/group/perl.perl5.porters/2006/10/msg117394.html

The actual CarpLevel+1 seems to come from​:

  commit c01c1f0
  Author​: Ben Tilly <ben_tilly@​operamail.com>
  Date​: Sun Dec 2 06​:32​:51 2001 -0500

  RE​: More verbose POD for Carp
  Message-ID​: <3C0A9748@​operamail.com>

  p4raw-id​: //depot/perl@​13426

That message is​:

  http​://www.nntp.perl.org/group/perl.perl5.porters/2001/12/msg48132.html

There, the intent is clear​: a goto is being replaced by a subroutine call, so
one more frame has to be accounted for. I believe that the changes to
long_error_loc have made this redundant. I have only gazed adoringly at this
code, though, not carefully traced it. I don't know when this may have
happened, as removing that line before doy's work still causes no breakage. I
need to get to bed so I can't bisect right now.

That said... here is the code as it stands​:

  1 sub longmess {
  2 # Icky backwards compatibility wrapper. :-(
  3 #
  4 # The story is that the original implementation hard-coded the
  5 # number of call levels to go back, so calls to longmess were off
  6 # by one. Other code began calling longmess and expecting this
  7 # behaviour, so the replacement has to emulate that behaviour.
  8 my $cgc = _cgc();
  9 my $call_pack = $cgc ? $cgc->() : caller();
  10 if ( $Internal{$call_pack} or $CarpInternal{$call_pack} ) {
  11 return longmess_heavy(@​_);
  12 }
  13 else {
  14 local $CarpLevel = $CarpLevel + 1;
  15 return longmess_heavy(@​_);
  16 }
  17 }

Removing line 14 seems to solve our woes, possibly breaking things
un-tested-for. Replacing lines 10-16 with line 11 also leaves everything
passing, of course. Woe befall he who deletes line 9, though. Tests rely
on that callback getting called, even if you don't use it.

Fine.

Anyway, the bare minimum of what we need is​:

1) a test for the problem Schwern has reported, suitable for adding to the dist
2) some further eyes investigating whether removing line 14 above is actually
  okay; I'm not sure Ben Tilly is around anymore; last p5p post, 2009?

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented May 1, 2013

From @perhunter

On 04/30/2013 11​:31 PM, Ricardo Signes wrote​:

2) some further eyes investigating whether removing line 14 above is
actually okay; I'm not sure Ben Tilly is around anymore; last p5p
post, 2009?

he is on boston.pm's list and posted recently. do you want me to notify
him that you are looking at this?

uri

@p5pRT
Copy link
Author

p5pRT commented May 1, 2013

From @rjbs

On Wed May 01 00​:00​:45 2013, uri@​stemsystems.com wrote​:

On 04/30/2013 11​:31 PM, Ricardo Signes wrote​:

2) some further eyes investigating whether removing line 14 above is
actually okay; I'm not sure Ben Tilly is around anymore; last p5p
post, 2009?

he is on boston.pm's list and posted recently. do you want me to notify
him that you are looking at this?

It certainly couldn't hurt!

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented May 1, 2013

From @rjbs

* Ricardo Signes <perl.p5p@​rjbs.manxome.org> [2013-04-30T23​:31​:32]

1) a test for the problem Schwern has reported, suitable for adding to the
dist
2) some further eyes investigating whether removing line 14 above is actually
okay; I'm not sure Ben Tilly is around anymore; last p5p post, 2009?

I didn't do either of these, but I did fix the problem without breaking the
tests for deleted stashes that Jesse L. added. We need #1 for sure. #2 is
maybe just a curiousity.

http​://perl5.git.perl.org/perl.git/commitdiff/6b2121fe25c3eebc9ce986961f45c85792a98723?hp=ee901278692902248f7ad3bf72820233b3f9269a

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented May 2, 2013

From @rjbs

I wrote a test. I feel good about this change, and I think it makes sense, as much as anything in
a pure-perl carp implementation is going to make sense. I've pushed it to blead and am
marking this bug not-blocking for 5.18.0.

@p5pRT
Copy link
Author

p5pRT commented May 2, 2013

From @schwern

Thanks, I did look at it but couldn't make heads or tails of the code.

Does this mean longmess will now produce the same stack trace as
everything else?

FWIW longmess isn't used very often, on a relative scale. Just 250 hits
on CPAN->grep which isn't much. And that's without filtering out copies
of Carp.
http​://grep.cpan.me/?q=longmess

I don't see anything which looks like it's taking advantage of, or even
working around, the current misbehavior of longmess.

@p5pRT
Copy link
Author

p5pRT commented May 6, 2013

From @rjbs

* "Michael G. Schwern" <schwern@​pobox.com> [2013-05-02T09​:25​:22]

Does this mean longmess will now produce the same stack trace as
everything else?

I *specifically* and *only* addressed the case where it ascended up past the
top of the stack.

I don't mind looking at fixing the "intentionally off by one" thing, but I'd
rather do that in a month than just before 5.18 ships.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Aug 9, 2014

From @jkeenan

On Mon May 06 15​:18​:02 2013, perl.p5p@​rjbs.manxome.org wrote​:

* "Michael G. Schwern" <schwern@​pobox.com> [2013-05-02T09​:25​:22]

Does this mean longmess will now produce the same stack trace as
everything else?

I *specifically* and *only* addressed the case where it ascended up past the
top of the stack.

I don't mind looking at fixing the "intentionally off by one" thing, but I'd
rather do that in a month than just before 5.18 ships.

rjbs​: Any further thoughts on this ticket?

Thank you very much.
Jim Keenan

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2014

From @rjbs

* James E Keenan via RT <perlbug-followup@​perl.org> [2014-08-08T20​:31​:03]

rjbs​: Any further thoughts on this ticket?

It seems to me that longmess should do what it is documented to do, and give
the same message as Carp. I think we'd want to get a CPAN smoke of this
change.

I am supporting of a well-done mechanism for getting a fast core-provided stack
trace, as alluded to in the ticket, but I think that's a different matter.

This is a place where we could be breaking a lot of tests. Even though they'd
probably be "bad tests," I think it might be bad enough that we decide to
provide a replacement that DTRT, as Schwern suggested, rather than fix longmess
itself.

So​: the plan sounds like​:

  1. fix longmess in a branch
  2. smoke cpan
  3. act accordingly

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Sep 15, 2014

From @jkeenan

On Mon Sep 15 15​:34​:55 2014, perl.p5p@​rjbs.manxome.org wrote​:

* James E Keenan via RT <perlbug-followup@​perl.org> [2014-08-
08T20​:31​:03]

rjbs​: Any further thoughts on this ticket?

It seems to me that longmess should do what it is documented to do,
and give
the same message as Carp.

Same message as Carp​::<what?> ?

In blead, the documentation of 'longmess' comes down to this​:

#####
$long_message = longmess( "message from cluck() or confess()" );
#...
In the case of "cluck()" and "confess()", that context is a summary of every call in the call-stack; "longmess()" returns the contents of the error message.
#####

Along similar lines, shortmess() is currently documented to return the error message from carp() or croak().

Here's what I get from re-running Schwern's original script against blead (f1126a9)​:

#####
$ ./perl -Ilib ~/learn/perl/p5p/117613-longmess.pl
Outside a subroutine
shortmess at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 8.
carp at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 9.
longmess at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 10.
cluck at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 11.

Inside a subroutine
shortmess at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 16.
  main​::foo() called at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 21
carp at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 17.
  main​::foo() called at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 21
longmess at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 21.
cluck at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 19.
  main​::foo() called at /home/jkeenan/learn/perl/p5p/117613-longmess.pl line 21
#####

rjbs​: Can you restate how longmess() should be documented and what it ought to do in the above example?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Sep 16, 2014

From @schwern

longmess() should produce the exact same message as cluck() and confess(), as stated in the documentation here in the SYNOPSIS...

  $long_message = longmess( "message from cluck() or confess()" );

And here in the first paragraph of the DESCRIPTION...

  The Carp routines are useful in your own modules because they act like
  "die()" or "warn()", but with a message which is more likely to be
  useful to a user of your module. In the case of "cluck()" and
  "confess()", that context is a summary of every call in the call-stack;
  "longmess()" returns the contents of the error message.

And according to what makes sense for the utility of that function.

The attached test should pass.

If we decide to leave longmess() as is for historical compatibility reasons, I suggest the new, corrected version be called cluck_message() and shortmess() be called croak_message() to link them directly with their associated functions. I would also recommend aliases for confess_message() and carp_message() to remove one step from the gap of evaluation, when a user wants the message which goes with confess() they do not additionally need to realize that confess() goes with cluck().

@p5pRT
Copy link
Author

p5pRT commented Sep 16, 2014

From @schwern

use Carp qw(longmess cluck confess);
use Test​::More;

my $longmess;
sub longmess_variations {
  # All on the same line to preserve line numbering.
  $longmess = longmess("message"); cluck("message"); confess("message");
}

sub test_longmess {
  my($longmess, $cluck, $confess) = @​_;

  local $Test​::Builder​::Level = $Test​::Builder​::Level + 1;

  is $longmess, $cluck, "longmess() & cluck()";
  is $longmess, $confess, "longmess() & confess()";
  is $cluck, $confess, "cluck() & confess()";
}

note "longmess variations inside a subroutine"; {
  my $cluck;
  local $SIG{__WARN__} = sub { $cluck = join "", @​_ };

  eval { longmess_variations(); };
  my $confess = $@​;

  test_longmess($longmess, $cluck, $confess);
}

note "longmess variations outside a subroutine"; {
  my $cluck;
  local $SIG{__WARN__} = sub { $cluck = join "", @​_ };

  eval {
  $longmess = longmess("message"); cluck("message"); confess("message");
  };
  my $confess = $@​;

  test_longmess($longmess, $cluck, $confess);
}

done_testing;

@p5pRT
Copy link
Author

p5pRT commented Oct 11, 2014

From @rjbs

shortmess/longmess were widely used before their current stint of being documented, which was done for [perl #114280]. FC suggested that we were forgetting something​:

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=114280#txn-1155408

Presumably this is that thing nobody could remember at the time.

longmess and shortmess have always (in my digging) been documented as returning the same things as cluck and carp, either in those terms or by virtue of the same language being used to document each pair.

I would rather that we fix longmess and shortmess. Almost certainly, anything that is "broken" by this change is actually being fixed, except for bad test expectations. The question is​: how much is that?

Where do we stand on doing comparison CPAN smokes? I think our current (or most recent) champion for that is Matthew Horsfall, who is, I believe, on vacation.

--
rjbs

@p5pRT
Copy link
Author

p5pRT commented Oct 11, 2014

From [Unknown Contact. See original ticket]

shortmess/longmess were widely used before their current stint of being documented, which was done for [perl #114280]. FC suggested that we were forgetting something​:

https://rt-archive.perl.org/perl5/Ticket/Display.html?id=114280#txn-1155408

Presumably this is that thing nobody could remember at the time.

longmess and shortmess have always (in my digging) been documented as returning the same things as cluck and carp, either in those terms or by virtue of the same language being used to document each pair.

I would rather that we fix longmess and shortmess. Almost certainly, anything that is "broken" by this change is actually being fixed, except for bad test expectations. The question is​: how much is that?

Where do we stand on doing comparison CPAN smokes? I think our current (or most recent) champion for that is Matthew Horsfall, who is, I believe, on vacation.

--
rjbs

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