Commit Graph

11972 Commits

Author SHA1 Message Date
Panu Matilainen 3ff6fdd688 Hide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight for now
- In the package/transaction related things the strpool is more of
  an internal implementation detail than an end-goal in itself, move
  string pool related interfaces of rpmts, rpmfi and rpmds to
  internal-only APIs for now. The kind interfaces we'll want to eventually
  export a) dont exist yet and b) are likely to be something very different.
- The string pool itself remains exported however, its a handy data
  structure for all sorts of things and both librpm and librpmbuild
  heavily use it already.
2012-11-01 09:59:57 +02:00
Panu Matilainen 5ecfdcea4e Use private NSS context if NSS supports it (RhBug:871485)
- Older NSS versions operate on global context, which can cause
  all sorts of trouble when an API user tries to use NSS for their
  own purposes: eg they might want to use NSS databases which is not
  possible once we've initialized NSS with NSS_NoDB_Init(). Further
  background on the subject at https://wiki.mozilla.org/NSS_Library_Init
- Use private private NSS context when possible (NSS >= 3.12.5) to
  avoid such clashes, but keep support for older versions for now.
2012-10-31 09:43:38 +02:00
Panu Matilainen eb23d21b3d Handle EINTR in Fread() and Fwrite()
- Not all systems automatically restart signal-interrupted operations,
  handle this centrally since its so easy to do. Also related to
  RhBug:580974.
2012-10-30 12:43:12 +02:00
Panu Matilainen cbd6ef58bb Handle partial reads and errors in package IO (RhBug:802839, RhBug:580974)
- There are no guarantees Fread() will return all of the requested size:
  it can return partial data eg on signals and pipe descriptors. Introduce
  a helper function to handle this centrally for all package read IO,
  effectively reintroducing timedRead() but without the caveats:
  timedRead() did not work on compressed streams, did not handle
  eg EINTR correctly and while really being an internal helper,
  was exported in the API.
2012-10-30 11:36:56 +02:00
Panu Matilainen 0b9c93ed18 Fix missing error on --import on bogus key file (RhBug:869667)
- When the "BEGIN PGP" marker is not found at all, we would silently
  exit with success when trying to import utter garbage, such as
  rpmkeys --import /bin/bash (not that I consider bash as gargabe ;)
2012-10-30 09:29:46 +02:00
Panu Matilainen 6db697526b Remove transition-time leftover pool unfreezing
- Nobody is freezing our pool so there's no need to unfreeze it either...
2012-10-26 12:16:01 +03:00
Panu Matilainen 3ff1f73efe Eliminate static "misc stuff pool" from rpmfi
- Prior to string pool existence, the static "caches" were kinda
  necessary for sharing the relatively static content of user/group
  names and file languages, but this is nothing but an unfreeable
  block of memory at this point. Just use the same pool as everything
  else - whether private or shared.
2012-10-26 11:47:31 +03:00
Panu Matilainen c137e36e62 Eliminate copy-paste nibble(), use rnibble() instead 2012-10-19 16:20:02 +03:00
Panu Matilainen 0660fe9442 Default to NSS crypto though...
- NSS is a big and quirky monster for our needs but that's what we've
  been defaulting to for the last years, and then there are those
  certifications...
- Also default to external beecrypt even if --with-beecrypt is used
2012-10-19 15:45:14 +03:00
Michael Schroeder 98e7823089 Add support for beecrypt as an alternative crypto implementation
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-10-19 15:43:09 +03:00
Panu Matilainen e137d28d10 Dont bother with digest and link comparisons if size differs, part II
- If link or regular file sizes differ, they cannot possibly be
  identical. Saves us from doing bunch of pointless string and
  memory comparisons on what's a very busy path - not exactly a huge
  with but measurable nevertheless.
2012-10-19 14:36:36 +03:00
Panu Matilainen 5811588f67 Dont bother with %config digests on conflicts if size differs
- Files of different size cannot possibly be identical, dont bother
  with expensive digest calculation.
2012-10-19 13:45:04 +03:00
Panu Matilainen 90dd517432 Fix noarch __isa_* macro filter in installplatform (RhBug:865436)
- The filter wasn't doing what it was supposed to due to extra single
  quotes getting inserted, causing "rpmbuild --target noarch foo.spec"
  to whine about empty macro bodies. This is a regression introduced
  in rpm 4.10, commit 07ec480c18 to be
  precise.
2012-10-11 17:57:10 +03:00
Panu Matilainen d763c09e28 Eliminate now unnecessary WITH_SELINUX conditionals in sepolicy plugin 2012-10-11 15:14:48 +03:00
Panu Matilainen f9ff6e7234 Only try compiling sepolicy plugin if selinux is enabled 2012-10-11 15:14:48 +03:00
Panu Matilainen e3ed69591f Missing include in string pool
- When compiled without selinux support, stdlib.h doesn't get
  included here. Wtf?
2012-10-11 15:14:48 +03:00
Florian Festi 44d0e024c8 Revert "Update man page to reflect that rpm no longer uses MD5 as a default digest algorithm"
This reverts commit b040b323d6.

