Commit Graph

259 Commits

Author SHA1 Message Date
Panu Matilainen 4e207bfdfc Unbreak rpm -V output (RhBug:797964)
- Commit ac0ab016a5 unintentionally
  changed the order of the problems shown in verify strings due to
  a dumb oversight (greetings to self, duh). In other words, this
  fixes a verify output regression in rpm >= 4.9.x by restoring
  the long-standing (and documented) order of the verify output chars.
- Also fix the testcase which unfortunately was only added after
  the output-changing commit so it didn't catch the breakage either :-/
2012-02-28 10:36:10 +02:00
Panu Matilainen 06a2f1269b Don't assume rpmfiNew() always succeeds
- Add NULL checks and add/adjust comments where appropriate.
- The remaining callers should handle NULL fi gracefully if not
  entirely correctly: rpmfiFC() returns 0 on NULL fi, so these
  callers just see the erronous file info set as "no files" case.
  Something to fine-tune later...
2012-01-28 17:07:42 +02:00
Panu Matilainen 5aeebe8d69 Don't assume rpmteNew() always succeeds, part III
- Return error from verifyscript if rpmteNew() fails. This can't
  currently happen but handling this error makes it possible to
  do sanity checks on the header contents, such as file list integrity etc.
  Unlikely to occur for installed packages, but verify can be run
  on non-installed packages as well, where failure is more of a possibility.
2012-01-28 15:17:02 +02:00
Panu Matilainen f67c47b856 Eliminate bunch of dead assignments on ts vsflags
- The common pattern here is grabbing current flags to a local
  variable, modifying them for an operation and then restoring,
  which is fine... but we dont care about the previous flags
  when we're restoring them.
2011-05-30 15:50:29 +03:00
Panu Matilainen b1597da353 Eliminate dead NULL-assignments at scope-end in librpm, part VI
- Remove NULL-assignments of local variables at the end of scope
  in "cli-level" code
2011-05-29 11:50:54 +03:00
Panu Matilainen 563f7c0dad Permit %verifyscript from non-installed packages
- Verification from non-installed packages can be useful sometimes:
  http://lists.rpm.org/pipermail/rpm-maint/2011-May/003015.html
- %verifyscript is unlike all other scriptlets so might as well
  take some shortcuts and bypass rpmteProcess() & all, just
  create a lone rpmte, force the header we got and call rpmpsmRun()
  directly on it, bypassing rpmteProcess() which is only an
  unnecessary complication here (based on patch by Michael Schroeder)
2011-05-25 14:26:51 +03:00
Panu Matilainen 469b10d1d2 Clean up file type verification logic a bit
- Non-regular files mostly share the same unverifiable properties,
  no point in listing all the cases separately. Links are a notable
  exception in that they're different from everything else, handle
  that separately.
- Also clean up other formatting: wrap lines at a better point +
  avoid multiline-comments when single line suffices.
2011-05-03 15:02:42 +03:00
Panu Matilainen ee0ae58b44 Verify some properties of replaced and wrong-colored files (RhBug:528383)
- We can't verify any properties of replaced files, but we can and
  should still see if it exists at all.
- Files skipped due to wrong color are supposed to share some of
  the attributes with the file that got actually installed, such
  as permissions and whether it exists at all. Verify what we can
  instead of silently ignoring.
2011-03-09 10:30:51 +02:00
Panu Matilainen 2a54555aa2 Split user+group caching to separate source (again), rename
- We'll want to unify this and the similar caching done in librpmbuild,
  so we need to expose these in the ABI at least, rename to get
  them namespaced and use a separate source module (again) as
  this is a pretty distinct functionality.
- This would really belong to librpmio but leaving here for now...
2010-12-15 09:22:08 +02:00
Panu Matilainen ea951fca34 Eliminate pgpHashAlgo uses in librpm side
- In all these cases the value comes from a non-enum source so
  just use an int instead
2010-10-22 13:06:36 +03:00
Panu Matilainen 0715b04664 Change all internal uses of rpmtsInitIterator() to use DBI tags 2010-10-22 11:49:52 +03:00
Panu Matilainen adbd484372 Make RPMFILE_STATE_MISSING part of the rpmfileState enum
- Shuts up couple of "not in enum" complaints from gcc, and actually
  "no state" is a perfectly valid state for one case: non-installed
  packages (so remove the "not valid" comment from formats.c)
- OTOH, this created a new complaint for not handled case in a switch.
  Oh well, fix it up too...
