Commit Graph

5083 Commits

Author SHA1 Message Date
Panu Matilainen 8a1f9c13fd Oops, only private pool should be frozen on ds create 2012-09-11 14:40:01 +03:00
Panu Matilainen 0d17da2615 Add an alternative rpmds constructor to allow shared pool usage
- rpmdsNewPool() allows specifying shared/private pool, and rpmdsNew()
  is now just a wrapper to always call it with NULL (ie private) pool.
2012-09-11 13:53:24 +03:00
Panu Matilainen 2d62f297bc Freeze the rpmlib dependency set pool on successful return
- ...to avoid wasting memory on the relatively static data. We could
  handle the rpmlib ds singleton behavior here too but it would change
  semantics. Ponder about it later...
- Would be nicer to have rpmdsMerge() freeze on return, but that
  gets called in loops so we'd be doing a whole lot of huffing and
  puffing recreating the pools on each entry.
2012-09-11 13:43:09 +03:00
Panu Matilainen f5be054332 Further split single ds creation into two, sigh
- Allow rpmdsCurrent() to share the pool and id's of its "parent" ds
  instead of having to repeatedly create and tear down entire pools
  just for a couple of strings. Used by python bindings for rpmds
  iteration so we'll want to be reasonably efficient.
- For now, rpmdsSingle() and rpmdsThis() always get a private pool,
  wasteful as it might be, but at least now we can freeze them.
2012-09-11 13:41:16 +03:00
Panu Matilainen cee404ff37 Unify the common parts of rpmds creation into a helper function
- No functional changes, just sanity-refactoring
2012-09-11 11:54:23 +03:00
Panu Matilainen b89a836829 Eliminate assert()'s from rpmdsMerge()
- These "can't happen" cases where EVR/Flags in source ds are missing
  are just as easy to handle as is dying, handling is saner...
2012-09-11 11:19:23 +03:00
Panu Matilainen c5b6ad0464 Eliminate assert()'s from rpmdsDup()
- The "can't happen" case where EVR/Flags are not present is just as
  easily handled as dying.
2012-09-11 11:00:24 +03:00
Panu Matilainen 71c72058d2 Switch dependency sets to use string pool storage for names and evrs
- Always push dependency names and versions into string pool (private
  for now). This is terribly wasteful for single ds items, even more
  so for rpmdsCurrent() but to keep the initial switch-over changes
  to minimum we'll deal with those later.
- While we freeze the pool for ds data from headers, single ds items
  are on purpose not frozen for now, due to interactions with
  rpmdsCurrent() and rpmds merging.
- Eliminate no longer needed rpmdsDupArgv(), we're now just copying
  a bunch of integers around. Sanitize rpmdsMerge() now that we can:
  realloc and shift the data instead of recreating all of N, EVR
  and Flags.
2012-09-11 10:54:40 +03:00
Panu Matilainen 0c76a514f0 Rename td2pool as rpmtdToPool, export and optimize
- Using rpmtd iteration for this is slow and stupid as we keep
  pointlessly re-re-re-re-re-validating the tag type and indexes.
- Change argument order to source -> destination
- Move to rpmtd.c where it belongs and make public with a decent
  name. Not sure if this is the kind of an API we really want to make
  public but ... at least for now it'll do.
2012-09-11 08:16:07 +03:00
Panu Matilainen 9929a34aaf Eliminate direct rpmds name (and flags) access on rpmdsNew() 2012-09-11 08:09:16 +03:00
Panu Matilainen c5276f3b3d Clean up rpmdsSearch() a bit
- Eliminate numerous repeated direct accesses to [o]ds N, EVR and Flags,
  instead use getter functions and local variable for ods name which
  does not change.
2012-09-11 08:09:12 +03:00
Panu Matilainen 42f6abba48 Add internal indexed variants of rpmds N, EVR and Flags getters
- We'll need these to eliminate the remaining direct accesses to
  N, EVR (and Flags) on random access patterns such as rpmdsSearch().
2012-09-11 08:09:07 +03:00
Panu Matilainen a596ae47a3 Clean up rpmdsFind() a bit
- Eliminate numerous repeated direct accesses to [o]ds N, EVR and Flags,
  instead grab them into local variables through getter functions as
  needed: on entry for ods which doesn't change, for ds in the loop
  as we're changing ds->i here.
2012-09-11 08:08:59 +03:00
Panu Matilainen d2f51ded49 Split rpmds EVR comparison into function of its own
- The EVR comparison is a distinct operation of its own: rpmdsCompare()
  looks at the other properties, EVR comparison is done if needed.
  Doesn't affect speed or functionality, but cuts down on the
  big number of local variables and has the nice side-effect of
  making the xstrdup() allocations local within rpmdsCompareEVR()
2012-09-11 08:08:54 +03:00
Panu Matilainen 03b6fcb1a1 Use getter functions for name, evr and flags in rpmdsCurrent() 2012-09-11 08:08:46 +03:00
Panu Matilainen 9d0e0fcc23 Clean up rpmdsCompare() a bit
- Eliminate numerous repeated direct accesses to ds N, EVR and Flags,
  instead grab them into local variables through getter functions
  as they are needed. Besides making it easier on the eyes, makes the
  function safe(r) wrt illegal iterator values etc.
2012-09-11 08:08:39 +03:00
Panu Matilainen 25bef90870 Clean up rpmdsNewDNEVR() a bit
- Eliminate numerous repeated direct accesses to ds N, EVR and Flags,
  instead grab them into local variables at entry. This also makes
  the function safe illegal iterator values (ie calling when iteration
  not started), previously the bounds were not checked.
2012-09-11 08:08:34 +03:00
Panu Matilainen 7dc5ca2da1 Switch file info set base- and dirnames storage to string pool
- Always push base and dir names into file info sets string pool,
  whether private or shared. For basenames, this can save significant
  space even in a private pool, for dirnames private pool is moot
  as the names are already unique, shared pool is quite another story.
- Adjust fpLookupList() to take a pool and id's as arguments.
- This introduces a fair amount of overhead, so things will be somewhat
  slower until the transition to pool id's is (more) complete. Sometimes
  things have to get worse before they get better... Other than that,
  this should be entirely invisible to callers.
2012-09-08 11:25:16 +03:00
Panu Matilainen 337a7b130a Clean up file info set creation, comment
- Grab and validate the file triplet before placing the data into the
  file set. Other than making it more explicit, doesn't matter right
  now but we'll need this shortly.
