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] ignore insignificant version discrepancies between Carp and Carp::Heavy #13708

Closed
p5pRT opened this issue Apr 3, 2014 · 12 comments
Closed
Labels

Comments

@p5pRT
Copy link

p5pRT commented Apr 3, 2014

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

Searchable as RT121574$

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

Patch was prepared via "git format-patch -1", and is included as an attachment.

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

0001-Ignore-mismatched-versions-between-Carp-and-Carp-Hea.patch
From c3dd9ac76b130c389310f61b04892c7bbdb047a2 Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Thu, 3 Apr 2014 11:08:20 -0700
Subject: [PATCH] Ignore mismatched versions between Carp and Carp::Heavy if
 the version discrepancy does not actually lead to broken code

Carp::Heavy's guts were merged into Carp in 1.12. After this point, if a
different version of Carp::Heavy is loaded than Carp, no harm will be done and
the error can be ignored.
---
 dist/Carp/lib/Carp.pm       | 2 +-
 dist/Carp/lib/Carp/Heavy.pm | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index 24c0cd1..99b6945 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -87,7 +87,7 @@ BEGIN {
     }
 }
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
 our $MaxEvalLen = 0;
 our $Verbose    = 0;
diff --git a/dist/Carp/lib/Carp/Heavy.pm b/dist/Carp/lib/Carp/Heavy.pm
index 5e13cb2..ebd23d6 100644
--- a/dist/Carp/lib/Carp/Heavy.pm
+++ b/dist/Carp/lib/Carp/Heavy.pm
@@ -2,10 +2,13 @@ package Carp::Heavy;
 
 use Carp ();
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
+# Carp::Heavy was merged into Carp in version 1.12.
+# Any mismatched versions after this point are not significant and can be
+# ignored.
 my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
