platform/upstream/rpm.git
12 years agoDont bother with fsm-level digest statistics
Panu Matilainen [Tue, 24 Apr 2012 12:33:40 +0000 (15:33 +0300)]
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.

12 years agoEliminate rpmts and rpmte kludgery from package building
Panu Matilainen [Tue, 24 Apr 2012 11:28:03 +0000 (14:28 +0300)]
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.

12 years agoEliminate rpmte usage from lower levels of fsm machinery
Panu Matilainen [Tue, 24 Apr 2012 11:16:21 +0000 (14:16 +0300)]
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.

12 years agoMove mode-specific flag setting out of fsmNew()
Panu Matilainen [Tue, 24 Apr 2012 11:01:46 +0000 (14:01 +0300)]
Move mode-specific flag setting out of fsmNew()

12 years agoClean up file backup logic a bit
Panu Matilainen [Tue, 24 Apr 2012 10:48:11 +0000 (13:48 +0300)]
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.

12 years agoEliminate header and rpmte knowledge from rpmfs
Panu Matilainen [Tue, 24 Apr 2012 10:36:38 +0000 (13:36 +0300)]
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.

12 years agoBury build filestate setting inside fsm remains
Panu Matilainen [Tue, 24 Apr 2012 09:36:26 +0000 (12:36 +0300)]
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

12 years agoSplit out file state recording out of fsmMapPath()
Panu Matilainen [Tue, 24 Apr 2012 08:55:37 +0000 (11:55 +0300)]
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.

12 years agoFix quoting in brp-python-hardlink (patch from Jon Nelson)
Panu Matilainen [Mon, 23 Apr 2012 12:35:29 +0000 (15:35 +0300)]
Fix quoting in brp-python-hardlink (patch from Jon Nelson)

12 years agoAdd a few basic test-cases for tilde in version comparison
Panu Matilainen [Mon, 23 Apr 2012 08:16:04 +0000 (11:16 +0300)]
Add a few basic test-cases for tilde in version comparison

12 years agoAdd support for dpkg-style sorting of tilde in version/release
Michael Schroeder [Mon, 23 Apr 2012 08:04:02 +0000 (11:04 +0300)]
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>
12 years agoAdd further version comparison test-cases
Panu Matilainen [Fri, 20 Apr 2012 10:29:21 +0000 (13:29 +0300)]
Add further version comparison test-cases

- Add pile of further tests for the more common constructs,
  collect various (old and new) corner cases from bugzilla.

12 years agorpmdsMatchesDep() isn't correct on obsoletes
Panu Matilainen [Fri, 20 Apr 2012 06:31:17 +0000 (09:31 +0300)]
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.

12 years agoPay attention to NULL returns from rpmcpioOpen()
Panu Matilainen [Wed, 18 Apr 2012 09:48:58 +0000 (12:48 +0300)]
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.

12 years agoSanitize fsm creation/initialization and destruction
Panu Matilainen [Wed, 18 Apr 2012 09:34:45 +0000 (12:34 +0300)]
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.

12 years agoSplit out hardlink checking from fsmTeardown()
Panu Matilainen [Wed, 18 Apr 2012 09:18:35 +0000 (12:18 +0300)]
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.

12 years agoEliminate unused leftover rc member from fsm struct
Panu Matilainen [Wed, 18 Apr 2012 09:09:06 +0000 (12:09 +0300)]
Eliminate unused leftover rc member from fsm struct

12 years agoMove cpio end trailer detection to the cpio code
Panu Matilainen [Wed, 18 Apr 2012 08:38:29 +0000 (11:38 +0300)]
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.

12 years agoSeparate payload archive close and free
Panu Matilainen [Wed, 18 Apr 2012 07:30:11 +0000 (10:30 +0300)]
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.

12 years agoAlways return NULL from fdFree()
Panu Matilainen [Wed, 18 Apr 2012 07:09:01 +0000 (10:09 +0300)]
Always return NULL from fdFree()

- Up to now, if the fd had remaining references fdFree() would return
  the supposedly free'd fd back to us, which is unlike anything else
  in rpm. Make this consistent with the rest of rpm finally as the
  last remaining caller requiring the old semantics is gone from
  the codebase (somewhere between 4.9 and 4.10): always return NULL,
  as the referenced instance is now gone as far as the caller is concerned.

12 years agoEliminate payload archive member from fsm struct
Panu Matilainen [Tue, 17 Apr 2012 17:10:10 +0000 (20:10 +0300)]
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...

12 years agoPush fsm archive size down to the only caller who cares
Panu Matilainen [Tue, 17 Apr 2012 16:18:28 +0000 (19:18 +0300)]
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.

12 years agoLose unnecessary cfd member from fsm, refcount through payload instead
Panu Matilainen [Tue, 17 Apr 2012 15:03:29 +0000 (18:03 +0300)]
Lose unnecessary cfd member from fsm, refcount through payload instead

12 years agoKill couple of useless "helper" functions
Panu Matilainen [Tue, 17 Apr 2012 14:36:47 +0000 (17:36 +0300)]
Kill couple of useless "helper" functions

- Both are only ever called once and are so trivial that they're
  not helping anything at all

12 years agoRemove now unused psm argument to fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 14:21:02 +0000 (17:21 +0300)]
Remove now unused psm argument to fsmSetup()

- Bah, should've been in commit 4ef540d25bab77b46cbf4467c8f6bc22cdd0e419

12 years agoMove mapping index + and related loop exits out of fsmInit()
Panu Matilainen [Tue, 17 Apr 2012 14:08:49 +0000 (17:08 +0300)]
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.

12 years agoMove the install-only payload reading to the install-only code
Panu Matilainen [Tue, 17 Apr 2012 13:53:12 +0000 (16:53 +0300)]
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.

12 years agoSplit fsm state reset to a separate function
Panu Matilainen [Tue, 17 Apr 2012 13:40:54 +0000 (16:40 +0300)]
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()

12 years agoZeroing out the fsm is common to all modes, move it to fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 13:30:43 +0000 (16:30 +0300)]
Zeroing out the fsm is common to all modes, move it to fsmSetup()

12 years agoPush dnl iterator init + free to the sole caller fsmMkdirs()
Panu Matilainen [Tue, 17 Apr 2012 13:27:27 +0000 (16:27 +0300)]
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.

12 years agoInline what little is left of fsmCreate() into fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 13:15:33 +0000 (16:15 +0300)]
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.

12 years agoMove temporary install suffix creation to more logical place
Panu Matilainen [Tue, 17 Apr 2012 13:01:52 +0000 (16:01 +0300)]
Move temporary install suffix creation to more logical place

- Only installation needs, so move it to rpmPackageFilesInstall()

12 years agoMove unowned directory creation to more logical place
Panu Matilainen [Tue, 17 Apr 2012 12:47:20 +0000 (15:47 +0300)]
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()...

12 years agoEliminate the pointless fsm NULL checking in fsmFsPath()
Panu Matilainen [Tue, 17 Apr 2012 12:37:53 +0000 (15:37 +0300)]
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.

12 years agoEliminate unused subdir argument from fsmFsPath()
Panu Matilainen [Tue, 17 Apr 2012 12:04:39 +0000 (15:04 +0300)]
Eliminate unused subdir argument from fsmFsPath()

12 years agofsmFsPath() only needs directory/something else not entire struct stat
Panu Matilainen [Tue, 17 Apr 2012 11:09:07 +0000 (14:09 +0300)]
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.

12 years agoRemove now unnecessary psm member from fsm struct
Panu Matilainen [Tue, 17 Apr 2012 10:28:55 +0000 (13:28 +0300)]
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.

12 years agoRemove redundant progress notification from fsmCommit()
Panu Matilainen [Tue, 17 Apr 2012 10:25:59 +0000 (13:25 +0300)]
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().

12 years agoClean up + improve file/directory removal error handling
Panu Matilainen [Tue, 17 Apr 2012 09:40:41 +0000 (12:40 +0300)]
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.

