RPM

rpm exits 0 on scriptles failure

Bug #675954 reported by devzero2000
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
RPM
New
Undecided
Unassigned
Fedora
Won't Fix
High

Bug Description

https://bugzilla.redhat.com/show_bug.cgi?id=569930

Paolo Penzo 2010-03-02 12:46:55 EST

As far I've seen, see bugs 533831 and 465409, starting with version 4.6 rpm
exits 0 even if the scriptlets (all but %pre and %preun) exit with error.
IMHO this breaks legacy rpm behaviour (i.e. pre version 4.6) and leads to
misunderstandings since a simple test on the rpm exit code is not reliable
anymore. In other words the rpm exit status tells that the software itself has
been replaced (updated) by a newer version but you know nothing about all the
others steps involed with a change management process (rebuilding of library
cache, configuration migration, service restart an so on).

Is there a way tho revert to the old behaviour or to have them toghether?

How reproducible:
Always, just place exit 1 in you rpm %post scriptlet.

Tags: scriptlet
Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

As far I've seen, see bugs 533831 and 465409, starting with version 4.6 rpm exits 0 even if the scriptlets (all but %pre and %preun) exit with error.
IMHO this breaks legacy rpm behaviour (i.e. pre version 4.6) and leads to misunderstandings since a simple test on the rpm exit code is not reliable anymore. In other words the rpm exit status tells that the software itself has been replaced (updated) by a newer version but you know nothing about all the others steps involed with a change management process (rebuilding of library cache, configuration migration, service restart an so on).

Is there a way tho revert to the old behaviour or to have them toghether?

How reproducible:
Always, just place exit 1 in you rpm %post scriptlet.

Revision history for this message
In , Panu (panu-redhat-bugs) wrote :

The problem is that a simple integer value is nowhere near sufficient for encoding the status of an operation potentially involving thousands of packages. The new exit code simply reflects (like you point out) what rpm knows for sure: whether the software on disk was installed/updated/removed or not.

One possibility could be treating the exit code as a bitfield: one bit for "one or more scriptlets failed" and another for "one or more package failed to install/remove", so you would have at least a hint if everything went smoothly or not, but the warning bit still tells you preciously little about what/where the actual problem was.

Rpm could also add status field to headers upon package install/upgrade, eg "one or more scriptlets failed when installing this package" but that wont help with erasure failures as there's no place to persistently record the failure.

Oh and rpm does issue callbacks on all scriptlet failures so librpm API users can track what happens during the transaction (eg yum collects this information and logs them as warnings/errors).

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

I agree with you, from the point of view of the rpm API a simple integer value might not be sufficient for encoding the status a massive rpm operation.
However, for a batch script, a simple warning message is not sufficient to tell that your software upgrade went wrong due to a failure in the %post scriptlet
leaving you mission critical application stopped due to simple typo in a configuration file...
So I think rpm (yum behaves the same way) should treat errors in %post script as before or, at least, it should be possible to choose the old or the new approach with a macro or via a command line switch.

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Created attachment 402709
rpm-4.6.0 and rpm 4.6.1 patch

A patch to revert to the old behaviour and consider non-pre scriptlet errors as warnings only if the new macro _ignore_post_scripts_errors is set.

This is the rpm 4.6.x patch

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Created attachment 402711
rpm-4.7.1 patch

A patch to revert to the old behaviour and consider non-pre scriptlet errors as warnings only if the new macro _ignore_post_scripts_errors is set.

This is the rpm 4.7.1 patch

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Created attachment 402712
rpm-4.7.2 patch

A patch to revert to the old behaviour and consider non-pre scriptlet errors as warnings only if the new macro _ignore_post_scripts_errors is set.

Revision history for this message
In , Bug (bug-redhat-bugs) wrote :

This message is a reminder that Fedora 11 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 11. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora
'version' of '11'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version prior to Fedora 11's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we may not be able to fix it before Fedora 11 is end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora please change the 'version' of this
bug to the applicable version. If you are unable to change the version,
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Changed release version due to FC11 EOL

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Fedora 13 (rpm-4.8.0) shows the same behaviour. To revert to the old one, the patch in comment #5 can be applied.

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Created attachment 460569
A patch for rpm 4.8.1

This issue is still around in Release 14.

Revision history for this message
In , devzero2000 (devzero2000-redhat-bugs) wrote :

Ciao Paolo.

I have also tracked this here https://bugs.launchpad.net/rpm/+bug/675954

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

Created attachment 523397
rpm-4.9.1 patch

A patch for rpm 4.9.1.1 (FC15)

Revision history for this message
In , Krzysztof (krzysztof-redhat-bugs) wrote :

Are there any plans to get this fixed?

Revision history for this message
In , Krzysztof (krzysztof-redhat-bugs) wrote :

This issue is very important for Eclipse package (www.eclipse.org). Eclipse is shipped with a plugin management system/update system which needs to be launched when additional Eclipse plugins are installed via RPM.

Revision history for this message
In , Paolo (paolo-redhat-bugs) wrote :

IMHO it's important in every unattended installation process.
Could you solve with the patches I've provided?

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Revision history for this message
In , devzero2000 (devzero2000-redhat-bugs) wrote :

(In reply to comment #15)
> IMHO it's important in every unattended installation process.
> Could you solve with the patches I've provided?

HeHe, Paolo, this is an endless saga, no doubt. I forgot to post here a link to the same issue discussed some time ago on another mailing list http://rpm5.org/community/rpm-users/0834.html. Cheers

Changed in fedora:
importance: Unknown → High
status: Unknown → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.