- Having a helper function to decrement an integer seems a bit much,
but mostly this is preparing for thread protection where the
unlink-helpers would just get in the way.
- Having a helper function to decrement an integer seems a bit much,
but mostly this is preparing for thread protection where the
unlink-helpers would just get in the way.
- Now that all of rpmlog global state is in the context hidden behind
a getter function, adding the actual locking is remarkably simple.
Alternatively we could use a per-thread storage for this, but
for now we'll go with global, locked structure.
- Add a reminder note about rpmlogMessage() - while grabbing the message
from the global context is thread-safe in itself, the returned message
is not as it points to the global context which could get freed or
moved before the caller gets to see it.
- In order to move the log mask to the context, we need to grab
the context early, which also means we need to figure out the need
to save the record early to keep things simple wrt locking, pass
the stuff around in arguments.
- Add functions to acquire and release a log context, update callers:
forcing callers through a function will allow fairly transparently
handling either locking for shared context or finding thread
local context, whichever approach we want to use.
- Callbacks and all need to go to the context as well, but to avoid
rewriting the entire rpmlog.c at once...
- No functional changes, just preliminaries for thread-sanity
- Doesn't make the code any smaller (on the contrary), but makes
the functions that little bit cleaner and more consistent: do just
one thing and all that...
- There's not a whole lot of point in making calls through what are
statically initialized function pointers that can never change.
The indirection might not be particularly expensive but when there's
precisely zero advantage to doing it... it only makes simple code
look hairier than it is.
- fsm->postpone is only interesting inside the loops, nobody
is going to look at it after we exited them. In other words
this just removes stuff that wasn't doing anything at all.
- The loop condition makes it terminate on errors already, handle
the case we're really interested in (success) separately instead.
Less early breaks means less places tired eyes will miss...
- The loop condition makes it terminate on errors, there's no need
for all these trailing break-on-rc checks. Simply handle success
in an else-clause instead.
- Supposedly no functional changes, but adding symmetrical
plugin hooks for files should be much easier now.
- This might've been somewhat less incorrect in earlier incarnations
of the fsm, but now its just totally totally wrong as it would leak
resources left and right. In reality this never happens as
on install, regular files are assumed non-existent always (as we're
installing to temporary path) from fsmInit() so fsmVerify()
is guaranteed to return CPIOERR_ENOENT here.
- 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.
- pthread_once() fits here like a glove... Unlike the previous
init-if-not-done-yet checks, call it as the first thing in each
of these functions, if only for consistency's sake.
- This is one of the first places anybody fooling with threads will
run into, guard it with a mutex to avoid crash-n-burn on such a
silly thing and add a reminder to put it out of its misery later.
- rwlock would likely be more optimal than mutex as most callers will
be just reading but to start simple and obvious...
This change introduces a separate routine to parse for valid macro
names. Valid macro names are either regular 3+ character identifiers,
or special names: "S", "P", "0", "#", "*", "**", macro options such as
"-o" and "-o*", and macro arguments such as "1". Other names are not
valid. This fixes a number of bugs seen earlier due to sloppy name
parsing: "%_libdir*" and "%01" were not expanded (these are now expanded
to e.g. "/usr/lib64*" and "<name>1", as expected). This also fixes
bugs in as-is substitution: "%!foo" was expanded to "%foo", and likewise
"%!!!" was expanded to "%" (and to "%<garbage>" at EOL).
Also, bad names in %name and %{name...} substitutions are now handled
differently. In %name form, the name is parsed tentatively; a silent
fall-back to as-is substitution is provisioned when no valid name can
be obtain. In %{name...} form, a failure to obtain a valid name is now
a syntax error. Furthermore, only 3 variants are syntactically valid:
%{name} proper, %{name:...}, and %{name ...}. This renders invalid
ambiguous macro substitutions such as the one found in FC18 lvm2.spec:
Requires: util-linux >= %{util-linux_version}
error: Invalid macro syntax: %{util-linux_version}
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
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>
- 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...)
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>
- 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.
- 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...
- 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 389b1ab706.
- 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
a712252392 was supposed to fix,
without side-effects that I can see.
- 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.
- 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 a712252392 was
supposed to fix (which it does but with, ahem, "slight" side-effects)
- 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
a712252392.
- 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"
- 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.
- Only skip shared file/dir creation if its actually being created
by another package. Previously we could've decided to skip an entry
where the other file was also being skipped for some other reason.
- Ensure %ghost entries always have FA_SKIP on install, previously
they often were FA_CREATE which makes no sense for %ghost. We dont
encounter %ghosts at all during install in the FSM as they dont
exist in the payload, but the file disposition calculations need
to take them into account now that we're avoiding redundant creates.
- Fixes a regression from commit f7f5f88f9f
which unearthed the %ghost FA_CREATE issue, reported here:
http://lists.fedoraproject.org/pipermail/buildsys/2013-January/004047.html
In the query mode, rpmspecQuery puts the parser into non-build mode
by invoking rpmSpecParse with (RPMSPEC_ANYARCH|RPMSPEC_FORCE) flags.
The same flags should be applied in the parse mode, so that it is
possible to preprocess specfiles separately, i.e. without also
installing sources and patches.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
- Up to now, special %doc has been different from everything else in
%files: double-quoting which is used to escape eg spaces in filenames
has not worked, but single-quoting and backslash-escapes (which do
not work elsewhere in %files) "worked" by happenstance due to getting
passed verbatim to shell/cp. Those and various other %doc hacks people
have come with stopped working (ticket #858) as starting from
commit 29677605d4 we perform the
copies in slightly more controlled manner.
- Rather than re-enable old quirks, make %doc and %license behavior
consistent with the rest of the %files section: double-quoting and
globs work, other escaping methods do not.
- This does mean a minor (as docs with spaces are relatively rare)
compatibility rift in specs, the "official workaround" is that
if compatibility with older rpm versions is required globs can
be used instead of quotation.
- This is highly systemd-specific functionality so it makes sense to
name the plugin in a way that makes it (more) obvious. No other
changes besides renaming.
- We wouldn't want anybody to shutdown (or reboot) the system while a
transaction is in progress, it's just that there hasn't been a whole lot
that could've been done about it. Recent systemd versions provide an API to
prevent shutdowns however:
http://www.freedesktop.org/wiki/Software/systemd/inhibit
- Add a simple plugin which, if enabled, tries to acquire a shutdown
inhibitor lock from systemd for the duration of transactionsd. This
could use better error handling and all... but its a start at least.
- Note that D-BUS is required, but only for the plugin, not (lib)rpm.
- The message is not about basedir and destdir, and printing them
here only makes the message even more confusing than it was, eg:
canonicalization unexpectedly shrank by one character \
('/home/pmatilai/rpmbuild/BUILD/' vs '/usr/src/debug/')
- This reverts commit 1eea433d99