[Rpm-maint] FSM hooks for rpm plugin
pmatilai at laiskiainen.org
Wed Mar 27 14:06:10 UTC 2013
On 03/27/2013 02:34 PM, Reshetova, Elena wrote:
>> After far too much pondering... I went ahead and added the prepare hook
>> + some related bits and pieces. And actually ripped out SELinux support
>>from rpm core while at it, replaced by a simple SELinux plugin. Wohoo.
> Looks cool :) Hope it works ;)
The basics seem to be working fine :)
The plugin configuration mechanism probably wants a bit more thinking +
work though: for some things you'd want to be able to enable a plugin by
merely installing the relevant (sub)package. For example I would want
the SELinux plugin to get enabled whenever its present, without having
to hunt where __transaction_plugins is defined and override it,
which is annoying and error-prone.
In other words, I think there should be a drop-in directory for the
plugin configuration where the plugin sub-packages can drop their
default configuration as separate files, including whether they should
be enabled by default or not. There was something else in this direction
too ... but I can't remember it right now.
>> I think I'll leave the commit-hooks to you though :)
> Ok, I think I will be able to send you a version for review today, but I have
> got one question. I was under impression that we at some point agreed to pass
> to hooks the whole stat structure as opposite for just mode_t. This would
> allow plugins to make checks on things like st_nlink and other useful info
> about the file. Do I remember this wrongly?
No, you are right, but I chickened out :) See
The trouble starts with the special case of fsmMkdirs(): there's a
struct stat handy, but the directories only get created if the stat()
fails, in which case the struct stat contents are undefined. Sure, it'd
be possible to hack up a struct stat that resembles a directory for that
case, but that rang a "proceed with caution" alarm bell in my head. If,
or rather when, we need to fake up stuff the semantics get fuzzy real
quick. For example the st_nlink thing: the adjusted count is currently
actually only available in fsmCommit() so different hooks would see
different values for the same file. Etc.
I still actually think we'll eventually want to pass the whole stat
struct (or roughly equivalent amount of data in some other means) to
plugins, being able to sanely do so requires further hacking of the FSM.
- Panu -
More information about the Rpm-maint