Description of problem: Dependency checks are done before %pre scripts are called. When a %pre script fails due to an "internal" check failure and exits with an error code, the RPM data base and/or operating information is not updated for the remainder of the *.rpm operation. This causes RPM's, for example foo, "Requires: %{ld_bar} = {ld_version}", to install even if foo did not. In simple: If A requires B and B's %pre fails, A still gets installed. Version-Release number of selected component (if applicable): All RPM Versions How reproducible: Steps to Reproduce: 1. Install package "a" which depends on package "b" with the following command `rpm -Uvh *.rpm (both the RPM's are in the pwd). 2. If "b" fails because it requires some libraries, still "a" gets isntalled. Actual results: Package "a" gets installed even if "b" fails. Expected results: If "b" fails, "a" should stop. It shouldn't get installed Additional info:
rpm is behaving as intended - rpm has performed a best effort install. To satisfy the requirements the packages need to be installed first, and thus are.
There is no use for package "a" if the package on which it is dependent fails to get installed i.e. package "b". For example: bash depends on package glibc. glibc is a meta-package which further depends on glibc-i386. Now in a directory where only packages bash and glibc are present, the command `rpm -Uvh *.rpm` should abort because the dependency isn't resolved. To comment your last line, the dependency needs to be installed first which as per my example is glibc-i386 and _not_ package bash. I'm sure this dependency handling mechanism should be well implemented in "yum" but rpm, unless given with the force option, should simply abort such installations. This is well implemented in dpkg and apt.
The package set is done as an entire transaction; they are not independent events that can be cancelled based on the failure of earlier packages.
Created attachment 122270 [details] Dummy Package a.rpm This is a Dummy Package a.rpm. This will try to clarify the bug
Created attachment 122271 [details] Dummy Package b.rpm Dummy Package b.rpm
Created attachment 122272 [details] Package a's spec file spec file
Created attachment 122273 [details] spec file Package b's spec file
Sorry for the confusing explanation in Comment #2. Here's the real problem. Package a depends on Package b. Package b fails to install because its %pre is not successful, hence Package b isn't installed and exits with a bad status. But still Package a gets installed. Now shouldn't the whole installation get aborted because hitting `rpm -Uvh *.rpm` would include both Packages' successes and failures into "one single transaction" ? I've attached two dummy rpm's (a and b) and the spec files for explanation. Try the steps mentioned in the Bug Comment to reproduce it.
Dependency checking and %pre running are different. The running of %pre is way too late to prevent installation of an entire set of packages chained through dependencies. Simply doesn't "work", and the change to rpm is highly unlikely. Either add dependencies that achieve the same goal as whatever you are doing in %pre (that's probably the best solution), or run your %pre script before executing rpm. Alternatively, it's now possible in rpm-4.4.3 and later to run a script during dependency checking.