Blame SOURCES/CPAN-2.18-For-cpan-j-make-the-file-an-absolute-path.patch

e743b8
From be1fa8db08d1995779592880cfe156f4351a89d5 Mon Sep 17 00:00:00 2001
e743b8
From: brian d foy <brian.d.foy@gmail.com>
e743b8
Date: Tue, 18 Oct 2016 16:02:51 -0400
e743b8
Subject: [PATCH] For cpan -j, make the file an absolute path
e743b8
MIME-Version: 1.0
e743b8
Content-Type: text/plain; charset=UTF-8
e743b8
Content-Transfer-Encoding: 8bit
e743b8
e743b8
This is an additional fix for rt.cpan.org #116507.
e743b8
Since . will not be in @INC, we can't assume we are
e743b8
loading from the current directory (although that's
e743b8
a very likely situation for -j). Take whatever
e743b8
argument we get and expand it to an absolute path.
e743b8
e743b8
Signed-off-by: Petr Písař <ppisar@redhat.com>
e743b8
---
e743b8
 lib/App/Cpan.pm | 8 +++++---
e743b8
 1 file changed, 5 insertions(+), 3 deletions(-)
e743b8
e743b8
diff --git a/lib/App/Cpan.pm b/lib/App/Cpan.pm
e743b8
index 3ddcbe8..bc22cbc 100644
e743b8
--- a/lib/App/Cpan.pm
e743b8
+++ b/lib/App/Cpan.pm
e743b8
@@ -289,7 +289,7 @@ use CPAN 1.80 (); # needs no test
e743b8
 use Config;
e743b8
 use autouse Cwd => qw(cwd);
e743b8
 use autouse 'Data::Dumper' => qw(Dumper);
e743b8
-use File::Spec::Functions;
e743b8
+use File::Spec::Functions qw(catfile file_name_is_absolute rel2abs);
e743b8
 use File::Basename;
e743b8
 use Getopt::Std;
e743b8
 
e743b8
@@ -1093,12 +1093,14 @@ sub _shell
e743b8
 
e743b8
 sub _load_config # -j
e743b8
 	{
e743b8
-	my $file = shift || '';
e743b8
+	my $argument = shift;
e743b8
+
e743b8
+	my $file = file_name_is_absolute( $argument ) ? $argument : rel2abs( $argument );
e743b8
+	croak( "cpan config file [$file] for -j does not exist!\n" ) unless -e $file;
e743b8
 
e743b8
 	# should I clear out any existing config here?
e743b8
 	$CPAN::Config = {};
e743b8
 	delete $INC{'CPAN/Config.pm'};
e743b8
-	croak( "Config file [$file] does not exist!\n" ) unless -e $file;
e743b8
 
e743b8
 	my $rc = eval "require '$file'";
e743b8
 
e743b8
-- 
e743b8
2.13.6
e743b8