- Refactor the file triplet sanity check into a generic indexed triplet
  sanity check (and notice there was an error in the previous index
  range checking, duh)
- Apart from the index range fix, shouldn't change any actual functionality
2012-09-08 10:53:50 +03:00
Panu Matilainen 03aac530fb Push the flag foo into rpmfiPopulate(), explicit HEADERGET_ALLOC for others 2012-09-08 09:43:57 +03:00
Panu Matilainen fbdd7095b4 Always allocate directory index data
- Just for consistency's sake: now the "core" file triplet data does
  not depend on how we got called.
2012-09-08 09:40:21 +03:00
Panu Matilainen 895fe67e32 Refactor the big rpmfiNewPool() to two separate pieces
- Split file info generation by mandatory/optional data: every file info
  set has the file triplet information, but all other data is optional
  depending on the create flags. No functional changes.
- Being able to create just the core file triplet and fully populate
  later might be useful for checkInstalledFiles(), but we'll see about
  that...
2012-09-08 09:39:10 +03:00
Panu Matilainen 068b2afdf6 Split the tagdata -> pool population to another helper function
- For filename triplets we'll need to get and validate the data
  before inserting into the pool, so we'll need this shortly.
2012-09-07 21:13:21 +03:00
Panu Matilainen f0a9d2577b Add an alternative rpmfi constructor to allow shared pool usage
- rpmfiNewPool() allows specifying shared/private pool, and
  rpmfiNew() is now just a wrapper to always call it with a private pool.
2012-09-07 15:48:45 +03:00
Panu Matilainen d2bb9d38c9 Move string pool typedefs to rpmtypes.h
- I suspect these will be used widely, to avoid having to include
  rpmstrpool.h all over in headers...
2012-09-07 14:09:35 +03:00
Panu Matilainen bd33a6656c Axe the no longer needed rpmfi string "cache" stuff 2012-09-07 13:34:56 +03:00
Panu Matilainen 90e3792232 Use string pool for file set symlinks
- Removes the last use of our former simple, stupid and slow caches
- For now, use a per-fi pool for this just like the previous caching
  did. Memory use is slightly increased but its faster than before,
  to reap the full benefits (memory and otherwise) we'll want a
  per-transaction pool for these, to be added later.
2012-09-07 13:34:50 +03:00
Panu Matilainen 8909eed1a8 Replace user- and groupname + file lang caches with a global stringpool
- With the string pool we dont have to worry about overflowing the
  indexes so we can lump all this relatively static data into one pool.
  Because rpmsid's are larger than the previous cache indexes, we'll
  loose some of the memory savings, but then the pool is faster on
  insertion, and we'll only need one of them so...
- The misc. pool is never freed, flushed or frozen so it'll "waste" memory
  throughout the lifetime of a process (similarly to the previous caches)
  but its not huge so .. ignoring that for now.
2012-09-07 13:34:42 +03:00
Panu Matilainen 4606460e54 Dont bother with file capability "cache"
- Very few packages have RPMTAG_FILECAPS at all, and the memory saving
  for those that do is so marginal it hardly matters at all. At least
  for now, dont bother.
2012-09-07 13:34:37 +03:00
Panu Matilainen a466227a2f Missing <stdio.h> include for fprintf() 2012-09-07 10:27:08 +03:00
Panu Matilainen cffdbc7aec Return fingerprint lookups through retval pointer, not struct
- Returning structs by value is a bit icky, pass in a fp pointer
  for fpLookup() to fill in instead. This leaves the actual return code
  free for handling errors (but ignoring that for now as we always have)
  The other option would be always mallocing the return, and we dont
  want to do that...
- Shouldn't change any actual functionality.
2012-09-06 12:53:05 +03:00
Panu Matilainen 1cbc2a14f2 Avoid double iteration on 'rpm -e' now that iterator count works
- While harmless, having to count on one and act on another iteration
  gets expensive when there are lots of labels specified. Especially
  as the iterator initialization can already load the same headers
  multiple times, sigh...
2012-09-06 10:48:51 +03:00
Panu Matilainen fddfee17c3 Push RPMDBI_LABEL arch parsing down to rpmdb layer to fix stuff
- Partial NEVRA labels cannot be reliably parsed, the various combinations
  need to be figured out by trial-and-error. The rpmts layer doesn't stand
  a chance of getting it right so move it to rpmdb layer. This doesn't
  make the process any less stupid, but at least we get correct results...
- Fixes iterator count when arch is used in a label and more than one
  arch variants of a package are installed. Previously iterator count
  could be more than one despite actual iteration only hitting one
  match, as the arch RE match was added after already initializing
  the iterator.
- Also fixes various pathological cases:
  - If a legal arch was part of name, version or release (stupid but legal)
    we misinterpreted it for arch and failed to find the package.
  - If a package with unknown architecture was installed (with --ignorearch)
    we could not remove it by its arch as we relied on rpmIsKnownArch()
2012-09-06 10:40:36 +03:00
Panu Matilainen 2ef9380afe Use existing fingerprint for packages being removed
- Missed opportunity in commit 1a3a4089def9b00790eeebd6f931c99a03a3d44b:
  removed packages have already gotten fingerprinted so there's no need
  to redo that here.
2012-09-05 19:40:07 +03:00
Panu Matilainen 154d21453f Shut up gcc whine about potentially uninitialized variable
- This is a false positive really, or at least a cant-happen case
2012-09-05 17:47:24 +03:00
Panu Matilainen ea3a8f1e42 Avoid rehashing directory name when it doesn't change in rpmal population
- Another modest improvement in redundant rehashing elimination, but in the
  big picture, this is really just another fart in the Sahara desert...
2012-09-05 17:09:40 +03:00
Panu Matilainen 712101ba98 Prehash dir names on fingerprinting to avoid recalculating when adding
- Speedup depends on transaction and yadda yadda, on my large erasure
  transaction testcase this is circa two percent saving on rstrhash()
  total costs.
2012-09-05 12:10:51 +03:00
Panu Matilainen 81dbfa2651 Use helper variable to eliminate multiple identical conditionals 2012-09-05 11:56:08 +03:00
Panu Matilainen a4af3e80f8 Prehash dependency strings to avoid recalculating when caching
- Speedup depends on the transaction and is likely to be rather modest
  anyway, but can't hurt either...
2012-09-05 11:03:36 +03:00
Panu Matilainen 18b47c6fe9 Prehash basenames to avoid recalculation when adding new ones
- Speedup depends on the transaction and is by no means enormous,
  but on my testcase of a largish erasure transaction this shaves
  off circa four percent of the cycles spent in (re)hashing the
  basenames.
2012-09-05 10:41:44 +03:00
Panu Matilainen 0ea18244f2 Add alternative hash key add/get/check methods with prehashed key
- In cases where more than one operation is done with the same key, these
  can be used to avoid the relatively expensive rehashing of the key.
2012-09-05 10:38:36 +03:00
Panu Matilainen b323c27d88 Add hash table methodn for (pre)calculating base hash of a key 2012-09-05 10:37:28 +03:00
Panu Matilainen f974c457e3 Minor optimizations to rpmvercmp()
- Avoid calculating string lengths if versions are equal
- Avoid calculating string lengths twice in numeric comparison
2012-09-04 13:47:23 +03:00
Panu Matilainen e663722a79 Avoid netshared path matching when netshared path is not set
- We've been calling matchNetsharedpath() for every single file in
  the transaction regardless of whether %{_netsharedpath} is set or
  not (and almost always it is not), meaning lots of pointless
  strlen() calls and in case of erasure, rpmfi iterations performed.
  Not exactly a massive speedup but a speedup nevertheless.
2012-09-03 15:13:08 +03:00
Panu Matilainen d5dc69c18e "Optimize" addFingerprints() a bit
- Avoid repeatedly calling rpmteGetFileStates() for every file processed
- Avoid rpmfi iteration, use a good ole for-loop and index-accessors
- Dont bother looking up symlinks for skipped files
- Eliminate rpmfi from the latter loop, its not used for anything there
- Not that this is going to show on wall-clock times, the cycles saved here
  are going to get very much lost in the noise of more expensive things.
2012-09-03 14:24:12 +03:00
Panu Matilainen f7f02fb6cb Avoid unnecessary calculations on %ghost %config
- If the replacing %config file is a %ghost, then we'll just leave whatever
  might be on disk alone.
- OTOH in the opposite case we probably *should* take backups, if the
  file exists on disk and is differs from the new non-ghost (but
  currently we take never take backups for %ghosts)
2012-08-30 15:44:29 +03:00
Panu Matilainen 06242419af Only backup if osuffix is set
- This can happen on %ghost files, fsm->ossufix is never set for them.
  Arguably this is a bug in the file disposition calculations but for now...
2012-08-30 14:46:53 +03:00
Panu Matilainen 273a025c50 Fix memleak regresssion in rpmfiDecideFateIndex()
- Similar to commit 80ee39da35544253cab12abd54af8754335ac945: this
  started leaking at commit 3f996a588a
  as rpmfiFNIndex() returns malloced memory. Refactor the lucky 13
  return points into one, allowing cleanup at exit.
2012-08-30 12:15:51 +03:00
Panu Matilainen 551209488f Cache the actual result on rpmdb header verification
- Previously we'd turn all but FAILED results into "OK" after first
  check, now we return the real value. And perhaps more importantly,
  no longer try re-verifying previously failed headers in vain.
2012-08-30 11:02:54 +03:00
Panu Matilainen 1a3a4089de Use file info set of removed packages instead of header fetches
- When we get rpmdb hits on files from packages that are to be removed
  in the same transaction, we can use its existing file info set
  to grab base- and directory names to avoid bunch of headerGet()'s
  and consecutive rpmtd manipulation. In theory this should speed up
  transactions where lots of packages get removed, in practise not
  really - the big cost here is in loading the headers from db in the
  first place, despite not being really needed.
2012-08-30 10:40:20 +03:00
Panu Matilainen a664b518d4 Use file info set of removed packages instead of new temporary one
- When we get rpmdb hits on files from packages that are to be removed
  in the same transaction, we can use the exisiting file info set
  to avoid constructing a new temporary one. Might be measurable
  in large updates.
2012-08-30 09:51:39 +03:00
Panu Matilainen 40ee05abbc Store transaction element pointers in the removedPkgs hash
- Change the hashtype name to something else, its no longer a plain
  int hash. Still needs double definition as its not contained in
  a single source (might want a wrapper similar to rpmal), but
  slightly more contained now than the previous intHash definition.
- This opens up some new possibilities, to be taken advantage of
  in later commits.
2012-08-30 08:36:22 +03:00
Panu Matilainen f933015fc0 Define separate hash for rpmdb header check cache
- This is really private to rpmdb.c (other than being exposed in
  the struct definition in backend/dbi.h, sigh), let it live its
  own life there.
- No functional changes here, just cleaning up a bit for next steps.
  OTOH we could now cache the actual result, not just success... but
  leaving that to another time.
2012-08-29 17:31:32 +03:00
Panu Matilainen 52c6012bbd Oops, undefining wrong name... 2012-08-29 16:39:51 +03:00
Panu Matilainen c906140266 Split colored conflict resolution to helper function, unify callers
- The cases in handleOverlappedFiles() and handleInstInstalledFile() only
  differ by presence of "other file state", unify the copy-paste code
  to helper function and comment a bit more.
- Push all the color fiddling into the helper, eliminating loads of
  unnecessary rpmfiFColorIndex() calls in the common case. Also gives
  us a single point of control for the color-conflict behavior.
- This is not supposed to change any behavior at all, just refactoring...
2012-08-29 15:04:59 +03:00
Panu Matilainen 161494b973 Eliminate redundant helper variable
- Just use the file action to determine if we already decided something
  for this file or not, no need for additional helper trackers.
2012-08-29 14:31:50 +03:00
Panu Matilainen 5d4d1507b2 Differentiate between filtered and otherwise resolved new conflicts
- Kinda similar to commit 12322bad67 but for
  conflicts among the added set: grab the conflict filtering flag once
  outside the loop and use to determine whether to report detected
  conflicts or not. Doesn't change actual functionality.
2012-08-29 14:31:28 +03:00
Panu Matilainen a7a06ec88f Detect attempts to replace directory symlink to directory in package
- Rpm cannot currently *correctly* deal with directory symlink changing
  to a directory through updates, detect early and abort with conflicts
  instead of proceeding with known-broken results: previously these
  would seemingly succeed but without actually doing the requested
  changes, and leaving orphans on the disk. Far less evil than the
  directory replacement failure but incorrect anyway.
- Same %pretrans wackiness as with directory replacements applies here.
- Adjust test-suite to match the new behavior.
- It's possible there are packages that have been relying on the former
  broken "success" results, so this might need further fine-tuning...
