[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#192113: stat-override patch not quite right



There is another problem with the 'stripping trailing /' addition,
which the other two patches on this bug don't fix.

When doing --list, by the time we remove trailing slashes they have
already been escaped to \/ a few lines before, so we need to search
for that instead of just /.  This only applies to --list, because
--add and --remove don't do that escaping.

Here's another patch, against dpkg-1.10.10.



--- scripts/dpkg-statoverride.pl	Tue Apr 15 06:39:25 2003
+++ scripts/dpkg-statoverride.pl	Sun Aug 31 14:30:43 2003
@@ -98,7 +98,7 @@
 	(($mode<0) or (oct($mode)>07777)) && &badusage("illegal mode $mode");
 	$file= $ARGV[3];
 	$file =~ m/\n/ && &badusage("file may not contain newlines");
-	$file =~ s,/*$,, && print STDERR "stripping trailing /\n";
+	$file =~ s,/+$,, && print STDERR "$0: stripping trailing /\n";
 
 	if (defined $owner{$file}) {
 		print STDERR "An override for \"$file\" already exists, ";
@@ -125,7 +125,7 @@
 } elsif ($mode eq "remove") {
 	@ARGV==1 || &badusage("--remove needs one arguments");
 	$file=$ARGV[0];
-	$file =~ s,/*$,, && print STDERR "stripping trailing /\n";
+	$file =~ s,/+$,, && print STDERR "$0: stripping trailing /\n";
 	if (not defined $owner{$file}) {
 		print STDERR "No override present.\n";
 		exit(0) if ($doforce); 
@@ -144,7 +144,7 @@
 		s/\W/\\$&/g;
 		s/\\\?/./g;
 		s/\\\*/.*/g;
-		s,/*$,, && print STDERR "stripping trailing /\n";
+		s,(?:\\/)+$,, && print STDERR "$0: stripping trailing /\n";
 		push(@list,"^$_\$");
 	}
 	$pat= join('|',@list);



-- 

--- Geoff Richards -------------><-------------- http://ungwe.org/ ---
"I tried to fling my shadow at the moon,
 The while my blood leapt with a wordless song."  --  Theodore Roethke



Reply to: