[Rpm-maint] Plugin ponderings

Panu Matilainen pmatilai at laiskiainen.org
Thu Nov 29 13:53:47 UTC 2012


On 11/29/2012 03:00 PM, Reshetova, Elena wrote:
> Thank you for all clarifications! Now I am attaching the corrected patch and
> the most important is that I understood the indentation finally (took a
> while through :()!

Much better late than never, the indentation is now exactly as it should 
be, good! There's just one extra leftover indent level for the execv() call.

> Hopefully this is the last iteration for the script cases :)

I'm afraid we'll need one more round: you perhaps took my "that's what 
RPMSCRIPTLET_EXEC bit is for" (wrt embedded scripts) a bit too literally :)

What I meant is that the RPMSCRIPTLET_EXEC bit defines whether something 
is embedded or external - external scripts always have it, embedded ones 
never have it as there is nothing to exec. The patch gets it a bit 
backwards in rpmScriptRun():

    if (rstreq(args[0], "<lua>"))
         script_type = RPMSCRIPTLET_EXEC;
                       ^^^^^^^^^^^^^^^^^^

That should be 0 currently as we're not forking nor execing anything for 
<lua> scriptlets, and EXEC it can *never* have. Then the rest becomes 
simply something like:

     if (rc != RPMRC_FAIL) {
         if (script_type & RPMSCRIPTLET_EXEC) {
             rc = runExtScript(plugins, selinux, prefixes, 
script->descr, lvl, scriptFd, &args, script->body, arg1, arg2);
         } else {
             rc = runLuaScript(selinux, prefixes, script->descr, lvl, 
scriptFd, &args, script->body, arg1, arg2);
         }
     }

While not strictly necessary, I think rpmLuaScript() could be changed to 
take the additional 'plugins' argument while we're at it, if only to 
keep symmetry between the two functions. It'll be needed later on 
anyway, unlike the selinux argument which gets passed to runLuaScript() 
just for the symmetry's sake.

	- Panu -


More information about the Rpm-maint mailing list