The change does only affect file digests.
2012-10-11 12:20:06 +02:00
Florian Festi 5a674fba65 Add rpm --setperms and rpm --setugids to the man page 2012-10-10 14:59:32 +02:00
Florian Festi b040b323d6 Update man page to reflect that rpm no longer uses MD5 as a default digest algorithm 2012-10-10 13:25:54 +02:00
Anders F Bjorklund ac959fed00 Add lua 5.2 support.
Add compatibility support for both lua-5.1 and lua-5.2,
assuming that the LUA_COMPAT might have been disabled.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-10-09 08:28:52 +03:00
Panu Matilainen 389b1ab706 Don't bother calculating digests of %ghost %config files
- Calculating digest of %ghost config is useless as there's nothing
  to compare the result to. Also we never take backups of %ghost
  configuration anyway, so this is a total waste of time. One common
  case of %ghost %config is the rpmdb (environment and all) which
  can be rather large and calculating digests can take several seconds,
  only for the results to be thrown away unused.
- There are some cases where it might be reasonable to back up %ghost
  %config (eg if it gets replaced by non-config), but
  rpmfiConfigConflictIndex() doesn't have sufficient context to figure
  that out. For now, preserve the traditional simple rule: no backups
  for ghosts, ever.
2012-10-08 09:38:57 +03:00
Panu Matilainen e17bf0449d Use rpmal lookups for already added obsoletions too
- Related to commit bee348b5d1,
  use the newly added obsoletes hash to lookup already added
  obsoleters. Eliminates the dumb linear lookup and is unsurprisingly
  a whole lot faster on larger transactions.
2012-10-05 11:38:26 +03:00
Panu Matilainen 15f9f2d7f0 Add a hash + lookup function on obsoletes to rpmal
- Similar lazily created hash as provides for fast obsoletes lookups.
  This is so similar the provides that creation etc functions should
  be unified, but leaving that exercise till later.
2012-10-05 11:35:11 +03:00
Panu Matilainen 99d42b479a Rename rpmalProvidesHash to rpmalDepHash
- The same hash type is valid for any ds and we'll be adding more...
2012-10-05 11:34:22 +03:00
Panu Matilainen 2d62d5e5c5 Avoid changing the file info sets when adding to rpmal file hash
- Use indexed access to the file info sets so we're not mucking
  around with somebody elses rpmfi iterator index (currently not an
  issue but still...)
2012-10-05 11:25:49 +03:00
Panu Matilainen 7612b1684a Avoid changing the dependency sets when looking up from rpmal
- Use indexed access and comparison to avoid mucking around with
  eg transaction element dependency sets while the callers are walking
  over them.
2012-10-05 10:16:44 +03:00
Panu Matilainen f4bb2487d4 Avoid changing the dependency sets when adding to rpmal hash
- Use indexed access to the dependencies so we're not mucking with
  the rpmds iterator index behind anybodys back, this could affect
  all sorts of things but miraculously nothing is hitting it atm...
2012-10-05 10:13:09 +03:00
Panu Matilainen db80e6ed5a Guard against NULL ds in the rpmds indexed getters
- NULL dependency sets are all over the place as NULL ds means
  "no dependencies of this kind", whereas for eg rpmfi NULL is an
  error.
2012-10-05 10:09:50 +03:00
Panu Matilainen f4758b1920 Export the indexed rpmds accessors internally
- Add an internal header for rpmds too to allow adding interfaces we
  dont necessarily want to export in the public API, make the indexed
  accessors available internally.
2012-10-05 10:07:52 +03:00
Panu Matilainen 62ddd3149f Add indexed access variants for rpmdsColor() and rpmdsCompare()
- Various places in rpm need random access to the dependency sets,
  save and restore on somebody elses "iterator index" just doesn't
  cut it. This is merely preliminaries for further changes.
2012-10-05 10:07:14 +03:00
Panu Matilainen d5dd3abe09 Be as lazy as possible wrt rpmal hash creation
- Separate provides and files hash creation, delay both until the last
  moment before first valid lookup. In practise, this means the provides
  hash is created early due to lookups from rpmtsAddInstallElement(),
  but the big bad file hash creation is delayed until the entire
  transaction set has been more-or-less populated. Which means we have
  a better idea about the necessary hash table size, meaning fewer
  hash resizes, resulting in good deal faster execution with no
  downsides - if something happened to trigger an early file lookup
  it'll all still work, just slower.
2012-10-04 15:57:58 +03:00
Panu Matilainen bee348b5d1 Use rpmal lookups for finding redundancies in the added set
- Replace the dumb linear search across all elements on each
  addition with (filtered) rpmal lookups where possible. rpmal
  doesn't (yet) have obsoletes information so for already added
  obsoletions we have no choice but to walk the walk.
- As a result, findPos() is hugely faster for large transactions
  but rpmal hashes are now generated on the fly for everything
  instead of doing it all at once before the actual dependency
  checks / ordering, which will cost us something in terms of
  hash table resizes.
