rpm queryformat %{fileverifyflags}
Panu Matilainen
pmatilai at laiskiainen.org
Thu Oct 22 06:26:22 UTC 2009
On Tue, 20 Oct 2009, Greg_Swift at aotx.uscourts.gov wrote:
>
> I just had a script brought to my attention that utilizes output containing
> the %{fileverifyflags} output. I have read a few results from google that
> mention this flag, but non seem to explain what a "-1" result means. On my
> system I have 1385 packages that return -1, and around 30 that return
> various other numbers (mostly -40). The results of running rpm -qV on
> those packages that return -1 can vary.
>
> http://www.rpm.org/max-rpm/ch-queryformat-tags.html
> http://rpm5.org/docs/api/queryformat.html
>
>
> I am having a hard time deciphering the purpose of this test, and the
> context clues in our code are not very helpful.
FILEVERIFYFLAGS tells rpm which properties of a file should be verified by
"rpm -V <pkg>". Like several other similar query tags, FILEVERIFYFLAGS is
a bitfield of flags which without further formatting is not of much use to
humans.
For FILEVERIFYFLAGS there are no human-readable formatting extensions
available, to make sense out of it, you'll need to look at the bits
defined by rpmVerifyAttrs enumeration, you can find the values from eg
http://rpm.org/api/4.7.0/rpmvf_8h.html.
Hex formatting, ie --qf "[%{fileverifyflags:hex}\n], makes it easier to
see which bits are on than the decimal output. Typically all the bits are
enabled, but sometimes it doesn't make sense to verify everything, such as
in case of %ghost files.
Now to your actual question... the script you've come across seems pretty
broken:
a) FILEVERIFYFLAGS is an array of per-file values, the value it returns
without the [] array query formatter is meaningless (well it's the
flags of the first file in the package)
b) comparing against hardcoded decimal values like -1 or -40 only
"works" on 32bit systems, and even that only on older rpm versions
where signed integers are used
c) I dont quite see what use it is for a script to try to interpret
the value of FILEVERIFYFLAGS, it's only really useful to rpm itself
in verify mode
But ok, on 32bit system, with rpm < 4.6.0 (which use signed integers
here), value -1 means "verify all aspects of this file" (again you need to
look at the entire array for it to mean anything), and -40 is "everything
but file checksum, file size, symlink contents and mtime", which happens
to be what %ghost files get by default.
- Panu -
More information about the Rpm-list
mailing list