[Rpm-maint] [PATCH 5/5] Add a generic plugin for use by simple Collections

Panu Matilainen pmatilai at laiskiainen.org
Wed Jun 23 11:40:04 UTC 2010


On Fri, 18 Jun 2010, Panu Matilainen wrote:
>
>> +rpmRC COLLHOOK_POST_ANY_FUNC(rpmts ts, const char * collname, const char * 
>> options)
>> +{
>> +	int rc = RPMRC_FAIL;
>> +
>> +	if (rpmChrootSet(rpmtsRootDir(ts)) || rpmChrootIn()) {
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [snip]
>> +	if (rpmChrootOut() || rpmChrootSet(NULL)) {
>                           ^^^^^^^^^^^^^^^^^^^^^
>
> These look highly suspect, rpmChrootSet() is done already from rpmtsSetup() 
> and rpmtsFinish(), everything between those shouldn't need anything more than 
> just rpmChrootIn() and rpmChrootOut(). Calling rpmChrootSet(NULL) makes it 
> forget the cwd so further rpmChrootIn/Out calls will fail.

Eek... I just realized why you were needing the rpmChrootSet():

exec_la_SOURCES = collection.h ../lib/rpmchroot.c exec.c

So the plugin is using a private copy of rpmchroot and thus doesn't share 
the librpm internal state. Obviously enough this is because rpmChrootFoo() 
are RPM_GNUC_INTERNAL and so aren't usable for the plugin otherwise...

The chroot interface would logically belong to librpmio but as nothing was 
needing it outside of librpm, I thought to keep it private at least until 
the API has seen enough shakedown to be considered stable.

For now, I'll just drop the RPM_GNUC_INTERNAL from rpmChrootIn() and 
rpmChrootOut() so the plugins are able to use the librpm code instead of 
carrying their private chroot state. Do you think you'll need 
rpmChrootDone() too in the SELinux plugin?

 	- Panu -


More information about the Rpm-maint mailing list