Hi, I recently stumbled on a bug in Cfengine 2 which prevents cfengine from properly doing an RPM version comparison on packages with alpha and numeric versions. This affects all versions of Cfengine 2 so far as I can tell (including 2.2.10, which is what we are running).
Cfengine is using some RPM functions from version 4.1 of RPM (a very old version), which contain a bug in the rpmvercmp function. The bug has been fixed in RPM, but not in Cfengine. Here is a link to the Red Hat bug: https://bugzilla.redhat.com/show_bug.cgi?id=50977 The Cfengine file that is affected is package.c, and the function is rpmvercmp. I've attached the patch (rpmvercmp.patch) and a sample cfengine.cf file (sample.cf.txt) which will trigger the problem. Here is a sample of the bug: Requesting kernel gt 2.6.18-194.el5 RPMCheckPackage(): Trying installed version 0:2.6.18-164.11.1.el5 Comparison result: lt RPMCheckPackage(): Trying installed version 0:2.6.18-194.el5 Comparison result: eq RPMCheckPackage(): Trying installed version 0:2.6.18-194.3.1.el5 Comparison result: lt Notice that Cfengine thinks that version 2.6.18-194.3.1.el5 is less than version 2.6.18-194.el5 (which is not actually true). Here is a sample of cfengine after I patched it, with the bug fixed: Requesting kernel gt 2.6.18-194.el5 RPMCheckPackage(): Trying installed version 0:2.6.18-164.11.1.el5 Comparison result: lt RPMCheckPackage(): Trying installed version 0:2.6.18-194.el5 Comparison result: eq RPMCheckPackage(): Trying installed version 0:2.6.18-194.3.1.el5 Comparison result: gt Notice that 2.6.18-194.3.1.el5 was properly identified as being greater than version 2.6.18-194.el5 Is it possible to get this patch included in a new cfengine-2 release? -John
rpmvercmp.patch
Description: Binary data
control: actionsequence = ( directories.hppsp shellcommands.hppsp ) kernVersion = ( ExecResult(/bin/uname -r) ) rhel4PSP = ( 8.30 ) packages: kernel version=$(kernVersion) cmp=gt define=needReboot directories: redhat_as_4.hppsp.!needReboot:: /tmp/psp/$(rhel4PSP) define=install_hpacucli shellcommands: !needReboot.hppsp:: "/bin/touch /tmp/noReboot-$(kernVersion)" needReboot.hppsp:: "/bin/touch /tmp/needReboot-$(kernVersion)"
-- John Friar CUIT Unix Systems Columbia University
_______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine