Bug 35827 - rpmtransAddPackage() seems to make bogus ordering assumption
Summary: rpmtransAddPackage() seems to make bogus ordering assumption
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: rpm   
(Show other bugs)
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact: David Lawrence
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-04-12 20:11 UTC by Greg Hudson
Modified: 2007-04-18 16:32 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-04-12 20:11:30 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

Description Greg Hudson 2001-04-12 20:11:27 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.17-14 i686)


rpmtransAddPackage() removes packages obsoleted by the package being
added.  In order to prevent duplicate removal, it calls
rpmdbPruneIterator() with the transaction's existing removed package list. 
The fourth argument to rpmdbPruneIterator() is 1, asserting that the
pruning list is sorted; however, there does not appear to be any guarantee
that the list is in fact sorted; removePackage() does not add dboffset in
sorted order, nor is there a sort of the list somewhere in
rpmtransAddPackage().

As a result, a package could be removed twice (which causes a silent error
return in
rpmRunTransactions()) due to failure to properly prune the set.

Reproducible: Didn't try
Steps to Reproduce:
I noticed this problem by reading the source code, not by actually
encountering it.  Reliably producing the problem would be somewhat
complicated because it is difficult to predict offsets of packages in the
database, and bsearch() might find something in an unsorted list if it is
lucky.

Comment 1 Jeff Johnson 2001-05-16 20:15:41 UTC
Yup, another good call, thanks. Fixed by moving the qsort from rpmdepCheck to
removePackage in rpm-4.0.3-0.22.


Note You need to log in before you can comment on or make changes to this bug.