rpmlint
rpmlint copied to clipboard
rpmdiff: bug with RPMSENSE flags when diff-ing dependancies
(From http://rpmlint.zarb.org/cgi-bin/trac.cgi/ticket/570, Sandy Wu <sandywujy@…>)
Rpmdiff's req2str(self, req) function takes the REQUIREFLAG of an rpm.hdr and checks whether the corresponding dependancy is belongs to the PRE, POST, PREUN or POSTUN section:
if req & rpm.RPMSENSE_SCRIPT_PRE:
ss.append("pre")
elif req & rpm.RPMSENSE_SCRIPT_POST:
ss.append("post")
elif req & rpm.RPMSENSE_SCRIPT_PREUN:
ss.append("preun")
elif req & rpm.RPMSENSE_SCRIPT_POSTUN:
ss.append("postun")
However, the flags RPMSENSE_SCRIPT_[PRE|POST|PREUN|POSTUN) each have multiple bits set:
rpm.RPMSENSE_SCRIPT_PRE =0001001000000 rpm.RPMSENSE_SCRIPT_POST =0010001000000 rpm.RPMSENSE_SCRIPT_PREUN =0100001000000 rpm.RPMSENSE_SCRIPT_POSTUN=1000001000000 Notice that the 7th bit is always set for each of these flags. Therefore, the first case (PRE) will always executed whenever any one of these flags are specified.
Is this the intended behaviour or am I missing something?
I suspect that the desired behaviour wold be something like:
if req & rpm.RPMSENSE_SCRIPT_PRE == rpm.RPMSENSE_SCRIPT_PRE:
ss.append("pre")
elif req & rpm.RPMSENSE_SCRIPT_POST == rpm.RPMSENSE_SCRIPT_POST:
ss.append("post")
elif req & rpm.RPMSENSE_SCRIPT_PREUN == rpm.RPMSENSE_SCRIPT_PREUN:
ss.append("preun")
elif req & rpm.RPMSENSE_SCRIPT_POSTUN == rpm.RPMSENSE_SCRIPT_POSTUN:
ss.append("postun")
I tested this on the latest build I could find (rpmlint-1.4-11.fc19) from http://koji.fedoraproject.org/koji/packageinfo?packageID=3748. Is this the most recent version?
Running rpmdiff on the two attached .rpm's demonstrate this problem with /bin/sh
./rpmdiff nss-3.12.8-1.el5.centos.x86_64.rpm nss-3.13.6-3.el5_9.x86_64.rpm Which gives:
... removed PREREQ(pre) /bin/sh removed PREREQ(pre) /bin/sh removed PREREQ(pre) /bin/sh ... Instead of (what I suspect):
...
removed PREREQ(pre) /bin/sh
removed PREREQ(preun) /bin/sh
removed PREREQ(postun) /bin/sh
...
Changed 8 weeks ago by Sandy Wu <sandywujy@…>
It seems that I can't upload the .rpm's as they're too big. These two packages also demonstrate the fault:
http://vault.centos.org/5.5/os/x86_64/CentOS/nss-3.12.3.99.3-1.el5.centos.2.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/nss-3.13.5-8.el5.x86_64.rpm
./rpmdiff nss-3.12.3.99.3-1.el5.centos.2.x86_64.rpm nss-3.13.5-8.el5.x86_64.rpm
Original comment by: scop
What rpm version are you using, and where did you get the values you posted for rpm.RPMSENSE_SCRIPT_* constants? My rpm version is 4.9.1.3 and I have different values for them:
$ python -c "import rpm; print '%s %s %s %s' % (rpm.RPMSENSE_SCRIPT_PRE, rpm.RPMSENSE_SCRIPT_POST, rpm.RPMSENSE_SCRIPT_PREUN, rpm.RPMSENSE_SCRIPT_POSTUN)" 512 1024 2048 4096
...and for the test case, I get the expected result:
$ ./rpmdiff nss-3.12.3.99.3-1.el5.centos.2.x86_64.rpm nss-3.13.5-8.el5.x86_64.rpm | grep "removed.*PREREQ" removed PREREQ(pre) /bin/sh removed PREREQ(preun) /bin/sh removed PREREQ(postun) /bin/sh
Original comment by: scop
- Milestone: 1.5 --> 1.7
Original comment by: scop
- Milestone: 1.7 --> future
Original comment by: scop