[interchange-cvs] interchange - jason modified Makefile.PL

interchange-core@interchange.redhat.com interchange-core@interchange.redhat.com
Sun Dec 30 13:23:01 2001


User:      jason
Date:      2001-12-30 18:22:51 GMT
Modified:  .        Makefile.PL
Log:
Fix bug discovered by Monte <monte@techark.com>, that prevents installation
if the target directory is a substring of the source directory.  This change
handles it by normalizing both directories, then comparing with eq, rather
than $realdir =~ /^\Q$origdir/.

There are perhaps better ways to do this (the two I thought of were to
compare the origdir and realdir inodes, or to check for the existence of
$realdir/Makefile.PL), but this seemed to me to be the best way.

Revision  Changes    Path
2.12      +8 -5      interchange/Makefile.PL


rev 2.12, prev_rev 2.11
Index: Makefile.PL
===================================================================
RCS file: /var/cvs/interchange/Makefile.PL,v
retrieving revision 2.11
retrieving revision 2.12
diff -u -r2.11 -r2.12
--- Makefile.PL	2001/09/07 04:38:26	2.11
+++ Makefile.PL	2001/12/30 18:22:51	2.12
@@ -407,26 +407,29 @@
 
 	my $realdir;
 
+	$origdir =~ s:[\\/]\s*$::;
+	$origdir =~ s:^\s*::;
+
 	if(! $MV::Default{final}) {
 		&copyright_prompt();
 
 		# don't suggest install target same as software source directory
 		$MV::Default{PREFIX} = '' if
-			$MV::Default{PREFIX} =~ /^\Q$origdir/;
+			$MV::Default{PREFIX} eq $origdir;
 
 		{
 			$realdir = my_prompt(
 								"Where is your Interchange to be installed? ",
 								$MV::Default{PREFIX},
 								);
-			if ($realdir =~ /^\s*\Q$origdir/) {
+			$realdir =~ s:[\\/]\s*$::;
+			$realdir =~ s:^\s*::;
+			if ($realdir eq $origdir) {
 				warn "Can't install in software source directory!\n";
 				redo;
 			}
 		}
 		print "\n";
-		$realdir =~ s:[\\/]\s*$::;
-		$realdir =~ s:^\s*::;
 	}
 	else {
 		$MV::Default{final} =~ s:[\\/]\s*$::;
@@ -435,7 +438,7 @@
 	}
 
 	die "Can't install in software source directory!\n" if
-		! $MV::Default{force} && $realdir =~ /^\Q$origdir/;
+		! $MV::Default{force} && $realdir eq $origdir;
 
 #warn "Got past realdir prompt\n" ; #if $X{RPMBUILDDIR};