2012-08-24 13:36:52 +03:00
Panu Matilainen 00d82f1322 Detect attempts to replace directories and report as conflicts
- Rpm cannot currently deal with directory changing to something else
  through upgrades. Until now we've barfed up an ugly error in the
  middle of transaction, leaving partially installed broken junk behind.
  It'd sure be nice to be able to actually handle this some day, but
  until then detecting and aborting early is a far better option than
  the former behavior.
- There are some "only in rpm" level bizarre quirks here: packages
  can work around this limitation by using a %pretrans scriptlet,
  which runs before the conflict detection. But this means a possible
  test-transaction (as done by eg yum) will still see the conflicts,
  as we obviously dont want to run disk-modifying scripts on
  test-transaction. So when looking at these removal conflicts, we filter
  them out on test-transaction IFF the package has a %pretrans script
  so there's a chance it might actually fix the conflict when we get
  to it in a real transaction. Obviously %pretrans from any package
  could in theory fix such issues, but as this is evil enough as it is,
  try to limit the damage... Without %pretrans, the only other option
  to get around these is manual intervention.
2012-08-24 13:02:09 +03:00
Panu Matilainen 621be76cc0 Make rpmteHaveTransScript() available internally 2012-08-24 08:51:01 +03:00
Panu Matilainen 12322bad67 Differentiate between filtered and otherwise resolved conflicts
- No functional changes here, just spelling out the different
  cases explicitly.
2012-08-24 07:51:55 +03:00
Panu Matilainen 3ade5ac3ac Remove unused leftover variable
- Should've been in commit a3a08a4b0a
2012-08-23 14:45:01 +03:00
Panu Matilainen 0936fbc7bb Axe the if-what jungle in rpmfiDecideFateIndex()
- Unless the file does not exist on disk, we cannot determine the
  correct action for config files and symlinks before we actually
  check them. Those are also the only types that *can* result in
  FA_ALTNAME/FA_SAVE action, anything else we can just create.
  Besides making the logic a whole lot easier to follow, it also
  fixes our remaining test-case failures. Who would've thought?
- Might be worth noting that this requires the pile of fsm fixes
  from previous commits to work.
2012-08-23 14:37:52 +03:00
Panu Matilainen d0b76044cf Backing up contents when replaced by directory needs special handling
- When a directory is about to replace a %config needing backup,
  we need to backup early as directories don't use a temporary
  path, and fsmVerify() will remove the file before we get to
  it in fsmCommit().
2012-08-23 14:09:20 +03:00
Panu Matilainen 3b44f1dc8b Use fsm->action to decide whether we need a backup or not.
- We already have a carefully precalculated action decided for these
  things, use that instead of bunch of arbitrary (except for osuffix)
  conditions depending on several nasty hacks and hidden assumptions.
  Doing so fixes stuff, who would've thought of that?
- Adjust test-suite expectations
2012-08-23 13:20:57 +03:00
Panu Matilainen d85b62428c Backup filename needs suffix, whether its directory or not 2012-08-23 12:44:33 +03:00
Panu Matilainen 945329b611 Remove dead file-backup code
- fsmVerify() never ever returns 0 for regular files because of
  multiple hacks in how this all "works": on install, we skip stat()
  but claim disk checked and file not existing, so fsmVerify() returns
  early. Good thing it does too, as otherwise it would remove the
  file we were supposed to be saving here. The actual %config backup
  occurs in fsmCommit(): regular files are first installed with a
  temporary suffix and at "commit" time we decide whether it needs
  backing up or not (involving several other hacks...)
2012-08-23 12:08:12 +03:00
Panu Matilainen 80ee39da35 Fix a massive memleak from rpmfiConfigConflictIndex() and optimize it
- rpmfiFNIndex() returns a malloced string since commit
  11116a6786 but this wasn't taken into
  account in commit 3f996a588a, causing
  a massive memory leak on transaction preparations.
- Optimize the entry by avoiding rpmfiFNIndex() and lstat() until
  really necessary, and use a central exit point beyond that so
  we can free fn. Besides fixing the memleak, this gives a small
  but measurable performance improvement on this rather busy path.
2012-08-22 12:43:20 +03:00
Panu Matilainen a3a08a4b0a Use rpmfiConfigConflictIndex() for modified config testing on erase too
- Besides eliminating another copy-paste variant of the config file
  digest calculation and comparison, this fixes the case modified
  %config symlink gets silently erased. Unlike a regular config file,
  a symlink does not contain a whole lot of carefully tuned data, but
  if it's marked %config I think we should honor the %config file rules.
- Adjust test-suite expectations to match the new behavior.
2012-08-22 11:56:12 +03:00
Panu Matilainen 79f8122f41 Polish the symlink config file comparison a bit
- Similar treatment as in commit 9f9ed70e2d,
  pay more attention to what kind of files we're comparing in each case,
  add a little breathing room and extra comments.
- Handle the case where on-disk link is identical to the one in new
  package in which case no backup will be needed, fixing two cases
  of unwanted backups in the test-suite.
  (similar to commit 7a50e9de80)
- Other than the on-disk vs new package change, probably doesn't change
  anything yet, but prepares us for the next steps.
2012-08-21 15:54:38 +03:00
Panu Matilainen 9f9ed70e2d Polish the regular config file comparison a bit
- Only return early in the cases where backup will NOT be needed.
  Pay more attention to what kind of files we're comparing in each
  case, add a little breathing room and extra comments.
- This probably doesn't change anything as-is, but hopefully makes
  the logic a bit easier to follow and prepares us for the next steps.
2012-08-21 14:38:22 +03:00
Panu Matilainen 4c0834f725 Cosmetics: compare memcmp() return code explicitly
- Comparing against zero is just that little bit more readable
  than the negated condition.
2012-08-21 14:28:13 +03:00
Panu Matilainen e8a6c87d48 Fix %config backup on erasure regression
- After commit 1845c1d711 erasure
  no longer calls fsmCommit(), missing the backup step entirely.
  Simply split the backup code to a function of its own and call
  as needed. The details look somewhat fishy but what in fsm doesn't...
2012-08-21 09:08:05 +03:00
Panu Matilainen 7a50e9de80 Dont create redundant %config backups when on-disk content is same as new
- When on-disk %config file contents match the contents of the new
  package (such as config in old package was buggy, fixed in new
  and admin worked around in the meantime) there's no point creating
  a backup that's identical to what you already have. Note that
  we create the new config anyway instead of skipping as timestamp
  might have changed.
