Panu Matilainen [Tue, 18 Jun 2013 10:06:39 +0000 (13:06 +0300)]
Adjust flangtest to work as a test-case for zero-length files
(cherry picked from commit
2427d0fbf6b209e80e0c44eb2b63ecb028d058dc)
Panu Matilainen [Mon, 17 Jun 2013 12:40:47 +0000 (15:40 +0300)]
Teach debugedit about .debug_gdb_script section (SuseBug:818502)
(cherry picked from commit
b9ce1c4d7afdef15b543850936bbef5874393c0c)
Panu Matilainen [Mon, 17 Jun 2013 07:17:07 +0000 (10:17 +0300)]
Avoid breaking build on older systems which dont know AArch64
(cherry picked from commit
606749c3b5094a1e4b536e71049e3e43761f1944)
Kyle McMartin [Sun, 16 Jun 2013 16:48:46 +0000 (12:48 -0400)]
debugedit: handle aarch64 debug_info relocations (RhBug:974860)
AArch64 generates a relocation which must be handled similar to other
architectures. Adding this patch allows debugedit to run against the
kernel debuginfo.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
389d260ca41a277de49ca0154966d549945d8635)
Panu Matilainen [Tue, 11 Jun 2013 08:17:21 +0000 (11:17 +0300)]
Fix ages old segfault on trying to expand %{lua} (RhBug:972646)
- Using the already calculated macro arg + arglen for copying the
buffer instead of buggy local variant helps... This is as old as
the embedded lua interpreter in rpm, close to a decade.
- Besides fixing the segfault, this actually makes it behave like
other built-ins, evaluating to empty string when an empty arguments
or no arguments are passed.
(cherry picked from commit
ae5795897159319923b60f5c141a2ae5aa6f8d68)
Panu Matilainen [Tue, 11 Jun 2013 07:46:50 +0000 (10:46 +0300)]
Dont try to expand zero-length arguments to built-in macros
- Previously various built-in macros without an actual argument,
eg %{basename:} would evaluate to "}" which makes no sense
whatsoever. With this, they evaluate to an empty string similarly
to when no argument is passed, eg %{basename}. Arguably these
should emit an error/warning instead but for now...
(cherry picked from commit
99b40fe5ab591af40b88f2d076f16984a71a8720)
Panu Matilainen [Tue, 11 Jun 2013 07:17:02 +0000 (10:17 +0300)]
Adjust attrtest.spec to work as a test-case for RhBug:972994
(cherry picked from commit
84c222d6cc69f6a24861df6834ec6b86288a49a6)
Panu Matilainen [Tue, 11 Jun 2013 06:51:48 +0000 (09:51 +0300)]
Fix regression on addressing main package by its name (RhBug:972994)
- The main package name is not known when we start parsing the preamble,
so newPackage() is called with NULL name and the early callers use
NULL to find it. Populate the name as soon as we know it so
various "%foo -n <name>" operations work on the main package too,
which got broken by commit
9929459f9967ecfe0a05d557bc42531944faa70a.
(cherry picked from commit
fed1298af7911145c953da8910fd5f2f15976374)
Panu Matilainen [Mon, 10 Jun 2013 06:38:34 +0000 (09:38 +0300)]
Preparing for rpm 4.11.1-rc1
- Due to the largish amount of changes for a maintenance version,
go with an rc before actual release...
Panu Matilainen [Mon, 10 Jun 2013 06:37:51 +0000 (09:37 +0300)]
Update library current + age (ie libs are now 3.2.0)
- We haven't removed or changed any interfaces in a way that would
warrant a soname bump, just a couple of pool-related new functions
were added. The rpmdsMerge() return code change is a bit questionable
but the return codes were always bogus and not matching the docs...
so we bend the rules a bit.
- The only real new interfaces are in librpm itself but for sanity
and consistency they're all updated...
Panu Matilainen [Mon, 10 Jun 2013 06:32:58 +0000 (09:32 +0300)]
Files with zero inode cannot be hardlinks
(cherry picked from commit
6a9853e3efed3f7c18a75694ef92359cf3832d38)
Panu Matilainen [Fri, 7 Jun 2013 09:59:50 +0000 (12:59 +0300)]
Pull updated translations from Transifex
Panu Matilainen [Fri, 7 Jun 2013 09:57:57 +0000 (12:57 +0300)]
Update transifex config for domain change
(cherry picked from commit
6daf515b51155f338239c7611b3942e0b4d26192)
Panu Matilainen [Fri, 7 Jun 2013 08:27:10 +0000 (11:27 +0300)]
Export the pool-aware rpmfi constructor
- Similar as commit
541234b02ea8bcdd0da0a2a43eb099f7ecc9869c for rpmds,
but speed is less of an issue with the complex rpmfi's than single
rpmds'es where private pool construct+teardown can be very expensive.
With rpmfi's the bigger gain from shared pools is memory savings,
permit taking advantage of this outside librpm internals.
(cherry picked from commit
5e89283259fa8fa300efa19ee2bbb8de59fb69fc)
Panu Matilainen [Wed, 5 Jun 2013 15:59:00 +0000 (18:59 +0300)]
Never package %ghost files into payload
- Fixes what's probably a regression from all the fsm refactoring (possibly
commit
aa2117b94efe60769bde94a9e250644aa016fd99) causing hardlinked
%ghost files ending up in the payload.
(cherry picked from commit
29eed0ff1cb3531bac7ca6f23a68fbe30640c268)
Panu Matilainen [Tue, 28 May 2013 05:56:22 +0000 (08:56 +0300)]
Serialize BDB environment open/close (RhBug:924417 etc)
- Introduce Yet Another Broken Lock[*] to serialize BDB environment open:
otherwise we can end up calling dbenv->failchk() while another process
is just joining the environment, leading to transient "Thread died in..."
DB_RUNRECOVER errors. Also prevents races on chrooted operations where
we remove the entire environment on close.
- This should also make it possible to handle at least some cases of
real DB_RUNRECOVER errors by just nuking the environment but that's
another topic...
[*] YABL as this is nowhere near foolproof or sufficient for all
the possible variants, but better than not having it...
(cherry picked from commit
ad874d60e3804f1bcd64f3510e1e2dfbf81456cd)
Panu Matilainen [Thu, 23 May 2013 09:45:08 +0000 (12:45 +0300)]
Error out on more than one --pipe option (RhBug:966093)
- Every now and then somebody tries to use --setugids and --setperms
(or some other popt aliases relying on --pipe) together, which
wont work as expected. Error out with a hint for the potential cause.
(cherry picked from commit
9de2834a09a7410296cafedcea545d2e3dda34a6)
Panu Matilainen [Wed, 22 May 2013 05:38:53 +0000 (08:38 +0300)]
Only consider files with .pm suffix as perl modules (RhBug:927211)
- Newer file is more eager to flag files as Perl module source,
causing false provides to be generated. Require both magic
and path to match for perllib classification to reduce the pain.
(cherry picked from commit
9b734cee5dc9805a6f8d24c3f30ed82a7aef5673)
Panu Matilainen [Wed, 22 May 2013 04:24:06 +0000 (07:24 +0300)]
Plug segfault on NULL pointer dereference in debugedit (RhBug:929365)
- Not sure what the right thing to do would be here, ignoring seems
like a better option than crashing though...
(cherry picked from commit
ea47e7a8169187f87a70ff0c1059e99b0d09e659)
Panu Matilainen [Tue, 14 May 2013 10:02:31 +0000 (13:02 +0300)]
Dont check for non-directories when recursing
- Fixes regression from commit
f9f74db13e3bd94debcd7c33194e27649e5adfca,
if a non-directory in %files has a trailing slash its an error,
but when we're recursing a directory the check is not valid
as by definition we should accept whatever is there.
(cherry picked from commit
5ab95006b07f2c6b83d6ea0a22c4224d8b926fb3)
Alexander Kanevskiy [Fri, 26 Apr 2013 15:16:59 +0000 (18:16 +0300)]
Include %{VCS} in src.rpm
It is valuable to include VCS information in source rpm packages.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
91d2bdce5bbd095012250ad86ca6bb4b609b40c4)
Panu Matilainen [Fri, 26 Apr 2013 11:05:30 +0000 (14:05 +0300)]
Print out our macrofile path on --showrc
(cherry picked from commit
87be163dbb5963a77547e573b4e7b23b5a443a2f)
Archie Cobbs [Fri, 26 Apr 2013 09:28:03 +0000 (12:28 +0300)]
Here's a little patch does a couple of things for the check-files script:
- Eliminates the use of one of the two temporary files
- Ensures the other temporary file gets cleaned up in all termination
scenarios
- Performs the difference check more efficiently
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
d7b393a512cd46ef2d6889574af3060a267fed40)
Panu Matilainen [Thu, 25 Apr 2013 09:50:31 +0000 (12:50 +0300)]
Only require arguments to rpmbuild when building something (RhBug:919080)
(cherry picked from commit
71d5403baf4c72062792b75d4305bd96c9fac3fe)
Panu Matilainen [Thu, 25 Apr 2013 09:36:06 +0000 (12:36 +0300)]
Panu Matilainen [Thu, 25 Apr 2013 07:07:41 +0000 (10:07 +0300)]
Detect and error out non-directory being specified as one in spec
- Previously rpmbuild silently ignored %dir (and trailing slash)
on eg regular files and symlinks and just packaged whatever was
on disk. If the packager specifies something as a directory, ensure
it actually is one and error out otherwise to guard against eg
upstream unexpectly changing a directory to something else.
(cherry picked from commit
f9f74db13e3bd94debcd7c33194e27649e5adfca)
Panu Matilainen [Thu, 25 Apr 2013 06:42:13 +0000 (09:42 +0300)]
Ignore %attr() and %defattr() mode on symlinks
- Permission bits are not applicaple to symlinks, dont let
%attr() and %defattr() affect the mode that ends up in headers.
Mode specified by %defattr() is quietly ignored, but warn on
explicit per-file %attr() as this is likely a packaging bug,
such as in RhBug:950748.
(cherry picked from commit
98d629c276b6a07dc5c711f131f5c4c0acfed59f)
Panu Matilainen [Thu, 25 Apr 2013 06:28:10 +0000 (09:28 +0300)]
Ignore permission bits conflict on symlinks
- Permission bits are not applicaple to symlinks, and normally
they are always the same. However rpmbuild has never taken
symlinks into account wrt %attr and %defattr, so its possible to
have packages where symlink has a irregular mode (eg RhBug:950748),
which causes an unnecessary file conflict. Silently filter out
these bogus conflicts.
(cherry picked from commit
685bf3b6ef32bc49393d1f287b7ecf3e6d21ab09)
Panu Matilainen [Wed, 17 Apr 2013 11:18:23 +0000 (14:18 +0300)]
Avoid redundant strlen() calls on buildroot
(cherry picked from commit
a113baa510a004476edc44b5ebaaf559238a18b6)
Panu Matilainen [Wed, 17 Apr 2013 11:04:05 +0000 (14:04 +0300)]
Ensure packaged files are inside the buildroot (RhBug:951979)
- Before this it has been trivial to escape the buildroot with
eg /.. in %files: rpm thinks the path is ok as long as it starts
with /, but we end up packaging stuff we certainly should not.
Check that all added paths are inside the buildroot.
(cherry picked from commit
dbc2d51f066207e29e4a725f15d03cb04d9429c7)
Panu Matilainen [Tue, 16 Apr 2013 07:45:56 +0000 (10:45 +0300)]
Optimize expandMacro() a bit, based on patch by Alexey Tourbin
- Avoid the expensive calloc() when creating a macro expansion buffer,
malloc() suffices just as well as long as we initialize the first
byte in the buffer. This is easily visible on wall-clock times.
- Avoid recalculating source string length: when caller doesn't
pass slen, we always calculate the string length for creating
a terminated copy, no need to redo it...
- Add a warning comment about the seemingly obvious optimization
breaking macro undefining itself, this is starting to look like
a recurring theme :)
(cherry picked from commit
c012a7698537ac446b87d636d8d835ae0fe78fdb)
Panu Matilainen [Tue, 16 Apr 2013 07:05:51 +0000 (10:05 +0300)]
Utilize the existing rpmds'es from packages when merging generated deps
- We already have the manually added dependencies in the per-package
rpmds'es so we can just merge, no need to reconstruct them from
the header.
(cherry picked from commit
84fb114457534f4d017981102fe07778f98e3b43)
Panu Matilainen [Tue, 16 Apr 2013 07:03:03 +0000 (10:03 +0300)]
Panu Matilainen [Tue, 16 Apr 2013 06:53:58 +0000 (09:53 +0300)]
Use addReqProv() for adding package self-provides too
- We have a function for this stuff so use it. This also ensures
the per-package rpmds'es and the data in header stay in sync
and that manually added self-provides wont cause duplicates.
(cherry picked from commit
e4b7d44eac71dc4c26b5254f357d8ad786592c8c)
Panu Matilainen [Tue, 16 Apr 2013 05:58:59 +0000 (08:58 +0300)]
Use string pool id instead of string for package lookup
- Comparing integers is cheaper than strings, but this is a fairly
marginal win in practise.
(cherry picked from commit
89ff1ca2d97d34f65dac52d7eec24f072dfe0e28)
Panu Matilainen [Tue, 16 Apr 2013 04:51:01 +0000 (07:51 +0300)]
Utilize the shared string pool for manually specified dependencies
- Brings the texlive.spec parse time down from 4.8s to 3.6s on my
laptop. Not bad for a one-liner.
(cherry picked from commit
304924b10099733cf7f677b670c356593d165bbc)
Panu Matilainen [Tue, 16 Apr 2013 04:48:35 +0000 (07:48 +0300)]
Add a spec-level shared string pool to spec and package structs
(cherry picked from commit
948f85fb8ff51fb50df51b0a1f0691101e48a16f)
Panu Matilainen [Tue, 16 Apr 2013 04:42:04 +0000 (07:42 +0300)]
Export the pool-aware rpmds constructors
- Private pools can be very expensive when constructing and tearing
down dependency sets by the masses. Permit taking advantage of
shared pool outside librpm internals.
(cherry picked from commit
541234b02ea8bcdd0da0a2a43eb099f7ecc9869c)
Panu Matilainen [Tue, 16 Apr 2013 04:38:01 +0000 (07:38 +0300)]
Avoid umphteen arguments to isNewDep() by creating the new ds earlier
(cherry picked from commit
0dd6e4491be69f4fc3074ae3859fb03fd6226a41)
Panu Matilainen [Tue, 16 Apr 2013 04:14:10 +0000 (07:14 +0300)]
Optimize lookupPackage() a bit
- Remember the name of sub-packages in the Package struct, avoiding
the need for headerGetString() in a loop, and also avoid unnecessary
strdup() in the case name is not a partial one.
- Somewhat hysterically, this more than halves the time to parse the
infamous texlive.spec on my laptop: the parse time is down from
10.2s to 4.9s.
(cherry picked from commit
9929459f9967ecfe0a05d557bc42531944faa70a)
Panu Matilainen [Mon, 15 Apr 2013 14:42:49 +0000 (17:42 +0300)]
Sanitize duplicate dependency checking at build
- Creating a new rpmds from header each time isNewDep() gets hideously
expensive when the number of manual dependencies is high.
Add prco etc rpmds structs to each package and use those to determine
whether a dependency has already been seen: this way the ds'es remain
sorted so rpmdsMerge() will do the right thing for regular
dependencies. Triggers are somewhat different beasts with their
index tags so at least for now just do a linear search like we
always did for correctness.
- Makes worlds of difference for complex specs... the time to parse
texlive.spec from Fedora goes down from ~27s to ~10s on my laptop
with this change.
(cherry picked from commit
d642df2a5c5913010dae5b5b6a043359325cf055)
Panu Matilainen [Mon, 15 Apr 2013 14:35:29 +0000 (17:35 +0300)]
Make rpmdsMerge() return something meaningful
- The API documentation was always incorrect and meaningless, as
rpmdsMerge() can merge any number of entries so there's no single
index to return. Instead return the number of merged entries
and adjust the docs to match the new behavior.
- This is of course an incompatible API change in a strict sense,
but then since the documentation was always wrong to begin with
anybody looking at rpmdsMerge() return is relying on undocumented
behavior really. The compatible way to use this is to check
for < 0 for errors and assume success otherwise.
(cherry picked from commit
a48b11edbd00c4f0dbdd3462e659dd1d3bcf21ac)
Panu Matilainen [Mon, 15 Apr 2013 14:16:27 +0000 (17:16 +0300)]
Fix ages old bug in rpmdsFind() wrt flags
- EVRs are pointers which in theory could be NULL so checking them
is appropriate, but 0 is a perfectly legal value for flags and
the bogus "NULL check" causes it to get things wrong if either or both
flags are RPMSENSE_ANY
(cherry picked from commit
83844d55cd18a469966a80ca7807f2c6339f9bfb)
Panu Matilainen [Mon, 15 Apr 2013 12:31:37 +0000 (15:31 +0300)]
Handle source vs binary pkg dependency difference in handlePreambleTag()
- We know perfectly well at handlePreambleTag() already whether something
should go to binary or source package, pass the right pkg to
parseRCPOT() so we dont need to fiddle with it there.
(cherry picked from commit
29813d418d0f9a255047353d0b163fb21fe943ad)
Panu Matilainen [Mon, 15 Apr 2013 12:23:37 +0000 (15:23 +0300)]
Pass the entire package struct to addReqProv()
- Still doesn't make much difference as it is, but further pre-requisites
for sanitizing the way dependencies are carried around.
- Change rpmSpecDS() to return the ds based on the actual source package
header, not buildRestrictions. Using buildRestrictions was probably
kinda wrong to begin with but its more so now as the actual
requires and conflicts go to the "real" header, not buildRestrictions.
(cherry picked from commit
42b2f78e724e02d677974314d460cc6dec5cbc5b)
Panu Matilainen [Mon, 15 Apr 2013 12:16:11 +0000 (15:16 +0300)]
Use newPackage() to initialize source package too
- As newPackage() initializes the pkg header too, we now need
a different way of checking whether initSourceHeader() has
already been called. Checking RPMTAG_NAME should suffice for the job...
(cherry picked from commit
0db12898c5d270fd4bbc7b4bad677dee4f34a617)
Panu Matilainen [Mon, 15 Apr 2013 11:52:40 +0000 (14:52 +0300)]
Only pass the target package list, not entire spec, to newPackage()
- Its mildly hysterical either way, but it doesn't actually need
the whole damn spec. More importantly allow passing NULL for
"independent" package entities.
(cherry picked from commit
c78c03d31289fb6a11537eb87b47c0a48a8dcb0d)
Panu Matilainen [Mon, 15 Apr 2013 11:08:24 +0000 (14:08 +0300)]
Pass the entire package struct to rpmlibNeedsFeature()
- Doesn't make much difference as it is, but pre-requisites for
sanitizing the way dependencies are carried around.
(cherry picked from commit
0252fdf04884da7b7d2437eeb8e6ca8c697d902a)
Panu Matilainen [Mon, 15 Apr 2013 11:04:40 +0000 (14:04 +0300)]
Pass the entire package struct to genCpioListAndHeader()
- Again simplifies things by having less junk to pass around,
but more importantly paving way for next steps...
(cherry picked from commit
4d7f6363b20f896c79749ef801eb657ecdc03103)
Panu Matilainen [Mon, 15 Apr 2013 10:53:45 +0000 (13:53 +0300)]
Eliminate the cpioSourceArchive struct
- Store archive size in the package struct, and now we can just
axe the kinda hysterical CSA foobar, much simpler and saner this way
(cherry picked from commit
36826b8c0d666f934f32745653dd4f0f67036644)
Panu Matilainen [Mon, 15 Apr 2013 10:48:12 +0000 (13:48 +0300)]
Pass the entire package struct to cpio_doio() too
- The CSA thing is nearly useless now...
(cherry picked from commit
25e2129dea56252ae7df07b7f3229f721cb1a275)
Panu Matilainen [Mon, 15 Apr 2013 10:44:09 +0000 (13:44 +0300)]
Pass the entire package struct to writeRPM()
- Simplifies things a little bit, but mostly this is just paving
way for next steps. Shouldn't change anything in practise.
(cherry picked from commit
790cb67b7f83c31b919ac50e48b83dd5b82fb0a3)
Panu Matilainen [Mon, 15 Apr 2013 10:23:48 +0000 (13:23 +0300)]
Use struct Package for source package too
- Makes the src.rpm that little bit more like other packages.
Doesn't make things any saner here but we'll want to pass around
package structs instead of headers later on.
(cherry picked from commit
a3e35ad4c798c8d6e60444df4f146118599478d6)
Panu Matilainen [Mon, 15 Apr 2013 09:42:34 +0000 (12:42 +0300)]
Move rpmlibNeedsFeature() and addReqProv() prototypes
- rpmbuild_misc.h is just internal misc helpers whereas the
dependency stuff has very much to do with packages and the
like. No functional changes, just clearing up stuff...
(cherry picked from commit
6d361d55d6e03bb1444e397f7c2d80edb307d601)
Panu Matilainen [Fri, 12 Apr 2013 09:40:37 +0000 (12:40 +0300)]
Report replaced files in verification
- Unlike other file states, replaced state is always a forced one
and thus a likely problem. Always report replaced files in verify
output by appending the state to the verify line, similar to
strerror() for unexpected errors. In verbose mode, report all
non-normal file states.
- Like any output change, this can potentially break user scripts but
at least this way the breakage should be minimal as regular output
does not change, and similarly appended error strings have been
present since 4.4.x days.
(cherry picked from commit
ebeb53314d73a9a77d9e377ccfd6d388c11a82dd)
Panu Matilainen [Fri, 12 Apr 2013 06:52:36 +0000 (09:52 +0300)]
Handle fork(), pipe() etc failures in signing passphrase check
- Actually check the return codes from various things and handle
the failures. This is nowhere near 100% correct still, but
at least within spitting distance from the ballpark.
- Incidentally this eliminates the last compiler warning on the rpm
codebase with current gcc (4.8.0), wohoo.
(cherry picked from commit
7fd03b0abf0e9522890d1602867f3264b01e9961)
Panu Matilainen [Fri, 12 Apr 2013 06:19:35 +0000 (09:19 +0300)]
Handle fork(), pipe() and dup2() failures in prelink helper launch
- Actually check the return codes from the stuff that matters and
deal with failures. Incidentally also eliminates a compiler warning
from set-but-not-used variable...
(cherry picked from commit
ae58a02861977d3a71a68bc1851cd0a70ec889f0)
Panu Matilainen [Wed, 10 Apr 2013 08:59:32 +0000 (11:59 +0300)]
Print out %pretrans and %posttrans dependencies too when building
(cherry picked from commit
427477fb3bc811fe8131c1a58f761a547645e610)
David Malcolm [Wed, 10 Apr 2013 06:47:11 +0000 (09:47 +0300)]
Fix python binding build on python 3
- Fixes PyString caused breakage from commit
cb84c0db42db105116072cb71d89152e885e2e2c
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
5fc863ee1e28479accb0e034442f88d15de84031)
Johannes Dewender [Thu, 4 Apr 2013 17:11:48 +0000 (19:11 +0200)]
Finish lua 5.2 support, trac #865
Lua52 support was started with
ac959fed0082cb253d45c7a04866e8654e962442.
Compilation tested with Lua 5.2.1 and Lua 5.1.5.
The short typerror() snippet is taken from luaL_typerror in Lua 5.1.5
(MIT license)
Signed-off-by: Johannes Dewender <rpm@JonnyJD.net>
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
cd7ca60a6ca97d9b363c2bf25dfd156cb95f877c)
Panu Matilainen [Thu, 4 Apr 2013 08:22:22 +0000 (11:22 +0300)]
Clarify the macro entry struct a bit
- Macro name, opts and body must not be freed or otherwise written
to after initialization, make them const pointers to clarify
(and enforce) this. Arena is used to store whatever we need: it
always contains the macro body, sometimes also name and/or opts,
but these can be pointers to elsewhere too.
(cherry picked from commit
a944143cf54fb5f41b18949a9c6324d22f382274)
Alexey Tourbin [Sun, 27 Jan 2013 20:20:10 +0000 (20:20 +0000)]
Improve macro table performance
In the existing implementation, when a new macro is added, the whole
table has to be sorted again. Hence the cost of adding n macros is
worse than O(n^2), due to arithmetic progression.
This change drops all qsort(3) stuff altogether, by carefully preserving
table in sorted order. In findEntry routine, bsearch(3) is replaced
with customized binary search which tracks position for insertion.
In the addMacro routine, if a matching entry is not found, this
position is used for direct insertion, after the rest of the elements
are "shifted to the right" with memmove(3). Likewise, in delMacro
routine, the elements are shifted back to the left when the last macro
definition is popped. Technically, shifting half of the array with
memmove(3) is still O(n^2); however, modern CPUs process contiguous
memory in a very efficient manner, and glibc provides a fine-tuned
memmove(3) implementation.
Also, macro table entries are now allocated in a single chunk.
This change reduces rpm startup costs by factor of 6. Also, this change
improves specfile parser performance by a factor of 2 (e.g. the parse
time of texlive.spec is reduced from 67s to 35s).
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
301d5450a1c7849f9eb4ead11d00c8a20ea6a6bd)
Panu Matilainen [Wed, 27 Mar 2013 07:43:12 +0000 (09:43 +0200)]
Remove -K/--checksig related leftover in the manual (RhBug:708734)
(cherry picked from commit
307a1c0b77a4ff99dde5c4b577fca17cd81e10a1)
Panu Matilainen [Wed, 27 Mar 2013 04:26:39 +0000 (06:26 +0200)]
Add a simple --rebuilddb test-case
(cherry picked from commit
08e27ffe8fdea04d1c148b8b1c4ed46153d52f03)
Panu Matilainen [Tue, 26 Mar 2013 10:55:53 +0000 (12:55 +0200)]
Test rpmmi pattern match too while testing for the single instance thing
(cherry picked from commit
56028aab2bdd7d09e5b75223c00fff37167f6bc8)
Panu Matilainen [Tue, 26 Mar 2013 10:36:15 +0000 (12:36 +0200)]
Add a testcase for db iterator locked to single instance number
- Back in the day, this case used to cause an endless loop. Just
making sure we dont end up with such stupidity again...
(cherry picked from commit
035c52d2f4e58176ee90266b43367d32c5ae3d32)
Panu Matilainen [Tue, 26 Mar 2013 10:34:27 +0000 (12:34 +0200)]
Accept Python longs as db instance number too
- Prior to this, trying to retrieve a db instance by number gotten
from header['dbinstance'] would fail with unknown key type, doh.
(cherry picked from commit
409fb9daea495fb88b9cecaa0a053ad738a625cf)
Panu Matilainen [Wed, 20 Mar 2013 10:50:48 +0000 (12:50 +0200)]
Add test-case for explicit file conflict variants
- Three-way tests for explicit (aka manually added) file conflicts:
conflict within added set, and conflict in transaction <-> database.
- The problem message rpm creates for the third case is pretty bad,
it misses the fact its on an installed package and gets the name
wrong too. Better than not detecting though, and the message has
been broken for a long time so not related to the recent other
changes.
(cherry picked from commit
909aab0916ef851ea78df4dbd7bd8c9d2045c7ab)
Panu Matilainen [Wed, 20 Mar 2013 09:49:35 +0000 (11:49 +0200)]
Add a file to the dependency test-case spec
- To be able to test file-dependencies it needs some files too...
- Adjust dependency problem verify case to avoid looking at files
(user+group will always be wrong in the test suite). So it actually
serves as --nofiles testcase now too.
(cherry picked from commit
35cf3112f12d30660614258183a6cbf2e0fbf953)
Panu Matilainen [Wed, 20 Mar 2013 09:35:15 +0000 (11:35 +0200)]
Plug another hole in conflicts and obsoletes handling
- Handle multiple "providers" in self-conflict and -obsolete cases:
we need look up all matches in the added package set, otherwise
if a self-conflict (or obsolete) is also a conflict (or obsolete)
in some other package in the transaction, this could previously
fall through unnoticed.
(cherry picked from commit
70013c4144a3c04678143c326f7135e775ec4ccc)
Michael Schroeder [Wed, 20 Mar 2013 07:29:58 +0000 (09:29 +0200)]
Check for file conflicts in installed packages
- Rpm checks that a conflict in the new package is not satisfied by an
installed file, but it ignores when a conflict of an installed package
is satisfied by a file of the new package, eg
Package A: Contains file "/foo"
Package B: Has "Conflicts: /foo"
rpm -U A.rpm, then rpm -U B.rpm results in:
error: Failed dependencies:
/foo conflicts with B-1-1.i586
rpm -U B.rpm, then rpm -U A.rpm will work.
- Use an IndexIterator over RPMTAG_CONFLICTNAME to create a hash with
all of the possible file conflicts to speed things up.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
46edce686a5949179c4f6eee18b41e761b53ae49)
Panu Matilainen [Fri, 15 Mar 2013 10:34:58 +0000 (12:34 +0200)]
Make sure PKG_CONFIG_PATH is set according to target libs
- pkg-config isn't multilib-aware by itself so things fail when
building packages for secondary archs (RhBug:212522)
- A variant of this patch has been in Fedora and RHEL for quite some
time, but they used to just brutally override whatever might
have been in PKG_CONFIG_PATH, which can break things in a custom
setup (RhBug:569773). Append instead of full override.
(cherry picked from commit
aa8979f4d1cd5ad5b2c69135595d90489e039817)
Panu Matilainen [Wed, 6 Mar 2013 12:45:36 +0000 (14:45 +0200)]
Make sure /var exists created in the test-suite root
- Rpm installation only creates /var if configured in specific way,
but the test-suite relies on /var being there. Ensure its always
there regardless of how rpm was configured.
(cherry picked from commit
ea3fa1513f5f8346d9f282a99a6d69088afd10b4)
Panu Matilainen [Wed, 6 Mar 2013 12:07:11 +0000 (14:07 +0200)]
Sanitize the hardlink test size thing
- The previous "echo $0" got actually expanded to the temporary
build-time script name, something like /var/tmp/rpm-tmp.UtGhG1,
which isn't what we're interested in, and depends on rpm
configuration so can easily cause false positives. Just use
%{name}-%{version} to get stable content.
(cherry picked from commit
9e918abb4c6d577f3aae2a1a1abd0f4e67f2d151)
Panu Matilainen [Wed, 6 Mar 2013 11:29:27 +0000 (13:29 +0200)]
Force known _tmppath during test-suite non-chroot builds
- Rpm might be configure'd with a _tmppath that isn't writable
or even existing on the build-host, force our testing tmp directory
to be used for package builds which cannot be executed within the
test-root.
- Fixes a few false positives in the test-suite by making it less
reliant on the configuration of the built rpm and build host
(cherry picked from commit
ec00b3f02e3caab77849338bdb6422bf6ab7c306)
Panu Matilainen [Wed, 6 Mar 2013 11:17:21 +0000 (13:17 +0200)]
Avoid relying on filesystem macro values in test suite
- The test-suite expected results are hardcoded, so we can't rely
on rpm-defined macros as those reflect rpm's own configuration
which could be something entirely different than our expectations.
- Fixes another big pile of false positives in the test suite
(cherry picked from commit
62e73943576acf19d212cac4f54b8c449c69531b)
Panu Matilainen [Wed, 6 Mar 2013 10:50:24 +0000 (12:50 +0200)]
Main macros needs similar sed-love on install as platform macros
- Autoconf leaves things like @localstatedir@ unexpanded at build-time
on purpose so the paths can be overridden during "make install".
However this leaves %{_var} in macros in its unexpanded state
unless --localstatedir is explicitly passed in, which does not
work very well for rpm.
- Process the main macros file through the same meat grinder as
the platform macros. Ugly as sin but... it brings the casual
"./configure; make; make check" sequence much closer to working.
(cherry picked from commit
ccd6281e699781e0b00edb16b6e9f4dec6878c15)
Mark Wielaard [Tue, 5 Mar 2013 20:52:36 +0000 (21:52 +0100)]
tests: Make sure testing/usr/bin exists and to copy data from srcdir.
When srcdir != builddir the data has to be copied over from the srcdir.
When any of the required progs comes from /usr/bin then there also needs
to be a usr/bin under testing. Just use the same symlink as for testing/bin.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
96bcbca9b10e635f5e77868ae55fd7497ea5c630)
Mark Wielaard [Tue, 5 Mar 2013 20:31:06 +0000 (21:31 +0100)]
Fixup find-requires linking for srcdir != builddir.
When configuring with srcdir != builddir the find-requires link would fail:
ln: failed to create symbolic link './autodeps/find-requires'
Do the link in the same way as find-provides with an explicit ${srcdir}.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
dd0ea43f14a0cf52b654df2886ac2d68d32e069a)
Mark Salter [Mon, 4 Mar 2013 17:30:16 +0000 (12:30 -0500)]
AArch64 support v2
Here is my updated patch adding AArch64 support. The main change was to
use CANONCOLOR=3 rather than 2.
--Mark
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
8e1ca16c58d478dce53c232d8943124636658cee)
Ville Skyttä [Sat, 16 Feb 2013 18:29:33 +0000 (20:29 +0200)]
Spelling fixes.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
8002b3f98543729fd4544545c055476f2f88a210)
Panu Matilainen [Mon, 18 Feb 2013 08:44:40 +0000 (10:44 +0200)]
A non-naive implementation of argvJoin()
- The previous version was as naive as they get, for reasonable behavior
with non-trivial amount of data precalculating string lengths and
allocating at one go is necessary.
(cherry picked from commit
11ba21e2ab67f14ad349252cfb890006a112867f)
Alexey Tourbin [Thu, 7 Feb 2013 03:44:41 +0000 (03:44 +0000)]
Fixed buffer problems in doShellEscape
When the output from a command is empty, nothing stops doShellEscape from
chopping newlines past the beginning of the buffer. This problem was first
identified by Dmitry V. Levin in July 2009.
Also, there is an off-by-one error in replacing trailing '\n' with '\0'.
This problem, however, escaped the attention of Dmitry V. Levin in July 2009.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
2d647098c803620aab2a7ca94007441e060451d3)
Panu Matilainen [Tue, 12 Feb 2013 03:14:34 +0000 (05:14 +0200)]
Failure to initialize crypto is fatal
- Almost nothing works if crypto fails to initialize for whatever reason,
check and propagate rpmInitCrypto() failure from rpmReadConfigFiles().
- Logging the error left for individual crypto backends to let them
identify themselves: beecrypt requires no initialization whatsoever
so it cannot fail at all, but NSS can fail in a number of entertaining
ways due to missing dlopen()'ed bits and pieces, this should help
avoiding wild-goose chases in such cases (RhBug:909627, RhBug:909618...)
(cherry picked from commit
cca91666d041abb500604997b0a5235018217b3f)
Panu Matilainen [Tue, 12 Feb 2013 03:11:16 +0000 (05:11 +0200)]
Failure to calculate digest in rpmDoDigest() is, well, a failure
- This is mostly a cant-happen situation but technically it can
fail, lets not segfault if it does (RhBug:909618)
(cherry picked from commit
65d2e787d518fb5d13340cbadecfc256af74fde6)
Alexey Tourbin [Sat, 19 Jan 2013 12:11:11 +0000 (12:11 +0000)]
Warn when whitespace is missing before macro body
This will now issue a warning when macro definition is possibly
incorrect or ambigous, such as the one found in FC18 lvm2.spec:
%define util-linux_version 2.22.1
warning: Macro %util needs whitespace before body
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
(cherry picked from commit
0eb0da9af91c8dfee5cd202770d686cf937fedb8)
Panu Matilainen [Tue, 5 Feb 2013 08:11:19 +0000 (10:11 +0200)]
Check for stale db locks when opening write-cursors
- During long-running transactions its entirely possible for some
other player to come and go leaving stale locks behind and cause
the transaction to get stuck until the cavalry comes along in the
form of somebody else opening the rpmdb, clearing the blockage.
- Presumably dbenv->failchk() is not entirely free of cost so we only
do this for writes which are way more critical and also more prone to
getting stuck.
- dbenv->failchk() could return DB_RUNRECOVER in which case we should
abort everything but we lack a mechanism to do it... just add
a reminder comment for now.
(cherry picked from commit
29e7c4b3bd1e67f9de1eaaf9fecf82cae281a7e6)
Panu Matilainen [Thu, 31 Jan 2013 14:03:30 +0000 (16:03 +0200)]
Restore legacy behavior on %ghost %config erasure, mostly
- Make rpmfiConfigConflict() consider any existing %ghost %config
as "modified". This causes them to be left alone on erasure to match
long-standing rpm behavior (whether the behavior is intended or not...)
Ghost config testcase passes again, talk about flip-flop. Sigh.
- Legacy behavior had an extra twist which we are intentionally NOT
restoring: if a non-empty %ghost exists at build-time, its digest
is stored in the header despite the file not being present in
the payload. With previous versions of rpm, the contents of an
existing %ghost %config would be compared to the one in header and
resulting in different behavior on erasure: if the contents matched
that of build-time, the file would be removed, otherwise it would
be preserved. Ghosts remembering their identity from previous life
goes a little bit too far into the land of paranormal for me...
(cherry picked from commit
233e4573d1d21a36d06874fea6c594428033802e)
Panu Matilainen [Thu, 31 Jan 2013 13:55:22 +0000 (15:55 +0200)]
Adjust ghost config test case to match legacy behavior
- Rpm has traditionally (at least for the last decade) preserved
existing %ghost %config file on erasure. Whether this was intentional
or not, changing the behavior now risks data loss in case people
are relying on this long-standing behavior.
- This fails now: The behavior changed as (an unexpected) side-effect
of commit
389b1ab706be8eddba9f00c7084759f670ce96ac.
(cherry picked from commit
4efec66338ef04d2f1ed20cfba84c47145269d0d)
Panu Matilainen [Thu, 31 Jan 2013 06:28:54 +0000 (08:28 +0200)]
Refresh translations again, sigh
Panu Matilainen [Wed, 30 Jan 2013 15:23:31 +0000 (17:23 +0200)]
Bump version to dot-paperbag aka 4.11.0.1
Panu Matilainen [Wed, 30 Jan 2013 12:07:33 +0000 (14:07 +0200)]
Dont skip shared file/dir create if the other one is a ghost
- Explicitly test for shared file/dir being ghost when deciding whether
to skip create: we must never skip the creation of a real file/dir
because of a ghost as the ghosts do not get created.
- This fixes the shared ghost testcase, ie the thing that commit
a712252392eca75443ca45c10a72873cabec7963 was supposed to fix,
without side-effects that I can see.
(cherry picked from commit
147a26c5f672ee3421fe057725f6be357031bbb5)
Panu Matilainen [Wed, 30 Jan 2013 12:01:59 +0000 (14:01 +0200)]
Revert the severely broken FA_SKIP on %ghost "fix"
- Reverts the bad half of commit
a712252392eca75443ca45c10a72873cabec7963:
treating files that wont be installed as skipped seems logical enough,
but rpm disagrees... making %ghosts FA_SKIP on install causes
upgrades on %ghost %config files to miss the necessary FA_SKIP getting
set on the erase half via handleInstInstalledFile() and
rpmfiDecideFate(), causing %ghost %config files to be nuked. Which isn't
very nice when your /var/lib/rpm/ contents are packaged as
%ghost %config...
- This fixes the %ghost %config testcase but breaks the shared %ghost
case in turn.
(cherry picked from commit
471b74bf6e218abb06bb3131a259cdfaec3f08cf)
Panu Matilainen [Wed, 30 Jan 2013 11:52:23 +0000 (13:52 +0200)]
Add testcase for %ghost shared with a real file
- Further parametrize conflicttest.spec to allow for different attributes
- Verify that the real file gets created without conflicts, that
it doesn't get removed when ghost is removed and gets normally removed
on erase.
- This is the case commit
a712252392eca75443ca45c10a72873cabec7963 was
supposed to fix (which it does but with, ahem, "slight" side-effects)
(cherry picked from commit
0485eab2c96173d1e34e4edb3570e58a693e255e)
Panu Matilainen [Wed, 30 Jan 2013 11:46:45 +0000 (13:46 +0200)]
Add testcase for %ghost %config behavior
- Further parametrize configtest.spec to allow for different attributes
- Verify pre-existing %ghost %config is preserved on install,
that it survives upgrades and gets removed on erase.
This fails now because it IS broken due to commit
a712252392eca75443ca45c10a72873cabec7963.
(cherry picked from commit
5121ea2151f13e58740b7b4e7dc20cff5f2475fb)
Panu Matilainen [Tue, 29 Jan 2013 06:30:28 +0000 (08:30 +0200)]
Preparing for 4.11.0 final
Panu Matilainen [Tue, 29 Jan 2013 06:22:37 +0000 (08:22 +0200)]
Update translations from Transifex
Panu Matilainen [Mon, 28 Jan 2013 20:34:11 +0000 (22:34 +0200)]
Dont mess with global user identity in __scm_setup_bzr
- Bzr defaults to global value on "bzr whoami", so we would mess
up user identity on "%autosetup -S bzr". Oops. Move identity setting
after repo initialization and set the identity per-branch, not global.
The notion of "per-branch identity" seems odd, but then bzr is...
I guess this would be bzr-speak for "per-directory identity"
(cherry picked from commit
58f41cb4e1721d410017732a55613056b6acb24c)
Panu Matilainen [Mon, 28 Jan 2013 20:31:30 +0000 (22:31 +0200)]
Setup git identity in __scm_setup_git (RhBug:905002)
- For some reason on my own account git keeps functioning even if
I remove its configuration, but on a newly created account git commit
bails out with "Please tell me who you are" unless we set the
(per-repo) configuration here.
(cherry picked from commit
321a87d789bb090c88c541f7f158ae922ddee3ff)
Panu Matilainen [Mon, 28 Jan 2013 20:28:35 +0000 (22:28 +0200)]
Split __scm_author to separate name and email address macros
- At least git wants name and email separately, change __scm_author
to combine the two instead. Related to RhBug:905002.
(cherry picked from commit
1a21dc867dfbf48169782c6b8dbd0e0476e2bbbf)