[Rpm-maint] [PATCH 1/4] Add file signature to fsm_file_post parameter list

Panu Matilainen pmatilai at laiskiainen.org
Fri Oct 31 07:38:51 UTC 2014


On 10/07/2014 11:19 PM, fin at linux.vnet.ibm.com wrote:
> From: Fionnuala Gunter <fin at linux.vnet.ibm.com>
>
> The ima plugin instantiates fsm_file_post hook, but needs access to the
> file's signature, so this patch adds a file signature parameter to the
> fsm_file_post parameter list.
>
> Signed-off-by: Fionnuala Gunter <fin at linux.vnet.ibm.com>
> ---
[...]
> diff --git a/lib/rpmplugins.h b/lib/rpmplugins.h
> index ecfa68b..93ab7b9 100644
> --- a/lib/rpmplugins.h
> +++ b/lib/rpmplugins.h
> @@ -144,12 +144,14 @@ rpmRC rpmpluginsCallFsmFilePre(rpmPlugins plugins, rpmfi fi, const char* path,
>    * @param path		file object path
>    * @param file_mode	file object mode
>    * @param op		file operation + associated flags
> + * @param sig		file signature
>    * @param res		fsm result code
>    * @return		RPMRC_OK on success, RPMRC_FAIL otherwise
>    */
>   RPM_GNUC_INTERNAL
>   rpmRC rpmpluginsCallFsmFilePost(rpmPlugins plugins, rpmfi fi, const char* path,
> -                                mode_t file_mode, rpmFsmOp op, int res);
> +                                mode_t file_mode, rpmFsmOp op, const char *sig,
> +                                int res);

By this logic, the plugin hooks would have >= 30 parameters to pass in 
everything that might be related to a file in some situation, and it 
also breaks the plugin API for no good reason.

Add the necessary interfaces to rpmfiles and rpmfi instead. Having to 
add new stuff to rpmfiles/rpmfi for every plugin introducing some new 
functionality is not optimal, but it is a lesser evil compared to 
breaking interfaces.

OTOH what is missing from the plugin infra is a hook in 
rpmtsAddInstallElement() / rpmtsAddEraseElement() where the entire 
header is available and plugins can grab whatever they need from there 
and handle the rest internally without having to add new API.

	- Panu -




More information about the Rpm-maint mailing list