12 years agoMinimally fix file/directory removal
Panu Matilainen [Tue, 17 Apr 2012 07:49:26 +0000 (10:49 +0300)]
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
  1845c1d711b88723e596c88e8a7730a360029089.

12 years ago- Add support for ppc64p7 architecture using new auxv parsing info
Phil Knirsch [Mon, 16 Apr 2012 17:05:18 +0000 (19:05 +0200)]
- Add support for ppc64p7 architecture using new auxv parsing info

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years ago- Add general /proc/self/auxv parsing to rpmrc for better machine detection
Phil Knirsch [Mon, 16 Apr 2012 17:02:34 +0000 (19:02 +0200)]
- Add general /proc/self/auxv parsing to rpmrc for better machine detection

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoUse a bit more complicated test for the install/remove file verification
Panu Matilainen [Tue, 17 Apr 2012 05:25:26 +0000 (08:25 +0300)]
Use a bit more complicated test for the install/remove file verification

- Previous test only used a single file and no package-specific
  directories, now we have multiple files and multiple directories,
  some owned by the package and some not.
- This test fails right now due to previously unnoticed regression
  in commit 1845c1d711b88723e596c88e8a7730a360029089

12 years agoAxe unused leftover variable
Panu Matilainen [Mon, 16 Apr 2012 12:52:30 +0000 (15:52 +0300)]
Axe unused leftover variable

- Should've been in commit cf1095648194104a81a58abead05974a5bfa3b9a

12 years agoDocument --obsoletes in manual (RhBug:809402)
Panu Matilainen [Mon, 16 Apr 2012 12:50:27 +0000 (15:50 +0300)]
Document --obsoletes in manual (RhBug:809402)

12 years agoAdd test-cases for identical basenames within package
Panu Matilainen [Mon, 16 Apr 2012 11:14:37 +0000 (14:14 +0300)]
Add test-cases for identical basenames within package

- One test for the normal situation where identical basenames are
  not a problem, and another one where this causes a self-conflict
  because of a directory symlink.

12 years agoRaise file conflicts on differing device node numbers
Panu Matilainen [Fri, 13 Apr 2012 10:38:20 +0000 (13:38 +0300)]
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.

12 years agoRaise file conflicts on differing permissions (user, group, mode)
Panu Matilainen [Fri, 13 Apr 2012 10:16:51 +0000 (13:16 +0300)]
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)

12 years agoCheck for file conflicts within package (RhBug:808750)
Panu Matilainen [Thu, 12 Apr 2012 15:01:52 +0000 (18:01 +0300)]
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.

12 years agoCheck for file conflicts within package (RhBug:808750)
Panu Matilainen [Tue, 3 Apr 2012 03:11:11 +0000 (06:11 +0300)]
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.

12 years agoChange file disposition code to access rpmfi's by index
Panu Matilainen [Thu, 12 Apr 2012 14:50:54 +0000 (17:50 +0300)]
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...

12 years agoChange rpmfi replaced size functions to take index
Panu Matilainen [Thu, 12 Apr 2012 14:39:57 +0000 (17:39 +0300)]
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.

12 years agoAdd rpmfiFooIndex() variants for the conflict handling methods
Panu Matilainen [Thu, 12 Apr 2012 14:39:32 +0000 (17:39 +0300)]
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)

12 years agoFurther tweak the config file removal/backup logic to make it clearer
Panu Matilainen [Thu, 12 Apr 2012 14:27:24 +0000 (17:27 +0300)]
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.

12 years agoAvoid unnecessary calls to rpmfiFN()
Panu Matilainen [Thu, 12 Apr 2012 13:59:07 +0000 (16:59 +0300)]
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.

12 years agoMake config file modification detection a bit more readable
Panu Matilainen [Thu, 12 Apr 2012 13:27:08 +0000 (16:27 +0300)]
Make config file modification detection a bit more readable

