RPMTAG_ARCHSUFFIX from commit e6a6399cb4
assumes all headers have RPMTAG_ARCH, but a notable exception is gpg-pubkey
headers in rpmdb, causing segfaults on `rpm -qa` on normal systems.
Special case conditionals in queryformats get ugly and error-prone real
fast, which is why we have all the NEVRA formatter extensions. Avoid
adding yet more of those tags by handling the dot formatting in
ARCHSUFFIX instead - the "suffix" in the name seems to imply this
anyway.
Also add tests to cover the common -qa cases.
As of Doxygen >= 1.8.20 it started complaining about anything marked
as @retval being undocumented. As this is widely used in rpm...
Mass-replace all @retval uses with @param[out] to silence. Some of
these are actually in/out parameters but combing through all of them
is a bit too much...
Also escape <CR><LF> in rpmpgp.h to shut up yet another new warning.
- Basename and dirindex counts must be equal, dirnames count must be
larger than zero and no larger than number of basenames. Check
that directory indexes are within range. Additionally file states
array size, if used, must equal to the genaral file count.
- Packages with no RPMTAG_FILESTATES cannot have installed files
from our POV, just exit early in that case.
- Rerrange the exit path a bit and only call rpmtdFreeData() on
file states if the corresponding headerGet() call was actually
made. Wont make any difference yet, but once we have other jumps
to exit it will.
- Rename rpmfiBuildFNames() to fnTag() and push all the td manipulation
there, making all the various different fn-related tags differ by
just the arguments to fnTag() and allowing central error etc
handling. No functional changes (yet) though.
- The current method that --requires and friends use is kinda
cumbersome and outputs extra whitespace for dependencies which
dont have flags+version attached. Adding extensions for this
is likely to be easier than teaching query formatting to
permit conditionalizing on current value instead of just tag existence.
- For a more consistent experience wrt all the state-awareness stuff,
this needs to be easily querifiable too.
- Also makes the tagnames kludgery from commit
cac8c38960 unnecessary
- For non-regular files we can easily generate this information based
on file mode + in case of symlinks, the link target is available
in the header elsewhere. This also means --fileclass will return
at least partial data for packages built with the external depgen.
- Clean up fileclassTag() a bit while at it, removing redundant fluff.
- Arguably this "magic" should be done inside rpmfiFClass() instead, but
that'd require changing the API to return malloced data.
- Remove NULL-assignments of local variables at the end of scope
in header + tag- and format-extension code. While this
NULL-on-free idiom of rpm codebase is harmless as such, these
unnecessary NULL-assignments have the effect of hiding real problems
in the amount of noise they generate on code analysis.
- While the changes are supposedly trivial, doing this in smaller parts
to make bisecting easier in case a some regression slips through.
- This hasn't been functional since rpm 4.6 at least: the tag is marked
internal so it's not recognized as a valid query tag, and there's
no point supporting this anyway, it was already deprecated backwards
compatibility hack in rpm 2.x in 1998 era.
- This is a bad "API" for verification, it can't be controlled and
causes heavy IO where one would not expect it. Getting rid of it now
before anybody starts relying on it...
- Leaving :fstatus format extension alone however, it's at least harmless
and produces a more predictable output than :vflags extension so it
might be actually useful in scripts.
- The header getters are used for both signature header and the "normal"
header, and even beyond that there's no requirement for a tag in
the header to be part of rpmTag enum. The headerPutFoo() variants
technically do require the tag to be found in the tag table (ie be
an rpmTag) but they still operate on the integer value, they dont
require it to be a "true" enum.
- Inside tagexts.c there are a few "true" enum uses in the
internal helper functions, leave them be.
- While this technically changes some the most commonly used API's,
this wont affect callers really: if the callers were using an enum
before, enum can always be cast naturally to an integer. The other
way around was the problematic part (ie the braindamage we're fixing
here now...)
- Enums are fine for defining the bitfield flags, but the bitfield
itself is not an enumeration. Add a separate typedef on "rpmFlags"
type (presenting a bitfield of flags) for all of these. Compilers
hardly care, but the typedefs give a nice visual clue for
us humans using these flags far away from ho^H^H definitions.
- Permits basic file verification with just a headerGet(), with some
caveats: there's no way to control which attributes get verified,
and there's no filtering of mtime differences of shared files. Those
aside, rpm -q --qf "[%{filestates:vflags} %{filenames}\n] <args>" now
performs the same as "rpm -V --nodeps --noscripts <args>"
- behave like headerGet() does and return failure if there's no data
to return
- some cases where we used to return nothing previously now return (none)
in query, but the former behavior was inconsistent between tags
- not sure if (none) is really wanted for a return of no value always,
but at least it's consistent now
- convert old 32bit sizes to 64bit if large sizes aren't present in header
- if large sizes are present, we malloc + copy the result to have consistent
behavior for rpmfi