2012-10-02 16:40:45 +03:00
Panu Matilainen 5d3018c4ed Dont bother with rpmRelocateFileList() if relocations have been specified
- rpmRelocateFileList() doesn't modify anything when no relocations
  are to be done, but what it does is not exactly free, unnecessarily
  calling it is dumb.
2012-10-02 16:17:05 +03:00
Panu Matilainen 03b660c615 Only return non-NULL from rpmalAllSatisfiesDepends() on real matches
- The provides hash lookup can and does return hits that dont actually
  satisfy the dependency. Dont bother callers with apparent hits
  (ie non-NULL returns) when nothing actually matches the dependency.
2012-10-02 12:15:49 +03:00
Panu Matilainen b900c06b99 Export rpmalAllSatisfiesDepend() internally (again)
- For some uses, we need to be more selective about providers...
2012-10-02 10:50:10 +03:00
Panu Matilainen 50b0000b07 Pass the newly create ts element instead of header to findPos()
- Avoids a little bit of extra work, we already have the relevant
  bits of information in the rpmte and grabbing them from there is
  cheaper than looking up stuff from headers. Also avoids creating
  another copy of the new elements obsoletes dependency set unnecessarily.
2012-10-02 10:37:36 +03:00
Panu Matilainen e9054c9880 Eliminate all the now unnecessary fsm->ix save-and-restores
- Now that the relevant places are accepting file index as argument,
  we no longer need to save and restore fsm->ix in all the places
  dealing with hard links.
2012-10-01 13:19:59 +03:00
Panu Matilainen f71af8b4a1 Pass file index as argument to fsm fsmMapPath()
- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)
2012-10-01 13:15:30 +03:00
Panu Matilainen 596617533b Pass file index as argument to fsm fsmCommit()
- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)
2012-10-01 13:01:33 +03:00
Panu Matilainen e7d4d6b3dc Pass file index as argument to fsm writeFile()
- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)
2012-10-01 12:55:21 +03:00
Panu Matilainen 57ea65e430 Eliminate current hardlink set from fsm struct
- Return the hard link set from saveHardLink() when ready into a local
  variable in the only place that cares: rpmPackageFilesInstall().
  Another pointless and hard-to-follow fsm-global state variable
  gone...
2012-10-01 12:30:28 +03:00
Panu Matilainen f5504e130a Pinpoint the one place where fsm->li is modified on real purpose
- saveHardLinks() is the only place where fsm->li value matters on
  return: during installation its used for "returning" the current
  link set when all the links in that set have been seen so they
  are ready for creating.
2012-10-01 12:16:18 +03:00
Panu Matilainen ae773c7926 Avoid using fsm->li directly when creating pending hard links
- fsmMakeLinks() operates on the current link at hand, doesn't walk
  the links or anything... pass the link as an argument from the sole
  caller and operate on that.
2012-10-01 12:08:27 +03:00
Panu Matilainen 676878e5b5 Avoid using/modifying fsm->li when committing hardlinks
- Using a "global" variable for local... more of the same:
  fsmCommitLinks() gets called at the end of each round of the install
  loop if there are links, it does the actual link discovery on its
  own and fsm->li state will get rewritten by saveHardLink() at the
  start of the next round.
2012-10-01 11:53:48 +03:00
Panu Matilainen 364f580854 Avoid using/modifying fsm->li when writing links to payload
- Using a "global" variable for local iteration is just... this gets
  called once at the end of package build, fsm->li carries no
  global state here.
2012-10-01 11:47:29 +03:00
Panu Matilainen f08b8105fa Avoid using/modifying fsm->li when freeing hard link sets
- Using a "global" variable for local iteration is...
2012-10-01 11:39:47 +03:00
Panu Matilainen b746dbc136 Avoid using/modifying fsm->li on hard link checking
- Using a "global" variable for local iteration is just dumb...
2012-10-01 11:37:01 +03:00
Panu Matilainen aa2117b94e Move hardlink saving out of fsmInit()
- Now that we have separate functions for install, erase and build,
  handle the hardlink saving locally where it matters.
2012-10-01 11:33:08 +03:00
Panu Matilainen afb91f205b Free hardlink sets centrally in fsmFree()
- Having three places doing the same thing doesn't make a whole
  lotta sense...
2012-10-01 09:54:35 +03:00
Panu Matilainen eeea54c76b Filter out skipped files on hardlink checking
- Legitimately skipped files (links) must not cause install-errors.
  This has always been broken, but the errors were completely ignored
  on install prior to rpm 4.10, and now that we're only creating the
  first instance of a shared file, secondary arch multilib packages
  with hardlinks were causing install failures because of the "missing"
  hardlinks here.
- The relevant part here is obviously the XFA_SKIPPING() test, for
  which we need the file states. To keep the lines short, grab the
  index to a helper variable and replace other fsm->li->filex[i] uses
  with that too.
2012-10-01 09:35:39 +03:00