summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* rpmsign: eliminate unused leftover variableignatenko/patch-1Igor Gnatenko2016-12-201-2/+0
| | | | Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Static signal-related variables need to be thread localPanu Matilainen2016-12-161-5/+5
|
* Literally blocking *all* signals is a bit too muchPanu Matilainen2016-12-152-1/+7
| | | | | | | Programming errors like SIGSEGV and SIGBUS need to get through no matter what and blocking them is undefined behavior anyway. The odd man out in this list is SIGTSTP which is just otherwise useful and not harmful since the process can be continued afterwards.
* Replace sigprocmask() uses with pthread_sigmask()Panu Matilainen2016-12-151-6/+6
| | | | | We're not exactly thread-safe anywhere but lets at least use the variant whose behavior is not decidedly undefined in a threaded environment.
* Block signals during RPMTXN_WRITE transactionsPanu Matilainen2016-12-151-0/+5
| | | | | | | | This includes (but not limited to) rpmtsRun() during which the accidental ctrl-c no longer aborts the whole dang thing. This could've of course been done without all the other recent signal infra too, but now that it's all neatly (yeah, right...) wrapped inside rpmsq instead of being littered all over town its nicer to do.
* Call rpmsqBlock() directly from rpmdb code to remove unused cruftPanu Matilainen2016-12-151-29/+8
| | | | | | This could've been done in commit 45d63715039d19fc2bd4be14229d37561fe0bd16 already of course but should there be regressions (my oh my!) this makes it easier to bisect.
* Add an shortcut API for blocking/unblocking signalsPanu Matilainen2016-12-153-12/+38
| | | | | | | | | | | | | | | | | | For rpm's purposes blocking all signals and restoring to previous status is the only necessary operation, make this part of the official API to make it available everywhere and replace rpmdb internal signal handling code with it. Noteworthy points: - The block/unblock operation is reference counted so these can be nested to arbitrary level without messing up things, much like the internal chroot API. - The rpmdb code used to remove rpmsq signals from the blocked mask, but blocked should really mean blocked, really. The pending signals will be delivered when unblocked and there's no need for us to mess with it. - Unlike the rpmdb variant, we now Run rpmsqPoll() *after* unblocking the signals. This actually matters now because rpmsqPoll() honors blocked signals since commit 07620f4ae7b626e6e02d743b1e933cf909ad0eb2.
* Remember the first signal to arrive, not lastPanu Matilainen2016-12-151-4/+6
| | | | | | This is more in line with how "normal" signals behave - if a signal of the same type is already pending then the subsequent signals of that type are dropped.
* Honor blocked signals during rpmsqPoll() tooPanu Matilainen2016-12-151-0/+3
| | | | | | | | | | Queued signals might get processed much much later than they arrive, and almost anything can happen in the meanwhile. Such as program blocking signals before entering a critical piece of code, which routinely calls rpmsqPoll() underneath since the code is not always critical. Such as rpmdb iterator init/free - sometimes they're called during harmless read-only query, at other times they're in middle of transaction...
* Make signal queue on/off a global atomic statePanu Matilainen2016-12-153-55/+63
| | | | | | | | | | | We always want the signal queue either enabled for the certain set of signals or completely disabled, make the API reflect that and make the switch "atomic", ie signal delivery is disabled while changing state. Perhaps more importantly, this allows changing signal handlers "offline", so an application can set its own signal handler for, say, SIGINT *in case* the signal queue is activated.
* Rename static handler function to make (name)space availablePanu Matilainen2016-12-151-2/+2
|
* Refactor finding a signal in the table to a helper functionPanu Matilainen2016-12-151-6/+14
|
* Return the return code of rpmsqPoll() to python tooPanu Matilainen2016-12-141-2/+1
|
* Replace rpmdbCheckSignals() with rpmsqPoll() everywhere, eliminate from APIPanu Matilainen2016-12-148-26/+19
| | | | | | rpmdbCheckSignals() is a public function and it'd be trivial to keep it but there are no known callers and its such a hysterical name that lets just get rid of it while we're breaking the ABI anyway...
* Lets do something silly with the newly gained signal info argumentPanu Matilainen2016-12-141-1/+7
| | | | (sorry, found the temptation to say greetings to Lemmy overwhelming)
* Support the info argument from rpmsqPoll() handlersPanu Matilainen2016-12-141-3/+14
| | | | | | | Copy the info contents on signal arrival, pass on to handlers during poll round. There are some pointers in siginfo_t whose validity might be questionable at the time we get it, but then those pointers like address of segfault aren't exactly something to go poking at anyway.
* Make the signal queue actually customizable and usefulPanu Matilainen2016-12-143-46/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The original rpmsq API is somehow backwards and upside down: it allows overriding the handler when enabling the queue, but if the queue is to be enabled for a signal, then the only possible handler for it is the action that stores the signal in the queue. If you wanted to have some other kind of behavior you wouldn't want to enable the queue for that signal to begin with! What applications need is the ability to override what happens at signal poll, not arrival time - arrival time is at odds with the whole queue notion. So introduce a poll function which runs the handlers for caught signals, clearing them on the way. Add to that the notion of default handler which is called if no custom handler is set. Now this can be trivially used to replace the signal foobar inside rpmdb and suddenly applications can replace the standard behavior with a simple void my_sigint_handler(....) { /* do foo */ } rpmsqEnable(SIGINT, my_sigint_handler); ...and the custom hander will be called when a SIGINT has arrived and the next signal polling round from rpmdb internals or whever occurs. rpmsqAction() is removed from the API/ABI here, but it's not as if it ever was useful to anybody anyway.
* Drop support for systems without SA_SIGINFOPanu Matilainen2016-12-142-16/+0
| | | | | | Life's too short to keep worrying about ancient junk forever. Even Hurd has this now, can you imagine? (Hurd was the reason this was special-cased back in 2008)
* Simplify rpmsq activate signals trackingPanu Matilainen2016-12-141-19/+9
| | | | | | | | | | | | | There's little better way of tracking set of signals than a sigset_t with its associated APIs. For one, this way we dont for example need to loop through the table to see if a signal is active or not. Note that This drops the "fancy" reference counting: calling rpmsqEnable() with different handlers would increase the refcount but not actually change the behavior, so the refcount means exactly what? The refcounting also hasn't been used by rpm at all/in a long time, because whether its active or not is tracked by the rpmdb code which is the only place really knowing if its needed or not.
* Use abs() when abs() is called forPanu Matilainen2016-12-141-1/+2
|
* Remove useless signal table definesPanu Matilainen2016-12-131-5/+0
|
* Clean up rpmdb leftovers from an atexit() handler.Panu Matilainen2016-12-136-47/+34
| | | | | | | | | | | | | | There's a standard C mechanism for cleaning up cruft at exit and it's known as atexit handler. atexit() handlers do not get called when exiting due to signal, but we're trapping the signals and calling exit() voluntarily in that case so... for fsck's sake Sherlock. This removes rpmdbCheckTerminate() from the API, the semantics change incompatibly here and it makes even less sense after this. It's a good time for this change since we're removing all sorts of other goo out from the API as well. Also rip out the previous workarounds from python side, RIP.
* Fix recent rpmdb handles cleanup-on signal regressionPanu Matilainen2016-12-131-12/+3
| | | | | | | | | | | | | Commit 4c6e51e2c0e3deeb052ae3c47115b6d10cb0d696 seems perfectly sensible but managed to break rpmdb handles cleanup on signals, ie the sole reason this mess of a code exists to begin with. The reason that change did not work for rpm is it expects the surroundings being sane when that's not the case: rpmdbCheckTerminate() removes the entries from the handle lists before calling the destructor functions, which would do the very same thing if you only let them. Not mucking with the lists from left and right simultaneously makes things work, what a shock.
* Revert "rpmdb.c: (rpmdbCheckTerminate) return non-zero on subsequent runs"Panu Matilainen2016-12-131-1/+1
| | | | | | | | | | | The change seems logical enough, but that doesn't work when the surrounding code is not. rpmdbCheckTerminate() is an idiotic API by yours truly which must return non-zero exactly once because that's the signal for the *caller* to call exit() (did I already say idiotic?) Anyway, if it repeatedly returns non-zero rpm will exit() more than once which at least glibc seems to take as "so lets exit already shall we?" This reverts commit e5d3b9f682383ee026b5a86a47eb5f288bdf8991.
* Define AM_CFLAGS inside the Makefile.am files themselves.Mark Wielaard2016-12-0912-3/+11
| | | | | | | | | | | Trying to include AM_CFLAGS through a configure generated rpm.am file doesn't really work because at the time automake runs configure doesn't exist yet to process rpm.am.in. Just define the AM_CFLAGS substitution inside the Makefile.am files themselves. Rename rpm.am.in back to rpm.am. Signed-off-by: Mark Wielaard <mjw@redhat.com>
* Refactor package component sizes debug printing out of rpmReadSignature()Panu Matilainen2016-12-091-35/+22
| | | | | | | The big block in rpmReadSignature() was only used for RPMLOG_DEBUG level printing, obfuscating a rather important function needlessly. Move all the data retrieval into printSize() and eliminate the rather pointless return code based on fstat() success.
* Eliminate unnecessary dependency on bfd.h from sepdebugcrcfixMark Wielaard2016-12-091-2/+2
| | | | | | | I think the reliance on bfd.h was a mistake. The code was lifted from bfd, but should be totally independent (it just calculates a CRC). Fix the type to be a normal size_t and include sys/stat.h (which was included through bfd.h) to get the definitions of stat and chmod.
* Simplify intGetTdEntry()Panu Matilainen2016-12-091-11/+3
| | | | | | | Ultimately there are exactly two possibilities here and we certainly don't need a switch-case to handle it. Thanks to Thierry Vignaud for pointing this out.
* Eliminate a mindless switch-case in rpmInstallLoadMacros()Panu Matilainen2016-12-091-12/+6
| | | | | | | | | The switch-case is a leftover from times where different formats sort of needed special handling in here, but RPM_NULL_TYPE is just hysterical, headerGet() will never return such a data type. So the whole thing is just moot. Thanks to Thierry Vignaud for pointing this out.
* Oops, python Makefile wasn't including rpm.amPanu Matilainen2016-12-081-0/+2
|
* Actually use supplements and enhances...Florian Festi2016-12-081-2/+2
|
* Remove unneccesary if clausesFlorian Festi2016-12-081-8/+7
|
* Order by weak and reverse dependencies alsoFlorian Festi2016-12-081-14/+70
| | | | | | | | | | | | | Add reversed param to add(Single)Relation() for Supplements and Enhances Also fix generation of reversed relations. As we generate all relations for one package (p) at once they are all the latest on the other packages. So we don't have to search through the list of relations there. But in the current package the relation might have been added before others. So we can check in package q if the relation is already there - using the proper list depending on the direction. So we can't reverse by just switching p and q before doing that.
* Remove code leftover from collectionsFlorian Festi2016-12-081-2/+0
|
* Stop messing with CFLAGS from configurePanu Matilainen2016-12-082-3/+5
| | | | | | | CFLAGS is a user variable that software is supposed to honor but not touch, that's what AM_CFLAGS and friends are for. rpm.am is included by all our makefiles so that's a handy place to set defaults centrally, do so by AC_SUBST'ing the rpm cflags into AM_CFLAGS there.
* Unbreak gcc options checkingPanu Matilainen2016-12-081-1/+2
| | | | | | | | Commit c810a0aca3f1148d2072d44b91b8cc9caeb4cf19 changed the gcc flag test to include a call to alloca() which at least on GCC 6.2 just causes all the tests to fail with implicit declaration warnings which are errors since we test with -Werror. Include <alloca.h> to avoid the warnings and thus make the test functional again.
* Silence type-punning warnings from python bindings, it's a python featurePanu Matilainen2016-12-021-1/+1
|
* Fix calculation of array size when formating query results.Florian Festi2016-12-011-8/+26
| | | | | | | In array output (square brackets in query format) all tags data sets need to have the same length. Single value tags may still be used. This patch fixes corner case where they are only single value items and ones where arrays with only one entries where treated as OK although they are not.
* Export RPMSENSE_MISSINGOK to pythonPanu Matilainen2016-12-011-0/+1
|
* Eliminate another mindless use of switch-case for a do-something booleanPanu Matilainen2016-12-011-6/+1
|
* Fix missing @param in rpmfilesVerify() and rpmfiVerify() doxygen docoPanu Matilainen2016-12-012-2/+2
|
* configure.ac: Support detecting gpg2 for %__gpg and prefer gpg2Neal Gompa2016-11-301-1/+1
| | | | | | | For a number of years, various Linux distributions (notably Fedora and RHEL) have been overriding this to set it to use gnupg2, with no ill effects. Now that most distributions are switching to gnupg2 by default, we will, too.
* Fix special %doc and %license %defattr() dir permissions (RhBug:1399798)Panu Matilainen2016-11-301-1/+0
| | | | | | | | | | | | | | | | | | | | Fixes regression from commit 877d5b130cbfdfd93ad39c1f0f1505790eba264e which broke directory permissions on special %doc and %license directories due to this cpe/thinko/typo: + copyFileEntry(&sd->entries[0].defEntry, &fl->def); + copyFileEntry(&sd->entries[0].defEntry, &fl->cur); However there's an added twist involved: the first special doc/license entry from which the current attrs are copied is a *file*, so if you have eg "%attr(444,-,-) %doc README.md" as the first special %doc, the directory ends up inaccessible because it inherits the file permissions. This is much much older behavior, probably about as old as rpm itself... Anyway, since we now *can*, the right thing to do seems to be just not copying the current attrs for the special doc/license *directory* at all. There's no associated %files line with the directory either, so it makes sense that only the defaults are applied..
* Ensure rpmlead is fully initializedPanu Matilainen2016-11-301-0/+1
| | | | | | Fix sneaky regression from commit 83a8640b47177d665b2aef9afc7ed8bde36f5103, the lead used to be calloc()'ed so it was guaranteed all zeros, now its not. Bulldoze to zero with memset() instead.
* Add a debug log on blocksize normalizationPanu Matilainen2016-11-291-3/+6
| | | | | | | Sooner or later one needs to find whether the result was using reported or faked up sizes, at least if we're not logging it. So keep the rain away and take the umbrella with you... Move mountpoint calculation earlier for a nicer message.
* Refactor mount point chase to a helper functionPanu Matilainen2016-11-291-31/+40
|
* Normalize dubiously large fs blocksizes to 4096Michael Schroeder2016-11-291-0/+7
| | | | | | | | Some filesystems like NFS and ZFS report block sizes that have nothing to do with the original concept of a block size, and mess up rpms calculations big time. Normalize to these to 4k for a result that is closer to reality. SuseBug:894610, SuseBug:829717, SuseBug:965322, RhBug:847960, RhBug:1397569...
* Clarify comments on header legacy regionsPanu Matilainen2016-11-281-3/+3
|
* Permit headers with legacy region in headerCheck() and friendsPanu Matilainen2016-11-282-2/+3
| | | | | | | | | | | | | | | | V3 packages don't have any regions straight off the wraps, but when exporting those headers (such as into rpmdb on installation), we create a "legacy region" which looks a whole lot like an immutable region of V4 packages. This causes some twists into things that we haven't been taking into account in recent refactoring... headerCheck() is supposed to permit all types of headers, don't require a specific region tag. In addition, permit legacy image region in hdrblobVerifyRegion(). Fixes a regression from commit 1c25d27895338913d84827d0d670b00887dd1d56 (and since then transmogrified through several phases) causing v3 packages to fail verification coming off rpmdb.
* Refactor headerImport() around struct hdrblob and APIPanu Matilainen2016-11-252-90/+48
| | | | | | | | | | | | Do the duck, bird and a monkey to flip headerImport() and hdrblobImport() around and upside down. Meaning every single path to read or otherwise import a header is now going through all the same validation and verification steps, whee! This also greatly simplifies the actual import since many of the calculations have already been done by the earlier steps. There aren't supposed to be regressions here but then I wouldn't exactly be shocked if there are some lurking nevertheless.