The following commit has been merged in the master branch:
commit 2f19452e9698a9249619d109de5291190208d1cc
Author: Guillem Jover <guil...@debian.org>
Date:   Thu Jun 7 18:49:33 2012 +0200

    dpkg: Activate all path components for file triggers
    
    File triggers have been activated up to now explicitly whenever seen,
    and only the requested pathname. While unpacking or removing, this is
    not an issue as dpkg will traverse the hierarchy and trigger parent
    directories during the process.
    
    Because conffiles get a two staged installation, first unpacked into
    <conffile>.dpkg-new and then installed in place on configure, a trigger
    activated only after unpack will not see the <conffile> at its final
    location or see it at all if it correctly ignores those file extensions.
    
    This is an issue for conffiles or explicit dpkg-trigger file triggers,
    as an interest on parent paths will not activate the trigger as those
    parents are not traversed. With the subsequent cause of missed updates
    because code has not been run on the actual installation of conffiles.
    
    Closes: #675613, #676061, #676062, #676107, #676118, #676122

diff --git a/debian/changelog b/debian/changelog
index 3543537..dde6a45 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,9 @@ dpkg (1.16.4) UNRELEASED; urgency=low
   * Add support for liblzma to handle .xz and .lzma compressed files, and
     switch to it instead of using xz-utils. This removes the xz-utils
     Pre-Depends from dpkg. Thanks to Jonathan Nieder <jrnie...@gmail.com>.
+  * Always activate all path components for file triggers, this fixes file
+    trigger handling for conffiles and dpkg-trigger invokations.
+    Closes: #675613, #676061, #676062, #676107, #676118, #676122
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann).
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index 2b946f8..e4c9418 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -312,6 +312,7 @@ LIBDPKG_PRIVATE {
        trig_override_hooks;
        trig_file_activate_byname;
        trig_file_activate;
+       trig_path_activate;
        trig_note_pend;
        trig_note_aw;
        trig_clear_awaiters;
diff --git a/lib/dpkg/triglib.c b/lib/dpkg/triglib.c
index 9478fde..988a0a4 100644
--- a/lib/dpkg/triglib.c
+++ b/lib/dpkg/triglib.c
@@ -554,6 +554,40 @@ trig_file_activate(struct filenamenode *trig, struct 
pkginfo *aw)
 }
 
 static void
+trig_file_activate_parents(const char *trig, struct pkginfo *aw)
+{
+       char *path, *slash;
+
+       /* Traverse the whole pathname to activate all of its components. */
+       path = m_strdup(trig);
+
+       while ((slash = strrchr(path, '/'))) {
+               *slash = '\0';
+               trig_file_activate_byname(path, aw);
+       }
+
+       free(path);
+}
+
+void
+trig_path_activate(struct filenamenode *trig, struct pkginfo *aw)
+{
+       trig_file_activate(trig, aw);
+       trig_file_activate_parents(trigh.namenode_name(trig), aw);
+}
+
+static void
+trig_path_activate_byname(const char *trig, struct pkginfo *aw)
+{
+       struct filenamenode *fnn = trigh.namenode_find(trig, 1);
+
+       if (fnn)
+               trig_file_activate(fnn, aw);
+
+       trig_file_activate_parents(trig, aw);
+}
+
+static void
 trk_file_activate_start(void)
 {
 }
@@ -561,7 +595,7 @@ trk_file_activate_start(void)
 static void
 trk_file_activate_awaiter(struct pkginfo *aw)
 {
-       trig_file_activate_byname(trig_activating_name, aw);
+       trig_path_activate_byname(trig_activating_name, aw);
 }
 
 static void
diff --git a/lib/dpkg/triglib.h b/lib/dpkg/triglib.h
index 44ec0ed..bc129f4 100644
--- a/lib/dpkg/triglib.h
+++ b/lib/dpkg/triglib.h
@@ -86,6 +86,7 @@ void trig_override_hooks(const struct trig_hooks *hooks);
 
 void trig_file_activate_byname(const char *trig, struct pkginfo *aw);
 void trig_file_activate(struct filenamenode *trig, struct pkginfo *aw);
+void trig_path_activate(struct filenamenode *trig, struct pkginfo *aw);
 
 bool trig_note_pend_core(struct pkginfo *pend, const char *trig /*not 
copied!*/);
 bool trig_note_pend(struct pkginfo *pend, const char *trig /*not copied!*/);
diff --git a/src/configure.c b/src/configure.c
index ee3a8a3..d2c697c 100644
--- a/src/configure.c
+++ b/src/configure.c
@@ -193,7 +193,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
                varbuf_add_str(&cdr, DPKGDISTEXT);
                varbuf_end_str(&cdr);
                strcpy(cdr2rest, DPKGNEWEXT);
-               trig_file_activate(usenode, pkg);
+               trig_path_activate(usenode, pkg);
                if (rename(cdr2.buf, cdr.buf))
                        warning(_("%s: failed to rename '%.250s' to '%.250s': 
%s"),
                                pkg_name(pkg, pnaw_nonambig), cdr2.buf, cdr.buf,
@@ -228,7 +228,7 @@ deferred_configure_conffile(struct pkginfo *pkg, struct 
conffile *conff)
                       usenode->name);
        case cfo_newconff:
                strcpy(cdr2rest, DPKGNEWEXT);
-               trig_file_activate(usenode, pkg);
+               trig_path_activate(usenode, pkg);
                if (rename(cdr2.buf, cdr.buf))
                        ohshite(_("unable to install `%.250s' as `%.250s'"),
                                cdr2.buf, cdr.buf);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to