Преглед на файлове

dpkg: Fix --verify with --root

The code was not taking into account the root prefix when verifying
pathnames, which resulted in all files failing to verify.
Guillem Jover преди 11 години
родител
ревизия
64acb4e4b9
променени са 2 файла, в които са добавени 8 реда и са изтрити 1 реда
  1. 1 0
      debian/changelog
  2. 7 1
      src/verify.c

+ 1 - 0
debian/changelog

@@ -12,6 +12,7 @@ dpkg (1.18.3) UNRELEASED; urgency=low
     command instead of executing itself with --set or --auto per subtask.
   * Add kfreebsd-armhf support to ostable and triplettable. Closes: #796283
     Thanks to Steven Chamberlain <steven@pyro.eu.org>.
+  * Fix «dpkg --verify» with --root.
   * Perl modules:
     - Only warn on invalid week days instead of aborting in
       Dpkg::Changelog::Entry::Debian. Regression introduced in dpkg 1.18.2.

+ 7 - 1
src/verify.c

@@ -96,6 +96,7 @@ static void
 verify_package(struct pkginfo *pkg)
 {
 	struct fileinlist *file;
+	struct varbuf filename = VARBUF_INIT;
 
 	ensure_packagefiles_available(pkg);
 	parse_filehash(pkg, &pkg->installed);
@@ -116,9 +117,14 @@ verify_package(struct pkginfo *pkg)
 				fnn->newhash = fnn->oldhash;
 		}
 
+		varbuf_reset(&filename);
+		varbuf_add_str(&filename, instdir);
+		varbuf_add_str(&filename, fnn->name);
+		varbuf_end_str(&filename);
+
 		memset(&checks, 0, sizeof(checks));
 
-		md5hash(pkg, hash, fnn->name);
+		md5hash(pkg, hash, filename.buf);
 		if (strcmp(hash, fnn->newhash) != 0) {
 			checks.md5sum = VERIFY_FAIL;
 			failures++;