[Rpm-maint] [rpm-software-management/rpm] [WIP] Added fapolicyd plugin (#1475)

Panu Matilainen notifications at github.com
Mon Jan 18 07:58:50 UTC 2021


@pmatilai commented on this pull request.



> +
+static rpmRC fapolicyd_tsm_post(rpmPlugin plugin, rpmts ts, int res)
+{
+    if (fapolicyd_state.ready)
+        write_fifo(&fapolicyd_state, "1", 2);
+
+    return RPMRC_OK;
+}
+
+static rpmRC fapolicyd_scriptlet_pre(rpmPlugin plugin, const char *s_name,
+				    int type)
+{
+    if (fapolicyd_state.ready && fapolicyd_state.first_scriptlet) {
+        // send signal to flush cache
+        write_fifo(&fapolicyd_state, "2", 2);
+        fapolicyd_state.first_scriptlet = 0;

Hum, I sense a misunderstanding here. There can be no such global hook, as rpm interleaves file operations and scriptlets. Even on per-package basis there can first be various pre-scriptlets, then the files get laid down, and then there can be more scriptlets running. And note that for the pre-scriptlet stuff you do *not* want cache flushes as no files have been changed yet, so tracking the "first scriptlet" is not what you want to do at all.

AIUI, what you really need to be doing is set a global "files changed" flag on every entry to fsm_file_prepare, and then from scriptlet_pre flush the cache *and* reset the changed variable for the next package. With that it'll track the real situation and eg packages without files will not cause unnecessary cache flushes.

Of course it's also possible I'm misunderstanding something here...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1475#discussion_r559373699
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20210117/12d7d1ca/attachment.html>


More information about the Rpm-maint mailing list