Bug 1105898

Summary: Differenet behaviour with yum RPMs install between 5.9 and 6.5
Product: Red Hat Enterprise Linux 6 Reporter: Andrejus Chaliapinas <andrejusc>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 6.5CC: james.antill, jzeleny, packaging-team-maint, pmatilai
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-09 07:49:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andrejus Chaliapinas 2014-06-08 21:02:10 UTC
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:

Comment 2 Panu Matilainen 2014-06-09 07:41:13 UTC
This change is in rpm, not yum so switching component.

Comment 3 Panu Matilainen 2014-06-09 07:49:15 UTC
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.

Comment 4 Andrejus Chaliapinas 2014-06-09 11:59:46 UTC
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

Comment 5 Panu Matilainen 2014-06-09 12:08:54 UTC
%_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.

Comment 6 Andrejus Chaliapinas 2014-06-09 12:58:13 UTC
Could you specify how exactly (in which file) that runtime configuration option needs to be added/enabled?

Comment 7 Andrejus Chaliapinas 2014-06-10 19:17:36 UTC
Could anyone respond with more information here in regards to my comment #6?

Comment 8 Panu Matilainen 2014-06-11 06:49:28 UTC
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.