I revealed two problems in RPM5 file triggers implementation:

1. _filetriggers_dir macro is expected to end with slash, otherwise rpmGlob
can't find any *.filter files. Unfortunately, Mandriva RPM setup defines this
macro without the ending slash as RPM4 doesn't have this limitation.

2. If there are no *.filter files in %_filetriggers_dir,
/var/lib/rpm/files-awaiting-filetriggers is never removed and keeps growing.

Both issues can be fixed by attached patches. Tested in Unity Linux.


David
--- rpm-5.2.DEVEL/lib/filetriggers.c.filetriggers_dir_must_end_with_slash	2009-07-22 05:43:33.000000000 -0400
+++ rpm-5.2.DEVEL/lib/filetriggers.c	2009-08-28 04:31:07.000000000 -0400
@@ -118,7 +118,7 @@
     if (dn == NULL)
 	goto exit;
 
-    globstr = rpmGetPath(rootDir, dn, "*" FILTER_EXTENSION, NULL);
+    globstr = rpmGetPath(rootDir, dn, "/*" FILTER_EXTENSION, NULL);
     xx = rpmGlob(globstr, &ac, &av);
     if (ac == 0)
 	goto exit;
--- rpm-5.2.DEVEL/lib/filetriggers.c.without_filters_files-awaiting-filetriggers_keeps_growing	2009-08-31 06:42:23.000000000 -0400
+++ rpm-5.2.DEVEL/lib/filetriggers.c	2009-08-31 10:24:08.000000000 -0400
@@ -316,6 +316,10 @@
     FILE * fp = NULL;
     int xx;
 
+    rpmlog(RPMLOG_DEBUG, _("[filetriggers] starting\n"));
+
+    fn = rpmGenPath(rootDir, files_awaiting_filetriggers, NULL);
+
     if (!filetriggers_dir())
 	goto exit;
 
@@ -323,9 +327,6 @@
     if (nft <= 0)
 	goto exit;
 
-    rpmlog(RPMLOG_DEBUG, _("[filetriggers] starting\n"));
-
-    fn = rpmGenPath(rootDir, files_awaiting_filetriggers, NULL);
     fd = Fopen(fn, "r.fpio");
     fp = fdGetFILE(fd);
 

Reply via email to