Hide Forgot
Hi, On CentOS 6, when we try to install any rpm it fails with scriplet failed with exit status 1 but return status of rpm is also 1 which is correct. Example: But On CentOS 7, we are not getting return status of rpm as 1 it is coming 0, which is installing the RPM. rpm -Uvh /home/seldridg/rpmbuild/RPMS/noarch/test-1.0-1.el6.noarch.rpm; echo $? Preparing... ########################################### [100%] 1:test ########################################### [100%] Test Script called failure seen while executing test-script error: %post(test-1.0-1.el6.noarch) scriptlet failed, exit status 1 1 <-- verified this works as expected I checked the source code of rpm package for CentOS6/7 and found that one patch is applicable in CentOS6 rpm package and because of this any failure is coming during scriplet failure it treats warning as an error and giving rpm status as a 1 and not installing that RPM in your system. rpm -Uvh /home/seldridg/rpmbuild/RPMS/noarch/test-1.0-1.el7.noarch.rpm; echo $? Preparing... ########################################### [100%] 1:test ########################################### [100%] Test Script called failure seen while executing test-script error: %post(test-1.0-1.el7.noarch) scriptlet failed, exit status 1 0 <-- verified this works as expected Below is the patch: +++ b/rpm-4.8.x-strict-script-errors.patch @@ -0,0 +1,25 @@ +diff -up rpm-4.8.0/lib/psm.c.strict-script rpm-4.8.0/lib/psm.c +--- rpm-4.8.0/lib/psm.c.strict-script 2013-08-05 11:09:40.290136043 +0300 ++++ rpm-4.8.0/lib/psm.c 2013-08-05 11:12:18.465137945 +0300 +@@ -517,7 +517,9 @@ static rpmRC runLuaScript(rpmpsm psm, He + if (rc != RPMRC_OK) { + if ((stag != RPMTAG_PREIN && stag != RPMTAG_PREUN && + stag != RPMTAG_VERIFYSCRIPT && stag != RPMTAG_PRETRANS)) { +- warn_only = 1; ++ if (!rpmExpandNumeric("%{?_strict_script_errors}")) { ++ warn_only = 1; ++ } + } + } + umask(oldmask); +@@ -774,7 +776,9 @@ static rpmRC runScript(rpmpsm psm, Heade + } else { + /* filter out "regular" error exits from non-pre scriptlets */ + if ((stag != RPMTAG_PREIN && stag != RPMTAG_PREUN && stag != RPMTAG_VERIFYSCRIPT && stag != RPMTAG_PRETRANS)) { +- warn_only = 1; ++ if (!rpmExpandNumeric("%{?_strict_script_errors}")) { ++ warn_only = 1; ++ } + } + rpmlog(warn_only ? RPMLOG_WARNING : RPMLOG_ERR, + _("%s scriptlet failed, exit status %d\n"), I tried to modify the code according to this but not getting success. Please help me on this. I want the same behavior of CentOS 6 on CentOS 7.
Any update on this issue? Regards, Shagun
The %_strict_script_mode was only added to rhel-6 as a temporary aid to give people time to transition from the rhel-5 era rpm behavior, and was never intended to be carried into later releases. There are no plans to bring it into rhel-7.