script exit codes

Heyman, Jerrold Jerrold.Heyman at emc.com
Wed Mar 16 16:37:14 UTC 2016


I have been investigating the use of script error codes in order to prevent the -erase option from being executed.
When I previously asked on this list about using %preun to stop the erasure, I was told that that was bad practice.

In walking through the latest code, rpm-4.13.0-rc1, I found something that was confusing.

In lib/rpmscript.c, function rpmScriptRun() (which starts on line 434) -

    /* Run scriptlet pre hook for all plugins */
    rc = rpmpluginsCallScriptletPre(plugins, script->descr, script_type);

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

    /* Run scriptlet post hook for all plugins */
    rpmpluginsCallScriptletPost(plugins, script->descr, script_type, rc);

The question is - if the rc is equal to RPMRC_FAIL after the call to rpmpluginsCallScriptletPre(), why would you then execute the rpmpluginsCallScriptletPost() function?

Jerry Heyman                           |
Principal Software Engineer            |    Software is the difference
EMC Data Domain                        |    between hardware and reality
Jerrold.Heyman at emc.com / 919.597.7812  |

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20160316/e7e7fe95/attachment.html>


More information about the Rpm-list mailing list