12 years agoMake rpmfiFNIndex() safe for callers on different indexes
Panu Matilainen [Thu, 12 Apr 2012 12:15:26 +0000 (15:15 +0300)]
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.

12 years agoOops, automake isn't happy with comment here...
Panu Matilainen [Thu, 5 Apr 2012 13:57:29 +0000 (16:57 +0300)]
Oops, automake isn't happy with comment here...

12 years agoArrange unified /bin <-> $(bindir) in test-suite root
Panu Matilainen [Thu, 5 Apr 2012 11:21:27 +0000 (14:21 +0300)]
Arrange unified /bin <-> $(bindir) in test-suite root

- Rpm traditionally insists on putting itself into /bin and expects
  to find various things, especially /bin/sh there as well. This
  is normally the case, but on systems where the host /bin is symlink
  to eg /usr/bin, the test-suite /bin will be empty except for rpm
  itself causing a big number of bogus test-suite failures. Making
  test-suite root bin/ always a symlink to $(bindir) avoids this issue
  and works whether the host /bin is a real directory or not.

12 years agoFix test-suite root population wrt "optional" directories
Panu Matilainen [Thu, 5 Apr 2012 10:27:51 +0000 (13:27 +0300)]
Fix test-suite root population wrt "optional" directories

- /proc, /sys and especially selinux directories are mostly Linux
  creatures and even those vary between versions. Use if to avoid
  the error code "leaking" in case the last directory is not present.

12 years agoHandle obsolete matches (more) correctly in rpmal
Panu Matilainen [Thu, 5 Apr 2012 08:32:38 +0000 (11:32 +0300)]
Handle obsolete matches (more) correctly in rpmal

- Similar to commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9 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
  05487d9a3f763cfed5f5ca75b4fbadb62f38dfd6 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.

12 years agoRemove unused scareFlags member from rpmfi struct
Panu Matilainen [Wed, 4 Apr 2012 14:30:04 +0000 (17:30 +0300)]
Remove unused scareFlags member from rpmfi struct

- This is just a leftover from rpm < 4.7.x days

12 years agoValidate negated offsets too in headerVerifyInfo()
Panu Matilainen [Tue, 14 Feb 2012 09:27:46 +0000 (11:27 +0200)]
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

12 years agoDifferentiate between non-existent and invalid region tag
Panu Matilainen [Wed, 18 Jan 2012 08:56:35 +0000 (10:56 +0200)]
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

12 years agoSpecifically validate region tag on header import
Panu Matilainen [Thu, 19 Jan 2012 06:25:15 +0000 (08:25 +0200)]
Specifically validate region tag on header import

- Region tags need to have very specific content, the generic
  header tag checks are not sufficient to ensure sanity. Verify
  the tag is one of the known region tags and that the entry has
  expected type and count.
- Fixes the first half of CVE-2012-0060

12 years agoFix gpg-pubkey typos in Japanese manual (RhBug:760552)
Panu Matilainen [Tue, 3 Apr 2012 03:58:30 +0000 (06:58 +0300)]
Fix gpg-pubkey typos in Japanese manual (RhBug:760552)

12 years agoMove internal stuff from fsm.h to fsm.c
Florian Festi [Fri, 30 Mar 2012 12:56:33 +0000 (14:56 +0200)]
Move internal stuff from fsm.h to fsm.c
Reduce fileStage to the three "goal" stages

12 years agoReplace fileStageString() with the __func__ macros in the debugging code
Florian Festi [Fri, 30 Mar 2012 12:51:52 +0000 (14:51 +0200)]
Replace fileStageString() with the __func__ macros in the debugging code
Remove fileStageString()

12 years agoRemove checks for FSM_SYSCALL as FSM_* is going to go away
Florian Festi [Fri, 30 Mar 2012 12:43:43 +0000 (14:43 +0200)]
Remove checks for FSM_SYSCALL as FSM_* is going to go away

12 years agoDrop no longer needed include of fsm.h
Florian Festi [Fri, 30 Mar 2012 12:27:51 +0000 (14:27 +0200)]
Drop no longer needed include of fsm.h

