[Rpm-maint] FSM hooks for rpm plugin

Panu Matilainen pmatilai at laiskiainen.org
Wed Mar 6 14:52:56 UTC 2013

On 03/06/2013 03:59 PM, Panu Matilainen wrote:

> What's missing is that another call to the hook is needed in fsmMkdirs()
> for the unowned directories, and there we should perhaps pass in the
> "unowned" aspect somehow. Having a separate argument for that seems like
> an overkill though... maybe we could pass that piece of info in the
> action argument instead. One possibility could be adding a new action,
> eg FA_CREATEUNOWNED that could be used for unowned directories (and
> files, but there aren't any currently). Or we could define the action as
> a partial bitfield: leave the existing actions alone but reserve the
> "upper" byte for special bits, such as "unknown". I had some other
> use-case for turning it into (partial) bitfield but can't remember what
> it was right now.

Another issue I just realized is that with this patch, the metadata hook 
call is not under the setmeta condition so it will get called always, ie 
in cases like hardlinks when it specifically should *not* be called :)

I think the fsm-part should be something like this instead:

@@ -1569,6 +1569,11 @@ static int fsmCommit(FSM_t fsm, int ix, int setmeta)

      if (setmeta) {
+       /* Run fsm metadata hook for all plugins */
+       if (!rc) {
+           rc = rpmpluginsCallFsmFileMetadata(fsm->plugins,
+                                               fsm->path, st, fsm->action);
+       }
          /* Set file security context (if enabled) */
          if (!rc && !getuid()) {
              rc = fsmSetSELabel(fsm->sehandle, fsm->path, fsm->sb.st_mode);

	- Panu -

More information about the Rpm-maint mailing list