-if($cv ne $VERSION) {
+if($cv ne $VERSION and ($cv lt '1.12' or $VERSION lt '1.12')) {
 	die "Version mismatch between Carp $cv ($INC{q(Carp.pm)}) and Carp::Heavy $VERSION ($INC{q(Carp/Heavy.pm)}).  Did you alter \@INC after Carp was loaded?\n";
 }
 
-- 
1.8.5.4

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From zefram@fysh.org

Karen Etheridge wrote​:

my $cv = defined($Carp​::VERSION) ? $Carp​::VERSION : "undef";
+if($cv ne $VERSION and ($cv lt '1.12' or $VERSION lt '1.12')) {

$VERSION can't be lt 1.12, having been set earlier in the same file to a
higher version. $cv lt 1.12 mishandles the undef case. $cv ne $VERSION
is redundant with the lt check. String comparisons are not correct for
inequality comparisons of version numbers. You want something like

  if (($Carp​::VERSION || 0) < 1.12) {
  my $cv = defined($Carp​::VERSION) ? $Carp​::VERSION : "undef";

-zefram

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

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

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

Agreed. I'll attach a new patch.

On Thu, Apr 03, 2014 at 07​:55​:48PM +0100, Zefram wrote​:

Karen Etheridge wrote​:

my $cv = defined($Carp​::VERSION) ? $Carp​::VERSION : "undef";
+if($cv ne $VERSION and ($cv lt '1.12' or $VERSION lt '1.12')) {

$VERSION can't be lt 1.12, having been set earlier in the same file to a
higher version. $cv lt 1.12 mishandles the undef case. $cv ne $VERSION
is redundant with the lt check. String comparisons are not correct for
inequality comparisons of version numbers. You want something like

if \(\($Carp&#8203;::VERSION || 0\) \< 1\.12\) \{
    my $cv = defined\($Carp&#8203;::VERSION\) ? $Carp&#8203;::VERSION : "undef";

-zefram

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

Better patch attached. Thanks, Zefram!

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

0001-Ignore-mismatched-versions-between-Carp-and-Carp-Hea.patch
From 90216e5dc2f8bccd094a859e697ea4cdbaa19830 Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Thu, 3 Apr 2014 11:08:20 -0700
Subject: [PATCH] Ignore mismatched versions between Carp and Carp::Heavy if
 the version discrepancy does not actually lead to broken code

Carp::Heavy's guts were merged into Carp in 1.12. After this point, if a
different version of Carp::Heavy is loaded than Carp, no harm will be done and
the error can be ignored.
---
 dist/Carp/lib/Carp.pm       | 2 +-
 dist/Carp/lib/Carp/Heavy.pm | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index 24c0cd1..99b6945 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -87,7 +87,7 @@ BEGIN {
     }
 }
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
 our $MaxEvalLen = 0;
 our $Verbose    = 0;
diff --git a/dist/Carp/lib/Carp/Heavy.pm b/dist/Carp/lib/Carp/Heavy.pm
index 5e13cb2..3ca266e 100644
--- a/dist/Carp/lib/Carp/Heavy.pm
+++ b/dist/Carp/lib/Carp/Heavy.pm
@@ -2,10 +2,12 @@ package Carp::Heavy;
 
 use Carp ();
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
-my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
-if($cv ne $VERSION) {
+# Carp::Heavy was merged into Carp in version 1.12.  Any mismatched versions
+# after this point are not significant and can be ignored.
+if(($Carp::VERSION || 0) < 1.12)) {
+	my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
 	die "Version mismatch between Carp $cv ($INC{q(Carp.pm)}) and Carp::Heavy $VERSION ($INC{q(Carp/Heavy.pm)}).  Did you alter \@INC after Carp was loaded?\n";
 }
 
-- 
1.8.5.4

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

Horrible parenthetical error fixed.

@p5pRT
Copy link
Author

p5pRT commented Apr 3, 2014

From @karenetheridge

0001-Ignore-mismatched-versions-between-Carp-and-Carp-Hea.patch
From 90216e5dc2f8bccd094a859e697ea4cdbaa19830 Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Thu, 3 Apr 2014 11:08:20 -0700
Subject: [PATCH] Ignore mismatched versions between Carp and Carp::Heavy if
 the version discrepancy does not actually lead to broken code

Carp::Heavy's guts were merged into Carp in 1.12. After this point, if a
different version of Carp::Heavy is loaded than Carp, no harm will be done and
the error can be ignored.
---
 dist/Carp/lib/Carp.pm       | 2 +-
 dist/Carp/lib/Carp/Heavy.pm | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dist/Carp/lib/Carp.pm b/dist/Carp/lib/Carp.pm
index 24c0cd1..99b6945 100644
--- a/dist/Carp/lib/Carp.pm
+++ b/dist/Carp/lib/Carp.pm
@@ -87,7 +87,7 @@ BEGIN {
     }
 }
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
 our $MaxEvalLen = 0;
 our $Verbose    = 0;
diff --git a/dist/Carp/lib/Carp/Heavy.pm b/dist/Carp/lib/Carp/Heavy.pm
index 5e13cb2..3ca266e 100644
--- a/dist/Carp/lib/Carp/Heavy.pm
+++ b/dist/Carp/lib/Carp/Heavy.pm
@@ -2,10 +2,12 @@ package Carp::Heavy;
 
 use Carp ();
 
-our $VERSION = '1.33';
+our $VERSION = '1.34';
 
-my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
-if($cv ne $VERSION) {
+# Carp::Heavy was merged into Carp in version 1.12.  Any mismatched versions
+# after this point are not significant and can be ignored.
+if(($Carp::VERSION || 0) < 1.12) {
+	my $cv = defined($Carp::VERSION) ? $Carp::VERSION : "undef";
 	die "Version mismatch between Carp $cv ($INC{q(Carp.pm)}) and Carp::Heavy $VERSION ($INC{q(Carp/Heavy.pm)}).  Did you alter \@INC after Carp was loaded?\n";
 }
 
-- 
1.8.5.4

@p5pRT
Copy link
Author

p5pRT commented Apr 14, 2014

From @tonycoz

On Thu Apr 03 12​:22​:49 2014, ether wrote​:

Horrible parenthetical error fixed.

This looks sane to me, added as a 5.21.1 blocker since blead is frozen.

Tony

@p5pRT
Copy link
Author

p5pRT commented May 28, 2014

From @tonycoz

On Thu Apr 03 12​:22​:49 2014, ether wrote​:

Horrible parenthetical error fixed.

Thanks, applied as a18468a.

Tony

@p5pRT p5pRT closed this as completed May 28, 2014
@p5pRT
Copy link
Author

p5pRT commented May 28, 2014

@tonycoz - 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
Projects
None yet
Development

No branches or pull requests

1 participant