12 years agoKill FSM: Remove remains
Florian Festi [Thu, 29 Mar 2012 13:49:51 +0000 (15:49 +0200)]
Kill FSM: Remove remains

12 years agoKill FSM: Make FSM_PKGBUILD a function
Florian Festi [Thu, 29 Mar 2012 13:49:11 +0000 (15:49 +0200)]
Kill FSM: Make FSM_PKGBUILD a function

12 years agoKill FSM: Make FSM_PKGERASE a function
Florian Festi [Thu, 29 Mar 2012 13:47:41 +0000 (15:47 +0200)]
Kill FSM: Make FSM_PKGERASE a function

12 years agoKill FSM: Make FSM_PKGINSTALL a function
Florian Festi [Thu, 29 Mar 2012 13:44:40 +0000 (15:44 +0200)]
Kill FSM: Make FSM_PKGINSTALL a function

12 years agoPrepare for killing the fsm: Move initial call to FSM from fsmSetup to rpmfsmRun...
Florian Festi [Thu, 29 Mar 2012 12:15:16 +0000 (14:15 +0200)]
Prepare for killing the fsm: Move initial call to FSM from fsmSetup to rpmfsmRun. Make fsm FSM_t.

12 years agoPrepare for killing the fsm: Inline FSM_UNDO; Remove FSM_UNDO calls were fsm->postpon...
Florian Festi [Wed, 28 Mar 2012 10:43:13 +0000 (12:43 +0200)]
Prepare for killing the fsm: Inline FSM_UNDO; Remove FSM_UNDO calls were fsm->postpone is set and FSM_UNDO doesn't do anything.

12 years agoPrepare for killing the fsm: Inline remaining FSM_PROCESS code in FSM_PKGINSTALL
Florian Festi [Wed, 28 Mar 2012 10:30:01 +0000 (12:30 +0200)]
Prepare for killing the fsm: Inline remaining FSM_PROCESS code in FSM_PKGINSTALL

12 years agoPrepare for killing the fsm: Remove superfluous check for being in FSM_PROCESS to...
Florian Festi [Wed, 28 Mar 2012 10:12:42 +0000 (12:12 +0200)]
Prepare for killing the fsm: Remove superfluous check for being in FSM_PROCESS to allow killing FSM_PROCESS. fsmVerify is only called while being in FSM_PROCESS.

12 years agoPrepare for killing the fsm: Make FSM_COMMIT a function
Florian Festi [Wed, 28 Mar 2012 08:05:21 +0000 (10:05 +0200)]
Prepare for killing the fsm: Make FSM_COMMIT a function

12 years agoPrepare for killing the fsm: Move build code from PSM_PROCESS to FSM_PKGBUILD
Florian Festi [Wed, 28 Mar 2012 07:34:05 +0000 (09:34 +0200)]
Prepare for killing the fsm: Move build code from PSM_PROCESS to FSM_PKGBUILD

12 years agoPrepare for killing the fsm: Move code for erasing files from FSM_COMMIT to FSM_ERASE
Florian Festi [Wed, 28 Mar 2012 07:19:15 +0000 (09:19 +0200)]
Prepare for killing the fsm: Move code for erasing files from FSM_COMMIT to FSM_ERASE

12 years agoPrepare for killing the fsm: Inline FSM_DESTROY in fsmTeardown()
Florian Festi [Tue, 27 Mar 2012 15:52:13 +0000 (17:52 +0200)]
Prepare for killing the fsm: Inline FSM_DESTROY in fsmTeardown()

12 years agoPrepare for killing the fsm: Inline FSM_FINI code.
Florian Festi [Tue, 27 Mar 2012 15:26:49 +0000 (17:26 +0200)]
Prepare for killing the fsm:  Inline FSM_FINI code.
Move cleaning the stat_s structs to fsmInit() (beginning of the loop instead of the end)
Drop freeing fsm->path as this is done in fsmInit() and fsmTeardown()

