summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2015-09-01 19:04:57 +0200
committerGuillem Jover <guillem@debian.org>2015-09-14 05:44:09 +0200
commit64acb4e4b98d7abe7436d83f0d64f0a3238fe5f3 (patch)
tree671dc19fb74cc7983f67d2a59328a4a2acdbeae1
parent21f5898d846a1cd69bdc6849e2097168cde02fdf (diff)
downloaddpkg-64acb4e4b98d7abe7436d83f0d64f0a3238fe5f3.tar.gz
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.
-rw-r--r--debian/changelog1
-rw-r--r--src/verify.c8
2 files changed, 8 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index f60ebd656..ace9a74dd 100644
--- a/debian/changelog
+++ b/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.
diff --git a/src/verify.c b/src/verify.c
index 28fa84682..e2d087217 100644
--- a/src/verify.c
+++ b/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++;