2010-09-28 23:06:29 +03:00
Panu Matilainen fbe701e7fe Fix error code on verify scriptlet failure
- Verify scriptlet failures were only logged but didn't reflect error
  codes as they were considered "warn only" along with most others
2010-09-07 09:49:29 +03:00
Panu Matilainen a68bcb383e Use the common rpmcliQueryFlags for signature verify options in rpm cli too
- Technically this changes the rpmcliQuery() and rpmcliVerify() API
  in the sense that we no longer honor the qva->qva_flags for the
  --nosignature and others, but we assume anybody using these (as if
  anybody was using the "cli" API) uses rpmcliInit() which takes
  care of these common bits... shrug.
- Ditch ancient and hidden --nopgp --nogpg switches along with the
  dishwater which are simply alias to --nosignature.
- Eliminate now unused qva_flags from rpmInstallArguments (along with
  a double vsflags goo from rpmgraph)
2010-09-03 10:50:37 +03:00
Panu Matilainen f2bfa2edfc Use the new chroot API everywhere, eliminate old related goo 2010-05-31 14:11:12 +03:00
Panu Matilainen 1dd5b084bd Add internal helper for formatting file attribute strings
- Eliminates some copy-paste slopping. Verify code traditionally only
  shows the first attribute, take care to keep that format to avoid
  breaking scripts unnecessarily
2010-05-28 12:57:59 +03:00
Panu Matilainen ac0ab016a5 Add internal helper for formatting verify flags 2010-05-28 12:18:26 +03:00
Panu Matilainen a6c8e49023 Move shared file timestamp filtering out of rpmVerifyFile()
- rpmVerifyFile() reports things as they are in reality - if timestamps
  on disk differ to header then it reports it. Filtering on the result
  belongs to the code interpreting the results.
2010-05-28 10:49:58 +03:00
Panu Matilainen 3f38850609 Only pass the info we actually care about to verifyHeader() 2010-05-28 09:57:09 +03:00
Panu Matilainen f4bbfed800 Eliminate unused argument to verifyDependencies() 2010-05-28 09:51:51 +03:00
Panu Matilainen 591c5c3fbb Clean up verify script handling a bit
- test verifyscript existence in rpmVerifyScript() instead of caller,
  making it safe+correct for calling on any header
- eliminate unused/unnecessary arguments, local variables and bogus leftover
  comments
2010-05-28 09:49:28 +03:00
Panu Matilainen 2b7884ce29 Fix return from chroot() on verify (RhBug:590588)
- a couple of important steps in chroot() in and out sequence missing,
  causing "No such file or directory" whining on return from chroot()
  unless cwd happened to be /
2010-05-18 10:43:05 +03:00
Panu Matilainen f051801373 Convert rpmte internals to use the transaction pointer from element itself 2010-05-07 14:31:25 +03:00
Panu Matilainen 2275a2ef89 Hide rpmte open/close/error etc logic inside rpmteProcess()
- make a bunch of helper functions static now that they're not needed
  elsewhere, rpmte is slowly becoming self-aware ;)
2010-03-29 18:40:29 +03:00
Panu Matilainen 7289fadea3 Move the little thats left of psm.h into rpmte_internal.h
- no functional changes, just shuffling declares around
2010-03-29 18:40:29 +03:00
Panu Matilainen 0d68cbf48e Use the new problem set iterator where it makes more sense 2010-03-26 09:31:00 +02:00
Panu Matilainen ab890ee23f Clean up verifyDependencies() a bit, no functional changes
- only init problem iterator if there are problems
- use problems and nevra from the faked up transaction element
- the return code is the number of problems, no need to count separately
2010-03-25 11:34:24 +02:00
Panu Matilainen b88d70fd21 Sanitize verifyscript handling a bit
- set the transaction scriptfd once in rpmcliVerify() instead of
  dupping and closing and dupping and closing for every verified package
2010-03-25 11:13:16 +02:00
Panu Matilainen 714c22f248 Mop up leftovers from past times 2010-03-22 15:43:05 +02:00
Panu Matilainen df9cdb1321 Turn PSM into a complete blackbox
- The psm structures aren't stored or passed around by any users,
  so there's no need for them to separately allocate and free the
  struct, bury this all inside rpmpsmRun() which takes care of
  initialization, actual actions and freeing.
- There's also no need for refcounting now as allocations are completely
  contained within the rpmpsmRun() blackbox. Lose psm-debug foo which
  was only used for refcount debugging.