12 years agoPrepare for killing the fsm: Inline the FSM_NOTIFY code
Florian Festi [Tue, 27 Mar 2012 15:03:04 +0000 (17:03 +0200)]
Prepare for killing the fsm: Inline the FSM_NOTIFY code

12 years agorpmbuild: warn if header color differs from color of the package architecture.
Ales Kozumplik [Tue, 3 Jan 2012 15:04:18 +0000 (16:04 +0100)]
rpmbuild: warn if header color differs from color of the package architecture.

- For example, warn when building an x86_64 package that only contains 32
  bit binaries.
- This should indicate to the maintainers that they might have gotten the
  architecture wrong.
- Introduces 'archcolor' in rpmrc so we can map architectures to colors.
- Related: RhBug:713323

12 years agoAxe leftover CANONARCH assignment messing up our "base" archs (RhBug:808250)
Panu Matilainen [Fri, 30 Mar 2012 06:56:43 +0000 (09:56 +0300)]
Axe leftover CANONARCH assignment messing up our "base" archs (RhBug:808250)

- This should've been in commit 2a8d03669732f68f02fa7b21ec87ee3f65d11e5b,
  the leftover CANONARCH resets the "base arch" we just set to a wrong
  value.

12 years agoAccept files as command line arguments again in rpmdeps (RhBug:807767)
Panu Matilainen [Thu, 29 Mar 2012 08:26:57 +0000 (11:26 +0300)]
Accept files as command line arguments again in rpmdeps (RhBug:807767)

- Commit a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was
  supposedly a non-supported method of passing files as arguments
  (instead of the normal stdin method) to rpmdeps. Turns out
  rpmdeps is even documented to take files as cli args, and that's
  how Fedora's %filter_setup macros are calling it...
- Allow files as arguments again, but in a way that doesn't cause
  argvFoo() vs popt crash-n-burn.

12 years agoInline FSM_NEXT
Florian Festi [Tue, 27 Mar 2012 12:22:46 +0000 (14:22 +0200)]
Inline FSM_NEXT

12 years agoRemove left over debugging code
Florian Festi [Tue, 27 Mar 2012 12:31:50 +0000 (14:31 +0200)]
Remove left over debugging code

12 years agoMove fsm_s to fsm.c and remove fsmNext() from fsm.h
Florian Festi [Tue, 27 Mar 2012 09:25:49 +0000 (11:25 +0200)]
Move fsm_s to fsm.c and remove fsmNext() from fsm.h

12 years agoRemove Fseek() code from rpmcpioHeaderRead for now
Florian Festi [Tue, 27 Mar 2012 09:09:45 +0000 (11:09 +0200)]
Remove Fseek() code from rpmcpioHeaderRead for now
Fseek() does not return a proper error code. This needs to be fixed before we can use it as most comprssed files do not support seeking and we need to be able to detect this reliably

12 years agoUntangle lib/fsm.c and lib/cpio.c
Florian Festi [Thu, 22 Mar 2012 12:58:02 +0000 (13:58 +0100)]
Untangle lib/fsm.c and lib/cpio.c

Create cpio_t data type that holds the underlaying FD_t instance
Move padding and position handling and trailer generation into cpio.c
Use only one buffer in the fsm (merging the read and write buffer)
Replace the FSM_EAT, FSM_POS, FSM_PAD, FSM_DREAD, FSM_DWRITE states with cpio functions
Prepend "rpm" to the cpio function names

12 years agoDont bother building internal versions of db utilities we dont need
Panu Matilainen [Mon, 26 Mar 2012 10:03:03 +0000 (13:03 +0300)]
Dont bother building internal versions of db utilities we dont need

- rpmdb_dump, load, recover, verify, stat etc are useful at times,
  but these are not. This also fixes build with internal db for
  more recent versions of Berkeley DB.

12 years agoEliminate broken data end calculation in dataLength()
Panu Matilainen [Fri, 23 Mar 2012 12:17:47 +0000 (14:17 +0200)]
Eliminate broken data end calculation in dataLength()

