Red Hat Bugzilla – Bug 1105898
Differenet behaviour with yum RPMs install between 5.9 and 6.5
Last modified: 2014-06-11 03:36:08 EDT
Description of problem: In RHEL 6.5 when using yum to install RPM, which in it's post section exits with 1 - yum itself returns 0. In RHEL 5.9 in such case yum returned 1. Version-Release number of selected component (if applicable): For 5.9 use case it worked as expected with yum 3.2.22 For 6.5 use case it does work same way with yum 3.2.29 How reproducible: Steps to Reproduce: 1. Prepare simple RPM and call it TestRPM, which would have such in it's RPM spec post section: #------------------------------------------------------------------------------------------------------------- #The post macro is for running anything after the install #------------------------------------------------------------------------------------------------------------- %post echo "Exiting with 1" exit 1 2. Prepare bash testyum.sh script with such in it: yum -y install /home/scdevops/TestRPM.x86_64.rpm RC=$? echo "result code: $RC" 3. Run testyum.sh on both RHEL 5.9 and 6.4 4. Observe that on 5.9 output will have such part: ... Exiting with 1 warning: %post(TestRPM-1.0-20140529.x86_64) scriptlet failed, exit status 1 Verifying : TestRPM-1.0-20140529.x86_64 1/1 Installed: TestRPM.x86_64 0:1.0-20140529 Complete! result code: 1 i.e. result code here as expected 1 5. Observe that on 6.5 output will have such part: ... Exiting with 1 warning: %post(TestRPM-1.0-20140529.x86_64) scriptlet failed, exit status 1 Verifying : TestRPM-1.0-20140529.x86_64 1/1 Installed: TestRPM.x86_64 0:1.0-20140529 Complete! result code: 0 i.e. result code here unexpected to be 0 Actual results: Expected results: Expected to behave the same way on both RHEL 5.9 and RHEL 6.5 Additional info:
This change is in rpm, not yum so switching component.
This is an intentional change in rpm >= 4.6.x, but one that hasn't perhaps been adequately communicated in RHEL 6 context. For that reason, a compatibility mode has been introduced in this RHEL-6 errata to give users more time to adapt to the new behavior: https://rhn.redhat.com/errata/RHBA-2013-1665.html Note that use of this compat mode is actually not recommended, and that this option is RHEL-6 only, RHEL-7 will not have it as it is only provided as a temporary migration aid.
Hi Panu, I need additional explanation of that introduced compatibility mode. Errata says: With this update, Red Hat Enterprise Linux 5 backwards-compatibility option, "%_strict_script_errors macro", has been added. The default behavior of Red Hat Enterprise Linux 6 does not change with this update and users that do not demand this option specifically are not advised to use it. Does it mean that usage/addition of "%_strict_script_errors macro" into RPM spec will make it behave in a way it was on RHEL 5.9? I.e. exit code 1 will be properly propagated through yum and into shell? If not adding this macro - what is alternative to indicate from inside RPM spec that some step has failed and exit with return code of 1? Not that clear from such documentation
%_strict_script_errors is a runtime configuration option that needs to be enabled on the systems where the former scriptlet error behavior is wanted, it does not affect builds in any way.
Could you specify how exactly (in which file) that runtime configuration option needs to be added/enabled?
Could anyone respond with more information here in regards to my comment #6?
Its a macro, set to non-zero to enable in a macro configuration file. Or better yet, dont - as the notes say its use is discouraged unless you really know what you're doing. Further enquiries to the appropriate RHEL support forums please, this is a bug tracker only.