- Adjust test-cases to the new saner behavior.
2012-08-20 12:42:36 +03:00
Panu Matilainen 2067c7c0d3 Cosmetics: remove unnecessary line-wrap 2012-08-20 11:20:30 +03:00
Panu Matilainen bfb364563a Dont create %config backups on skipped files
- This cosmetical only, but there's no point creating the same backup
  twice. Depends on commit f7f5f88f9f.
2012-08-20 11:12:05 +03:00
Panu Matilainen f7f5f88f9f Only create the first instance of a file shared between packages
- When packages share an identical file, we only need to create the
  first one we encounter and skip it for the rest (reverse already
  happens, and must happen, on erase). This has the benefit of
  getting the timestamp to match the first file, which often is
  also the last one to get removed. Also when lots of shared files
  are involved (such as in multilib installations), this can give
  several percents worth of speed gain as we dont unnecessarily rewrite
  the same contents over and over.
2012-08-17 14:07:05 +03:00
Panu Matilainen d6b925342f Blargh, more fdFree() braindamage
- Commit 429b933b42 fixes the fd-leak
  regression in rpm 4.10, but we already have code which relies
  on the new behavior and segfaults with the former one. Adjust
  rpmcpioClose() to the old behavior to get master tree back to
  working shape. TODO: fix this properly some rainy day (oh and see
  http://geekandpoke.typepad.com/geekandpoke/2012/08/likelihood.html)
2012-08-17 13:09:19 +03:00
Panu Matilainen 227654f30c Verify files from non-installed packages again (RhBug:826589)
- Verifying files against the originating, non-installed package can
  be useful sometimes, eg if rpmdb is broken or cannot be trusted.
  Of course such verification will give false positives on files that
  were intentionally skipped during installation (nodocs, wrong color,
  netshared...), that can't be helped.
- This restores the former behavior that was erroneously changed
  in commit adbd484372 while "fixing"
  an unhandled enumeration in the switch. Doh.
2012-08-07 12:28:56 +03:00
Panu Matilainen 4fbb58c7e6 Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc (RhBug:828784)
- As noted (but since then blissfully forgotten) in the commit message,
  commit e696b409fe broke --badreloc
  so its been broken since rpm >= 4.9.x :-/
- Transaction problem filter is only available during rpmtsRun() so
  we have no clue whether bad relocations should be filtered or not
  during rpmte creation. Instead of creating the problems at rpmteNew()
  time, remember any bad relocations that were found and check +
  create the actual problems (unless filtered) along with other
  problems during rpmtsRun().
- Passing an "allow bad relocations" flag to rpmtsAddInstallElement()
  would be a saner option but this is a back-portable way of handling it.
2012-08-07 09:52:15 +03:00
Panu Matilainen ecd9aceb56 Honor RPMSENSE_MISSINGOK flag in dependency checking
- For now there's no way to set this flag from packages so it doesn't
  actually do anything, but it doesn't hurt anything either, allows
  Suse & friends to drop one patch (greetings Michael :) and there
  are might be some things we could use this for internally.
2012-08-03 12:43:59 +03:00
Panu Matilainen 928386a317 Report config and missinok flags in deptype format extension too 2012-07-11 15:10:08 +03:00
Panu Matilainen 32a4e283a6 Recognize relative paths as such in --whatprovides query 2012-07-03 08:51:09 +03:00
Panu Matilainen 338f6e4cf7 Push payload file size limit checking into cpio code
- At the time when the file list is being processed, we dont yet
  have the slightest clue what kind of payload will be used for
  for the archive or what limits it might have. Let the cpio code
  handle its own limits checking, the build-side only needs to
  worry about whether 32bit uints are sufficient for storing the
  sizes in headers.
2012-07-02 17:11:00 +03:00
Panu Matilainen eefcb12b9c Cosmetics: remove redundant {} block, fixup indentation 2012-07-02 15:05:30 +03:00
Panu Matilainen bf3a14a866 Dont use mmap() for anything, axe the code instead
- Commit 4cb02aa928 asked to see
  what breaks when mmap() is used, now we know: large package support
  broke when enabling it. Could be fixed of course by eg adding
  a size cap to the fsm part as well, but just doesn't seem worth it:
  I fail to measure any meaningful performance improvement from mmap
  usage in either case, and added complexity for what is close to
  zero benefit just doesn't make sense... and various sources in fact
  note the rpm usage (read through the entire file sequentially) as one
  of the cases where mmap() is NOT beneficial due to mmap() high
  setup + teardown cost + page fault speed (or lack of thereof).
2012-07-02 15:02:11 +03:00
Phil Knirsch a7248ac1c9 Plain 32bit ppc cannot be a ppc64p7
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-06-28 10:15:59 +03:00
Panu Matilainen 3ffaef5afc Clarify/correct tag usage in rpmdbProvides()
- Refer to RPMTAG_* for rpmds tags, not RPMDBI_*. The values for these
  are the same, only the "intended use" differs (RPMDBI refers to
  rpmdb indexes) so this doesn't change anything in practise.
2012-06-27 11:10:57 +03:00
Panu Matilainen 2cb102f35e Fix obsoletes-thinko in rpmdbProvides()
- dbtag cannot possibly be on obsoletes here, we need to look at deptag
  instead. This thinko in commit 5f1ec21518
  renders that whole commit useless. Doh.
2012-06-27 11:08:25 +03:00
Panu Matilainen 7c8c36c334 Fall back to using fsync() on systems without fdatasync()
- While fdatasync() is widely available on modernish systems,
  OS X doesn't have it
2012-06-21 09:45:16 +03:00
Panu Matilainen 50b03d015e Restore basic debug output for fsm operations
- This is close to what we had in the stage-machine days, just to allow
  easily viewing whats going on inside the fsm (create/skip/etc)
2012-05-21 13:34:03 +03:00
Panu Matilainen 8d277bbba6 Explicitly differentate internal/exported file attributes
- RPMFILE_EXCLUDE only exists during spec parse, and doesn't "leak"
  into headers only because the file is, well, excluded to start with.
  Unexport the internal-only bit and explicitly strip out any excess
  bits from data going to header. The current 16/16 split is artificial
  of course, RPMTAG_FILEATTRS is 32bit so there's plenty of room
  for growing new file attributes, with internal-only adjustments
  required.
- Eliminate RPMFILE_UNPATCHED while at it, this is a leftover
  from Suse patch rpms which are no longer used anywhere.
2012-05-16 10:58:00 +03:00
Michael Schroeder bb335292d3 Small patch to reverse hardlink ordering
Hi Panu et al,

Here's a small patch that changes the ordering used for putting
hardlinked files into the cpio archive back to lexicographical.

You might wonder what this is about. Well, old rpm-3 (and
also old versions of rpm-4, I think) already used lexicographical
ordering for files and hardlinks. When deltarpm was created,
it made use of this fact when "compressing" the file order
of the cpio archive into the so-called "sequence". Deltarpm
can deal with "out of order" files, but in that case it needs
to reset the compression, which leads to really long sequence
strings.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-05-04 09:04:46 +03:00
Panu Matilainen 58c5eb28d5 Fall back to private db environment on system level EINVAL
- BDB wants to use mmap() for its environment by default, but not
  all (file)systems support this, as pointed out by Daniel Drak.
  However env->open() can return EINVAL for a number of reasons,
  require all the fallback reasons to be system level errors to
  differentiate from "logical" errors such as incompatible flags
  to (possibly pre-existing) db environment, in which case we better
  just error out.
2012-05-03 16:37:51 +03:00
Panu Matilainen d337924930 Eliminate rpmts usage from lower levels of fsm machinery
- The only remaining use for rpmts here was grabbing NODIGESTS
  from rpmtsFlags(). Pass the tiny little piece of information
  as an argument for the one place needing it and rip all the
  now unused related goo.
2012-04-24 15:52:41 +03:00
Panu Matilainen bf4b423fdf Only install needs selabel handle, dont bother elsewhere 2012-04-24 15:45:24 +03:00
Panu Matilainen 2eb24dcc20 Dont bother with fsm-level digest statistics
- Most of fsm doesnt need the actual transaction set for anything "real"
  and dragging it around as a mere statistics collector seems
  pretty dumb. If we want better statistics, we better come up with
  a saner way to gather them.
2012-04-24 15:36:15 +03:00
Panu Matilainen 4320b81251 Eliminate rpmts and rpmte kludgery from package building
- Package building has no associated transaction or ts members,
  this was all just fake-up kludgery to work around the way how
  fsm used to work. None of it relevant now, kill kill kill.
2012-04-24 14:28:03 +03:00
Panu Matilainen 2d563cefee Eliminate rpmte usage from lower levels of fsm machinery
- Determine the need for reverse iteration based on fsm goal
- Everything else was just using rpmte to get to its file states,
  eliminate the intermediate ping-pong by passign the file states
  around directly. Makes the thing that little bit less silly.
2012-04-24 14:16:21 +03:00
Panu Matilainen 7789f46e4c Move mode-specific flag setting out of fsmNew() 2012-04-24 14:01:46 +03:00
Panu Matilainen dc71b7ef15 Clean up file backup logic a bit
- Ghosts are never backed up, and the whole business is irrelevant
  for package building. Use fsm goal instead of rpmte mode to
  determine what to do, rpmte in build code is nothing but an ugly hack.
2012-04-24 13:48:11 +03:00
Panu Matilainen 015a34e0df Eliminate header and rpmte knowledge from rpmfs
- rpmfs is such a low-level construct it doesn't need to know anything
  about the upper layers. Gather the necessary bits of info in the
  sole caller instead and pass only whats needed to rpmfsNew() to
  enable creating a filestate item without having rpmte/header at hand,
  which we'll be needing in the fsm shortly.
2012-04-24 13:36:38 +03:00
Panu Matilainen 9f4186766c Bury build filestate setting inside fsm remains
- This whole thing probably isn't needed anymore, but for now just
  lift the FA_SKIP/FA_COPYOUT setting to rpmPackageFilesArchive(),
  allowing rpmfsSetAction() to become properly internal-only function.
- Trim out unnecessary now unnecessary librpm internal includes
  from librpmbuild code
2012-04-24 12:43:54 +03:00
Panu Matilainen 5dd61799ee Split out file state recording out of fsmMapPath()
- The file state that gets stored in the rpmdb has nothing to do with
  path and is only relevant for installs.
2012-04-24 11:55:37 +03:00
Michael Schroeder db28221a4a Add support for dpkg-style sorting of tilde in version/release
- This allows much nicer handling some common scenarios such as
  upstream pre-releases where the pre-release version would normally
  appear newer than final release, eg 1.0-rc1 vs 1.0. Previously this
  required mapping the pre-release tag into the release tag to achieve
  desired sorting, with tild this becomes simply 1.0~rc1 < 1.0.
- Add a rpmlib() tracking dependency to prevent older rpm versions
  from getting confused with packages relying on the new behavior.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-04-23 11:04:02 +03:00
Panu Matilainen 5f1ec21518 rpmdsMatchesDep() isn't correct on obsoletes
- Fix oversight in commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9:
  rpmdsMatchesDep() works on provides, but obsoletes are matched on
  package name so we want rpmdsNVRMatchesDep(). rpmdsMatchesDep()
  "worked" as the implicit self-provide is always at the 0 index
  on packages created by modern rpmbuild, but this isn't really
  guaranteed: very old V3 rpms can have something else at the
  first index, and ditto for non-rpmbuild created packages.
- Thanks to Michael Schroeder for pointing this out.
2012-04-20 09:31:17 +03:00
Panu Matilainen b45294ba68 Pay attention to NULL returns from rpmcpioOpen()
- The archive interface might actually want separate new + open,
  but for now just flag an internal error on NULL return on archive open.
2012-04-18 12:48:58 +03:00
Panu Matilainen 00db04cf2c Sanitize fsm creation/initialization and destruction
- Now that there are no more failing parts requiring return codes,
  change + rename fsmSetup() into a more regular fsmNew() construct,
  returning newly "instance" of fsm and similarly fsmTeardown() ->
  fsmFree() to free the thing.
- There's no real need to allocate this stuff on heap, but doing
  so makes life actually simpler for the three callers and makes the
  whole thing more consistent with common practises in the codebase.
2012-04-18 12:39:25 +03:00
Panu Matilainen df92175300 Split out hardlink checking from fsmTeardown()
- Checking missing links is only relevant for install, lift the
  code to separate function and call from the install-case only.
- Freeing data while checking seems like a dubious "optimization"
  but to keep changes minimal, leaving that as it is now.
2012-04-18 12:27:28 +03:00
Panu Matilainen de92cb7a43 Eliminate unused leftover rc member from fsm struct 2012-04-18 12:09:06 +03:00
Panu Matilainen 6e1b834928 Move cpio end trailer detection to the cpio code
- The fsm shouldn't know any archive format specifics, detect the trailer
  from rpmcpioHeaderRead() and signal EOF through CPIOERR_HDR_TRAILER
  instead.
2012-04-18 11:38:29 +03:00
Panu Matilainen 3c2be9072d Separate payload archive close and free
- When writing, archive finalization can write further data into
  the payload (eg cpio trailer). We need to be able to fish the
  final archive size *after* closing it, otherwise archive size
  will be off by trailer size.
- Add new rpmcpioFree() function which simpy frees the archive struct,
  calling rpmcpioClose() in the process if it wasn't already done.
- This also simplifies the error code gymnastics in fsm: we need to
  free the resources whether error or not, which rpmcpioFree() allows
  us to do. And for writers, calling rpmcpioClose() only needs to
  be done if earlier parts were successfull, so we dont need to worry
  about masking a former error code when calling it.
2012-04-18 10:30:11 +03:00
Panu Matilainen 6cb8e8b2ef Eliminate payload archive member from fsm struct
- Only install and build have an associated archive, and this can
  be just as well handled as a local variable, passing down as
  argument to the handful of places needing it.
- Error handling looks a bit fishy but that's not exactly new issue...
2012-04-17 20:10:10 +03:00
Panu Matilainen 189dec7ba9 Push fsm archive size down to the only caller who cares
- Archive size is only relevant for build code, no need for tracking
  this in the big struct. Just return the archiveSize at end of
  build process.
2012-04-17 19:18:28 +03:00
Panu Matilainen 00629aa636 Lose unnecessary cfd member from fsm, refcount through payload instead 2012-04-17 18:03:29 +03:00
Panu Matilainen f1d24281f5 Kill couple of useless "helper" functions
- Both are only ever called once and are so trivial that they're
  not helping anything at all
2012-04-17 17:36:47 +03:00
Panu Matilainen fa483f1762 Remove now unused psm argument to fsmSetup()
- Bah, should've been in commit 4ef540d25b
2012-04-17 17:21:02 +03:00
Panu Matilainen 28dc2eadfa Move mapping index + and related loop exits out of fsmInit()
- The mapping index is the same for build + erase, but different
  for install and so is the return code mapping. By doing this
  inline where the action is we avoid having to fiddle with
  mapped return codes for the exit case.
2012-04-17 17:08:49 +03:00
Panu Matilainen d852a56e17 Move the install-only payload reading to the install-only code
- Besides simplifying the common path everything takes, this removes
  the need to map error returns back and forth when we can just
  detect the end of payload directly in the loop and break out.
2012-04-17 16:55:46 +03:00
Panu Matilainen 9e73ca9fcc Split fsm state reset to a separate function
- No functional changes as such, but moving this out of fsmInit()
  permits other goal-specific items to be moved out of fsmInit()
2012-04-17 16:40:54 +03:00
Panu Matilainen 124db72a60 Zeroing out the fsm is common to all modes, move it to fsmSetup() 2012-04-17 16:30:43 +03:00
Panu Matilainen 380e19c62d Push dnl iterator init + free to the sole caller fsmMkdirs()
- There's zero need for the rest of the code to know or care about
  dnl iterator, just pass the file info- and state sets to
  fsmMkdirs() directly and hide the otherwise unused iterator
  business there.
2012-04-17 16:27:27 +03:00
Panu Matilainen 4cb9109d31 Inline what little is left of fsmCreate() into fsmSetup()
- Besides being a bizarre name for "some extra initialization" work,
  fsmCreate() was full of redundant goo, including a rather complex
  way of mapping a zero return back to zero in case it really was
  zero .. or something.
2012-04-17 16:15:33 +03:00
Panu Matilainen 577751c450 Move temporary install suffix creation to more logical place
- Only installation needs, so move it to rpmPackageFilesInstall()
2012-04-17 16:01:52 +03:00
Panu Matilainen 06badfc76e Move unowned directory creation to more logical place
- rpmPackageFilesInstall() is the only case where this needs to occur,
  move it there instead of yet-another goal-dependent piece where it has
  no business being in the strangely named fsmCreate()...
2012-04-17 15:47:20 +03:00
Panu Matilainen 5b40273785 Eliminate the pointless fsm NULL checking in fsmFsPath()
- There's just no damn way fsm can be NULL when this is called,
  a NULL fsm would've segfaulted miles earlier.
2012-04-17 15:40:00 +03:00
Panu Matilainen 17ae5675f2 Eliminate unused subdir argument from fsmFsPath() 2012-04-17 15:36:41 +03:00
Panu Matilainen f108c23176 fsmFsPath() only needs directory/something else not entire struct stat
- The less places we pass all the junk around, the easier its to
  follow, and in most places we already know whether its dir or not anyway.
2012-04-17 15:36:36 +03:00
Panu Matilainen 4ef540d25b Remove now unnecessary psm member from fsm struct
- Except for expandRegular(), all notification occurs from the three
  main worker functions. Pass as an argument for the lone special
  case, the other noticy already have the psm as their own argument.
2012-04-17 13:28:55 +03:00
Panu Matilainen fb51698e0c Remove redundant progress notification from fsmCommit()
- fsmCommit() does not advance the archive or anything else, so
  this was simply issuing the same exact notification that we
  just did from rpmPackageFilesInstall().
2012-04-17 13:25:59 +03:00
Panu Matilainen 05bde170d7 Clean up + improve file/directory removal error handling
- Only handle %missingok in the cases where it actually applies,
  and additionally handle missing %ghost which is not an error
  either. Dont log anything for these non-errors.
- Unify the error handling for files and directories, makes life
  simpler as they dont differ by that much.
- Log real failures as warnings instead of silencing them to debug
  spew, users will want to know if something that was supposed to
  be removed was not (say, a file with immutable attr set).
- Add comments for further work on this area.
2012-04-17 12:40:41 +03:00
Panu Matilainen a4d25c7ab2 Minimally fix file/directory removal
- In their previous life these breaks applied to a switch-case but
  now they end up aborting the loop on first successful removal, causing
  everything but the first file/directory of a package to be left behind
  on erase. Fixes the previously unnoticed regression from commit
  1845c1d711.
2012-04-17 11:04:22 +03:00
Phil Knirsch f9eedd7f69 - Add support for ppc64p7 architecture using new auxv parsing info
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-04-17 09:26:03 +03:00
Phil Knirsch 280494cce0 - Add general /proc/self/auxv parsing to rpmrc for better machine detection
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-04-17 09:25:53 +03:00
Panu Matilainen f5fdd5f9ca Axe unused leftover variable
- Should've been in commit cf10956481
2012-04-16 15:52:53 +03:00
Panu Matilainen 8e4c7a5615 Raise file conflicts on differing device node numbers
- For practical purposes, the "content" of a device node is its
  minor+major number, if those differ the files are very much
  not the same and thus cannot be shared.
2012-04-13 13:38:20 +03:00
Panu Matilainen cf10956481 Raise file conflicts on differing permissions (user, group, mode)
- Two files (or directories) cannot be correctly shared if their
  permissions differ, even if the content is identical: either
  file will end up having wrong permissions, depending on installation
  order. This means a package can among other things silently
  eg relax permissions of eg security sensitive directory (accidentally
  or intentionallY).
- We now require exact match of user, group and entire file mode
  (previously only the file type part of mode was tested)
2012-04-13 13:31:26 +03:00
Panu Matilainen 48c4ed1148 Check for file conflicts within package (RhBug:808750)
- Packages having file conflicts with itself may seem absurd, but
  directory symlinks (such as /lib being a symlink to /usr/lib)
  make this entirely possible. This makes us catch and abort early
  on these cases instead of silently overwriting the self-conflicting
  files, potentially with disastrous results.
2012-04-12 18:01:52 +03:00
Panu Matilainen a13e56cd87 Check for file conflicts within package (RhBug:808750)
- Packages having file conflicts with itself may seem absurd, but
  directory symlinks (such as /lib being a symlink to /usr/lib)
  make this entirely possible. This makes us catch and abort early
  on these cases instead of silently overwriting the self-conflicting
  files, potentially with disastrous results.
2012-04-12 17:54:08 +03:00
Panu Matilainen 7633410733 Change file disposition code to access rpmfi's by index
- The final pre-requisite to handling file conflicts within a package:
  with this we're no longer tied to the single index per rpmfi. This
  is not supposed to change anything yet unless I screwed something up.
  Also goes to show that a semi-iterator interface for something
  that really needs random access only gets in the way rather than
  helping...
2012-04-12 17:50:54 +03:00
Panu Matilainen 87e7e88f90 Change rpmfi replaced size functions to take index
- Further preliminaries to handle file conflicts within a package.
- These are internal-only interfaces so we can just change without
  bothering with compat wrappers.
2012-04-12 17:39:57 +03:00
Panu Matilainen 3f996a588a Add rpmfiFooIndex() variants for the conflict handling methods
- Preliminaries for handling file conflicts within a package:
  Using rpmfi's self-iterator limits access to the file info to
  one caller at a time, in order to self-file conflicts we'll need
  to be able to access the same rpmfi at different indexes simultaneously.
- As these are public API's, add compat wrappers for the self-iterator
  use (although AFAIK nothing except rpm itself uses these)
2012-04-12 17:39:32 +03:00
Panu Matilainen fbe424f202 Further tweak the config file removal/backup logic to make it clearer
- Turn the strange negated condition around: when dealing with
  config files test for it directly. This way, all the special
  cases are handled first and normal cases fall through the if-jungle
  to exactly one case of rpmfsSetAction(fs, i, FA_ERASE). Makes
  the logic more obvious, at least to me.
2012-04-12 17:27:24 +03:00
Panu Matilainen b013a139d2 Avoid unnecessary calls to rpmfiFN()
- handleOverlappedFiles() only needs the file name in a couple
  of relatively rare special cases. Constructing the fn more
  expensive than other rpmfi-calls, dont bother unless actually needed.
2012-04-12 17:00:33 +03:00
Panu Matilainen a359292046 Make config file modification detection a bit more readable 2012-04-12 16:28:43 +03:00
Panu Matilainen 11116a6786 Make rpmfiFNIndex() safe for callers on different indexes
- Previously this would return a pointer to an internal per-rpmfi buffer
  whose contents get silently overwritten on each call to rpmfiFNIndex(),
  making it unsafe for unsafe for random access for more than one
  active caller (such code does not currently exist in rpm though)
- Make rpmfiFNIndex() always return freshly allocated memory, and adjust
  the rpmfiFN() iteration wrapper to free and realloc the internal
  "buffer" on each call. It's a wee bit slower than before but it's
  not called *that* much, and if needed there are ways to optimize it.
2012-04-12 15:29:18 +03:00
Panu Matilainen 8106e7e89c Handle obsolete matches (more) correctly in rpmal
- Similar to commit 9fb81eac0b but
  on the to-be-installed set: obsoletes should only be matched against
  package names, not any provide or file names. Hasn't really mattered
  previously due to the way its called, but since commit
  05487d9a3f I guess it started to matter.
  It's more correct this way anyhow, and should fix RhBug:810077.
- Since rpmal only knows about provides, we need to handle obsoletes
  as a special case and filter out matches on provide names different
  than the matching package name.
2012-04-05 11:43:58 +03:00
Panu Matilainen b9c96a9fa9 Remove unused scareFlags member from rpmfi struct
- This is just a leftover from rpm < 4.7.x days
2012-04-04 17:30:04 +03:00
Panu Matilainen 6fc6b45bf9 Validate negated offsets too in headerVerifyInfo()
- Undo the ancient broken fix for RhBug:71996 from commit
  9e06e3b8ca76ae55eaf2c4e37ba9cac729789014: instead of disabling
  the check, pass in the correct upper range which is entirely
  different from everything else for the region trailer tag.
- Fixes CVE-2012-0815
2012-04-03 15:47:44 +03:00
Panu Matilainen f239982519 Differentiate between non-existent and invalid region tag
- Non-existent region tag is very different from existing but invalid
  one - the former is not an error but the latter one is, and needs
  to be handled as such. Previously an invalid region tag would cause
  us to treat it like rpm v3 package on entry, skipping all the region
  sanity checks and then crashing and burning later on when the immutable
  tag is fetched.
- Refer to REGION_TAG_TYPE instead of RPM_BIN_TYPE wrt the expected
  type of region tag for consistency and clarity, they are the same
  exact thing though.
- Should unify these damn copy-slop check one of these days, sigh...
  For now, settling for the easily backportable approach.
- Fixes the other half of CVE-2012-0060
2012-04-03 15:46:42 +03:00