- If the caller doesn't know the end pointer, we dont have a whole lot
  of chance to come up with a reasonable one either. Just assume
  the terminating \0's are there when end boundary is not specified:
  when this happens we're dealing with relatively "trusted" data
  anyway, the more critical case of reading in unknown headers does
  always pass end pointers.
- While capping the end pointer to HEADER_DATA_MAX seems like a
  reasonable thing to do (as was done in commit
  f79909d04e43cbfbbcdc588530a8c8033c5e0a7c), it doesn't really help
  (bad data would likely run past bounds anyway), and it's not right
  either: the pointer can be to a stack address, and the stack can be
  near the top of addressable range, and ptr + HEADER_DATA_MAX can
  cause pointer wraparound. Notably that's exactly what happens
  when running 32bit personality process on 64bit system on Linux,
  at least in case of i386 process on x86_64, causing all sorts of
  breakage..

12 years agoOops, "magic eight" is necessary here afterall
Panu Matilainen [Thu, 22 Mar 2012 10:24:55 +0000 (12:24 +0200)]
Oops, "magic eight" is necessary here afterall

- Fix regression from commit 807b402d95702f3f91e9e2bfbd2b5ca8c9964ed9,
  the array gets passed as a pointer (how else would it work at all),
  so despite having seemingly correct type, sizeof(keyid) depends
  on the pointer size. This happens to be 8 on x86_64 and friends
  but breaks pgp fingerprint calculation on eg i386.
- Also return the explicit size from pgpExtractPubkeyFingerprint(),
  this has been "broken" for much longer but then all callers should
  really care about is -1 for error.

12 years agoAdd test case for scriptlet behavior
Panu Matilainen [Wed, 21 Mar 2012 08:04:14 +0000 (10:04 +0200)]
Add test case for scriptlet behavior

- The test-root has a shell but rpm doesn't know about it, add a
  fakeshell metapackage that provides it. Should come in handy for
  other cases as well, up to now we've been limited to lua scripts only.
- Test that all the "normal" scripts get executed, in expected order
  and with expected arguments, on install, upgrade and erase.
- This would've saved the rather embarrassing breakage with commit
  274dbf557d1cac90f7c278f9b6d6af05997d92df at least, but better
  late than never as they say... It also serves to highlight and
  document  the arguably broken arguments to %pre- and %posttrans
  scripts (ie always 0)

12 years agoTransaction element file info can be legally NULL in some cases
Panu Matilainen [Wed, 21 Mar 2012 07:07:21 +0000 (09:07 +0200)]
Transaction element file info can be legally NULL in some cases

- rpmteClose() will wipe out the file info to free memory, we only
  should care whether we failed to (re)load the file info. This
  thinko in commit 06a2f1269b035a3a76464149834f2a5a8c4e89f2
  broke %posttrans scriptlets (and without commit
  274dbf557d1cac90f7c278f9b6d6af05997d92df, %pretrans in other
  circumstances), whoopsie *blush*. Now, off to write a test-case
  for our scriptlet behavior...

12 years agoDon't free up file info sets on transaction test-runs, take II
Panu Matilainen [Tue, 20 Mar 2012 14:32:54 +0000 (16:32 +0200)]
Don't free up file info sets on transaction test-runs, take II

- Despite commit cef18c94807af0935b7796c462aab8ed39f0f376, we'd still
  end up freeing the file info sets via rpmteClose() while going
  through the test-transaction packages. This together with commit
  06a2f1269b035a3a76464149834f2a5a8c4e89f2 caused install failures
  on packages which have %pretrans scriptlets, if a test-transaction
  was first performed on the same transaction set that gets used
  for the "real" transaction as well. How wonderfully obscure...

12 years agoBump version to appear newer than 4.10.x branch
Panu Matilainen [Tue, 20 Mar 2012 08:05:49 +0000 (10:05 +0200)]
Bump version to appear newer than 4.10.x branch

12 years agoUpdate translations from Transifex
Panu Matilainen [Tue, 20 Mar 2012 08:00:06 +0000 (10:00 +0200)]
Update translations from Transifex