- No functional changes
2010-03-12 09:04:29 +02:00
Panu Matilainen cd3d8082e1 Implement pretrans, posttrans and verifyscript as psm goals
- Loose rpmpsmScriptStage() hack and bury the psm details inside
  the psm implementation
- Map the script-only goal enums to the corresponding script tag
  to avoid having to re-re-re-map stuff unnecessarily
- pretrans and posttrans should really be handled as a part of PKG_INSTALL
  process, but as these stages are disconnected from the main install
  part we can't remember the state in the psm - it would need to be
  stashed into transaction elements in the meanwhile
2010-02-25 14:22:34 +02:00
Panu Matilainen 924234e8b6 Lose now unnecessary progTag from psm
- our scriptlet thingie knows which progtag to use for a given script tag
  already, no need to baby-feed the psm
2010-02-25 11:05:02 +02:00
Panu Matilainen 04ad4b1155 Really fix verification error code to not depend on verbosity (RhBug:557101)
- earlier fix from commit 6649c23cac was
  broken as it could reset return code to zero after detecting errors
  earlier
2010-01-21 14:14:28 +02:00
Panu Matilainen dd58384ede Move <errno.h> include out of system.h to the places that need it 2010-01-05 15:25:31 +02:00
Panu Matilainen 6109d6388e Remove libcap stuff out of system.h
- just a few places need, avoid polluting everything with it
- make fsm->fcaps void * to avoid having to deal with fcap_t not defined
2010-01-05 13:29:52 +02:00
Panu Matilainen f978dc78b4 Move libacl.h include out of system.h to the only place that cares 2010-01-05 11:52:56 +02:00
Panu Matilainen 5f0c9a3882 Require lchown() and remove ancient broken chown kludgery
- lchown() is POSIX 2001, we dont care about older / nonconformant stuff
2010-01-04 15:58:55 +02:00
Panu Matilainen 6bc5d87007 Rip out dependency caching
- it doesn't speed up things that much, is broken in some chroot
  scenarios and is ugly ugly hardwired BDB hackery where it doesn't belong
2009-09-21 14:36:59 +03:00
Panu Matilainen bd1507497a Eliminate bunch of unused variables 2009-09-07 12:23:21 +03:00
Panu Matilainen b5bc388ee3 Eliminate uses of headerNVR() and friends in librpm (and python) code 2009-09-02 12:06:34 +03:00
Panu Matilainen 0e8dd93796 Replace equal/not equal uses of str[n]cmp() with rstreq[n] in main ts code 2009-08-31 13:03:53 +03:00
Panu Matilainen 6649c23cac Make verify result not depend on verbosity level, uff... (RhBug:510213) 2009-07-08 16:20:06 +03:00
Panu Matilainen c685667475 Band-aid to dependency caching misbehaving with chrooted verify (RhBug:508074)
- disable dependency caching on chrooted verify to avoid ugly spew
  from paths containing outside paths while we're actually inside the
  root during verification
- correct fix would be to fix the temporary db path calculation
2009-07-01 13:59:53 +03:00
Panu Matilainen 61acdba023 Eliminate epoch promotion debug cruft
- might've been useful back in the day but...
2009-06-16 17:49:44 +03:00
Jindrich Novy 7acdfded4a Add md5->filedigest aliases (rhbz#487597)
- add %verify(nofiledigest) as %verify(nomd5) file attribute alias
- reference digests as digests not checksums
- make old md5 related symbols obsolete and use newer reference
- update man page accordingly
2009-02-27 14:34:39 +01:00
Panu Matilainen b04c67136f rpmfi is only needed by verifyHeader(), push it there
- no functional changes, just slight reorganization
2009-02-05 17:22:00 +02:00
Panu Matilainen af9801a162 Add extra parameter to rpmteClose() to control fi behavior
- pre/posttrans scripts should leave te->fi alone, now it was getting
  nuked, oops..
2009-01-15 10:28:13 +02:00
Panu Matilainen fe5e906ab2 Eliminate file info set argument to rpmpsmNew()
- ts element carries the info already, no need for separate argument
2008-12-19 14:57:37 +02:00
Panu Matilainen cbcff3bd99 Optionally reload ts element file info in rpmteOpen(), free in close
- avoids having to muck with te internals here and there...
2008-12-19 14:34:45 +02:00
Panu Matilainen 26faceebed Resurrect rpmVerifyScript()
- fake up a transction element set that we can use to convince psm to
  execute the script
- a bit hacky but by no means worse than the former fi->h abuse with
  scaremem and all
2008-11-26 17:35:13 +02:00