Bladeren bron

Fix dpkg-divert test suite to cope with + in the build directory name

The directory name was not properly escaped in regular expressions
and lead to test failures when it contained + or other characters with
special meanings in regular expressions.

Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Jonathan Nieder 16 jaren geleden
bovenliggende
commit
9036687a8c
2 gewijzigde bestanden met toevoegingen van 13 en 5 verwijderingen
  1. 8 0
      debian/changelog
  2. 5 5
      src/t/100_dpkg_divert.t

+ 8 - 0
debian/changelog

@@ -1,3 +1,11 @@
+dpkg (1.15.8.3) UNRELEASED; urgency=low
+
+  * Fix dpkg-divert test suite to cope with + and other special characters for
+    regexps in the build directory name. Thanks to Jonathan Nieder for the
+    patch and to Phil Kern for the report. Closes: #591182
+
+ -- Raphaël Hertzog <hertzog@debian.org>  Sun, 01 Aug 2010 08:54:39 +0200
+
 dpkg (1.15.8.2) unstable; urgency=low
 
   * Bump libdpkg-perl Depends on dpkg to 1.15.8, as it will break dpkg

+ 5 - 5
src/t/100_dpkg_divert.t

@@ -236,7 +236,7 @@ install_diversions('');
 
 system("touch $testdir/foo");
 call_divert(['--rename', '--add', "$testdir/foo"],
-            expect_stdout_like => qr,Adding.*local.*diversion.*$testdir/foo.*$testdir/foo.distrib,,
+            expect_stdout_like => qr,Adding.*local.*diversion.*\Q$testdir\E/foo.*\Q$testdir\E/foo.distrib,,
             expect_stderr => '');
 ok(-e "$testdir/foo.distrib", "foo diverted");
 ok(!-e "$testdir/foo", "foo diverted");
@@ -250,7 +250,7 @@ install_diversions('');
 
 system("touch $testdir/foo");
 call_divert(['--add', "$testdir/foo"],
-            expect_stdout_like => qr,Adding.*local.*diversion.*$testdir/foo.*$testdir/foo.distrib,,
+            expect_stdout_like => qr,Adding.*local.*diversion.*\Q$testdir\E/foo.*\Q$testdir\E/foo.distrib,,
             expect_stderr => '');
 ok(!-e "$testdir/foo.distrib", "foo diverted");
 ok(-e "$testdir/foo", "foo diverted");
@@ -408,7 +408,7 @@ call_divert(["--package", "baz", "--divert", "$testdir/foo.my", "--remove", "$te
             expect_failure => 1, expect_stderr_like =>qr/mismatch on (package|divert-to)/);
 
 call_divert(["--divert", "$testdir/foo.distrib", "--remove", "$testdir/foo"],
-            expect_stdout_like => qr,Removing.*$testdir/foo,);
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,);
 diversions_eq(<<EOF);
 $testdir/bar
 $testdir/bar.distrib
@@ -429,7 +429,7 @@ call_divert(["$testdir/bar"]);
 call_divert(["$testdir/baz"]);
 
 call_divert(["--remove", "$testdir/bar"],
-            expect_stdout_like => qr,Removing.*$testdir/bar,);
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/bar,);
 diversions_eq(<<EOF);
 $testdir/foo
 $testdir/foo.distrib
@@ -469,7 +469,7 @@ system("touch $testdir/foo");
 call_divert(["--rename", "$testdir/foo"]);
 
 call_divert(["--test", "--rename", "--remove", "$testdir/foo"],
-            expect_stdout_like => qr,Removing.*$testdir/foo,, expect_stderr => '');
+            expect_stdout_like => qr,Removing.*\Q$testdir\E/foo,, expect_stderr => '');
 ok(-e "$testdir/foo.distrib");
 ok(!-e "$testdir/foo");
 diversions_eq($diversions_added_foo_local);