diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-10-03 12:04:19 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-10-03 12:04:19 +0300 |
commit | 9cfb380cc4529ea6b9314cc67819069c8e9c1a23 (patch) | |
tree | 363d1414086d3278e88aaf323536ea3f06955094 /lib/psm.c | |
parent | 6f3f5a36a3938fd13b44246f8484c35ba1cc5ac3 (diff) | |
download | rpm-9cfb380cc4529ea6b9314cc67819069c8e9c1a23.tar.gz rpm-9cfb380cc4529ea6b9314cc67819069c8e9c1a23.tar.bz2 rpm-9cfb380cc4529ea6b9314cc67819069c8e9c1a23.zip |
Filter out error exit codes from non-pre scriptlets (rhbz#216221, #rhbz465409)
- typos and thinkos in scriptlets often cause duplicates to be left around
for no good reason
- treat non-zero exit codes from scriptlets as just warnings instead of
errors
- ... except that %pre and %preun are sometimes used for preventing
install/uninstall of a package, preserve the traditional behavior for them
- abuse rpmtsNotify() "total" value for signaling warning/error to callback
Diffstat (limited to 'lib/psm.c')
-rw-r--r-- | lib/psm.c | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -703,6 +703,7 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, ARGV_t * argvp, FD_t scriptFd; FD_t out = NULL; rpmRC rc = RPMRC_FAIL; /* assume failure */ + int warn_only = 0; char *nevra, *sname = NULL; struct rpmtd_s prefixes; @@ -832,7 +833,12 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, ARGV_t * argvp, rpmlog(RPMLOG_ERR, _("%s scriptlet failed, signal %d\n"), sname, WTERMSIG(psm->sq.status)); } else { - rpmlog(RPMLOG_ERR, _("%s scriptlet failed, exit status %d\n"), + /* filter out "regular" error exits from non-pre scriptlets */ + if ((stag != RPMTAG_PREIN && stag != RPMTAG_PREUN)) { + warn_only = 1; + } + rpmlog(warn_only ? RPMLOG_WARNING : RPMLOG_ERR, + _("%s scriptlet failed, exit status %d\n"), sname, WEXITSTATUS(psm->sq.status)); } } else { @@ -843,7 +849,11 @@ static rpmRC runScript(rpmpsm psm, Header h, rpmTag stag, ARGV_t * argvp, exit: rpmtdFreeData(&prefixes); + /* notify callback for all errors, "total" abused for warning/error */ if (rc != RPMRC_OK) { + if (warn_only) { + rc = RPMRC_OK; + } (void) rpmtsNotify(ts, psm->te, RPMCALLBACK_SCRIPT_ERROR, stag, rc); } |