-----Original Message----- > Denniston, Todd A CIV NAVSURFWARCENDIV Crane wrote: > Sent: Tuesday, 15 November, 2011 12:57 > To: CentOS at centos.org > Subject: [CentOS] How can rpm "%{SUMMARY}" not be consistent? > > I have been seeing something for quite some time which has confused me > considerably for over a year, perhaps one of you can help me understand. > > Assumed: rpm queries are against _a_ database. > Assumed: database queries against the same database, without changes to > the data in the database, will return the same data. > > Confusion: then why are some of the summaries reported by rpm different? > > Each day I (cron.daily) run the following command > rpm -qa \ > --qf > '"%{VENDOR}","%{NAME}","%{VERSION}","%{VERSION}-%{RELEASE}","%{ARCH}","%{SUMMARY}"\n' \ > | sort -t\" -k3 > ${OUTFILE} > > Stuff the resulting ${OUTFILE} in an rcs file. > > And some days the rcs file will show deltas such as the following (which > was pulled from a rather recent set of flipflops): > > --- mach.csv 2011/11/15 10:50:04 > +++ mach.csv 2011/11/15 09:22:53 > > -"CentOS","bash","3.2","3.2-32.el5","i386","The GNU Bourne Again shell > (bash) version 3.1." > +"CentOS","bash","3.2","3.2-32.el5","i386","The GNU Bourne Again shell > (bash) version 3.2" <snip> Using the double quote (") as a delimiter, the third key would be a comma (,) (see below for an example) "A","B","C","D","E",... 1"2"3"4"5"6"7"8"9"A"B... And since your sort command is sorting only on the fifth key, all the commas are already in order (unless there is a blank line in there somewhere). The order of the re cords within a sorted group may or may not be guaranteed to change. Change your sort order from '-k3' to '-k2 -k4 -k6 -k8 -k10 -k12' to sort by Vendor, Name, Version, Version-Release, Arch, Summary and see if that helps. Cheers! Simba Engineering