[Reproducible-commits] [dpkg] 41/61: libdpkg: Do not try to release the triggers lock on dry-run

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Sep 21 09:57:39 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 908261815da543e2b9a4ec046e6859e68ea26431
Author: Guillem Jover <guillem at debian.org>
Date:   Wed Sep 16 02:14:31 2015 +0200

    libdpkg: Do not try to release the triggers lock on dry-run
    
    We were installing a dummy cleanup handler, but removing it on some
    error conditions when returning from trigdef_update_start(), but
    trigdef_process_done() was expecting to always have a cleanup handler
    to pop.
    
    Reported-by: David Kalnischkies <david at kalnischkies.de>
---
 debian/changelog        |  2 ++
 lib/dpkg/trigdeferred.l | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index accfdf4..31f0666 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,8 @@ dpkg (1.18.3) UNRELEASED; urgency=low
   * Switch dselect multicd method license from GPL2 to GPL2+, with consent
     from all its authors.
   * Fix inadvertent license change for lib/dpkg/utils.c from GPL2 to GPL2+.
+  * Fix segfault when using «dpkg --no-act» with a synthetic --admindir.
+    Reported by David Kalnischkies <david at kalnischkies.de>.
   * 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/lib/dpkg/trigdeferred.l b/lib/dpkg/trigdeferred.l
index c95b476..4a0089e 100644
--- a/lib/dpkg/trigdeferred.l
+++ b/lib/dpkg/trigdeferred.l
@@ -139,9 +139,6 @@ trigdef_update_start(enum trigdef_update_flags uf)
 		}
 
 		file_lock(&lock_fd, FILE_LOCK_WAIT, fn.buf, _("triggers area"));
-	} else {
-		/* Dummy for pop_cleanups. */
-		push_cleanup(NULL, 0, NULL, 0, 0);
 	}
 
 	constructfn(&fn, triggersdir, TRIGGERSDEFERREDFILE);
@@ -154,7 +151,8 @@ trigdef_update_start(enum trigdef_update_flags uf)
 			ohshite(_("unable to open triggers deferred file '%.250s'"),
 			        fn.buf);
 		if (!(uf & TDUF_WRITE_IF_ENOENT)) {
-			pop_cleanup(ehflag_normaltidy);
+			if (uf & TDUF_WRITE)
+				pop_cleanup(ehflag_normaltidy);
 			return TDUS_ERROR_NO_DEFERRED;
 		}
 	} else {
@@ -169,7 +167,8 @@ trigdef_update_start(enum trigdef_update_flags uf)
 			        fn.buf);
 
 		if (stab.st_size == 0 && !(uf & TDUF_WRITE_IF_EMPTY)) {
-			pop_cleanup(ehflag_normaltidy);
+			if (uf & TDUF_WRITE)
+				pop_cleanup(ehflag_normaltidy);
 			return TDUS_ERROR_EMPTY_DEFERRED;
 		}
 	}
@@ -245,5 +244,6 @@ trigdef_process_done(void)
 	triggersdir = NULL;
 
 	/* Unlock. */
-	pop_cleanup(ehflag_normaltidy);
+	if (lock_fd >= 0)
+		pop_cleanup(ehflag_normaltidy);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list