public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@fedoraproject.org>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - dont mess up python exit codes
Date: Mon, 23 Nov 2026 09:24:15 GMT [thread overview]
Message-ID: <179542585581.1.3804748155997415436.rpms-rpm-748554e20c77@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/rpm
Branch : pmatilai-v6
Commit : 748554e20c7744549502e21e712907f662868c77
Author : Panu Matilainen <pmatilai@fedoraproject.org>
Date : 2007-07-21T12:28:06+00:00
Stats : +111/-1 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/rpm/c/748554e20c7744549502e21e712907f662868c77?branch=pmatilai-v6
Log:
- dont mess up python exit codes
---
diff --git a/rpm-4.4.2.1-checkterminate-noexit.patch b/rpm-4.4.2.1-checkterminate-noexit.patch
new file mode 100644
index 0000000..38ea09b
--- /dev/null
+++ b/rpm-4.4.2.1-checkterminate-noexit.patch
@@ -0,0 +1,105 @@
+changeset: 6179:fb37e4dccbf3
+tag: tip
+user: Panu Matilainen <pmatilai@redhat.com>
+date: Sat Jul 21 15:05:19 2007 +0300
+files: python/rpmmodule.c rpmdb/rpmdb.c rpmdb/rpmdb.h
+description:
+Make rpmdbCheckTerminate() non-terminating.
+This allows use in exit handler without affecting exit code, and permits
+caller to do its own cleanup if necessary.
+
+
+diff -r e9ced408b17f -r fb37e4dccbf3 python/rpmmodule.c
+--- a/python/rpmmodule.c Fri Jul 20 11:23:11 2007 +0300
++++ b/python/rpmmodule.c Sat Jul 21 15:05:19 2007 +0300
+@@ -229,8 +229,6 @@ static PyMethodDef rpmModuleMethods[] =
+
+ /*
+ * Force clean up of open iterators and dbs on exit.
+-* This ends up calling exit() while we're already exiting but exit
+-* handlers will only get called once so it wont loop.
+ */
+ static void rpm_exithook(void)
+ {
+diff -r e9ced408b17f -r fb37e4dccbf3 rpmdb/rpmdb.c
+--- a/rpmdb/rpmdb.c Fri Jul 20 11:23:11 2007 +0300
++++ b/rpmdb/rpmdb.c Sat Jul 21 15:05:19 2007 +0300
+@@ -707,7 +707,7 @@ int rpmdbCheckTerminate(int terminate)
+ sigset_t newMask, oldMask;
+ static int terminating = 0;
+
+- if (terminating) return 0;
++ if (terminating) return 1;
+
+ (void) sigfillset(&newMask); /* block all signals */
+ (void) sigprocmask(SIG_BLOCK, &newMask, &oldMask);
+@@ -724,10 +724,6 @@ int rpmdbCheckTerminate(int terminate)
+ rpmdb db;
+ rpmdbMatchIterator mi;
+
+-/*@-abstract@*/ /* sigset_t is abstract type */
+- rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
+-/*@=abstract@*/
+-
+ /*@-branchstate@*/
+ while ((mi = rpmmiRock) != NULL) {
+ /*@i@*/ rpmmiRock = mi->mi_next;
+@@ -743,14 +739,20 @@ int rpmdbCheckTerminate(int terminate)
+ (void) rpmdbClose(db);
+ }
+ /*@=newreftrans@*/
++ }
++ sigprocmask(SIG_SETMASK, &oldMask, NULL);
++ return terminating;
++}
++
++int rpmdbCheckSignals(void)
++{
++ if (rpmdbCheckTerminate(0)) {
++/*@-abstract@*/ /* sigset_t is abstract type */
++ rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught));
+ exit(EXIT_FAILURE);
+- }
+- return sigprocmask(SIG_SETMASK, &oldMask, NULL);
+-}
+-
+-int rpmdbCheckSignals(void)
+-{
+- return rpmdbCheckTerminate(0);
++/*@=abstract@*/
++ }
++ return 0;
+ }
+
+ /**
+diff -r e9ced408b17f -r fb37e4dccbf3 rpmdb/rpmdb.h
+--- a/rpmdb/rpmdb.h Fri Jul 20 11:23:11 2007 +0300
++++ b/rpmdb/rpmdb.h Sat Jul 21 15:05:19 2007 +0300
+@@ -1039,8 +1039,7 @@ Header rpmdbNextIterator(/*@null@*/ rpmd
+ /*@modifies mi, rpmGlobalMacroContext, fileSystem, internalState @*/;
+
+ /** \ingroup rpmdb
+- * Check rpmdb signal handler for trapped signal exit. Just a compatibility
+- * wrapper for rpmdbCheckTerminate()
++ * Check for and exit on termination signals.
+ */
+ /*@mayexit@*/
+ int rpmdbCheckSignals(void)
+@@ -1048,10 +1047,13 @@ int rpmdbCheckSignals(void)
+ /*@modifies fileSystem, internalState @*/;
+
+ /** \ingroup rpmdb
+- * Check rpmdb signal handler for trapped signal or requested exit.
++ * Check rpmdb signal handler for trapped signal and/or requested exit,
++ * clean up any open iterators and databases on termination condition.
++ * On non-zero exit any open references to rpmdb are invalid and cannot
++ * be accessed anymore, calling process should terminate immediately.
+ * @param terminate 0 to only check for signals, 1 to terminate anyway
+- */
+-/*@mayexit@*/
++ * @return 0 to continue, 1 if termination cleanup was done.
++ */
+ int rpmdbCheckTerminate(int terminate);
+
+ /** \ingroup rpmdb
+
diff --git a/rpm.spec b/rpm.spec
index 890434b..af1bfda 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -14,7 +14,7 @@ Summary: The RPM package management system
Name: rpm
Version: 4.4.2.1
%{expand: %%define rpm_version %{version}-rc3}
-Release: 0.5.rc3
+Release: 0.6.rc3
Group: System Environment/Base
Url: http://www.rpm.org/
Source: rpm-%{rpm_version}.tar.gz
@@ -27,6 +27,7 @@ Patch6: rpm-4.4.2-matchpathcon.patch
Patch7: rpm-4.4.2.1-checksignals.patch
Patch8: rpm-4.4.2.1-checkterminate.patch
Patch9: rpm-4.4.2.1-python-exithook.patch
+Patch10: rpm-4.4.2.1-checkterminate-noexit.patch
License: GPL
Requires(pre): shadow-utils
Requires(postun): shadow-utils
@@ -140,6 +141,7 @@ shell-like rules.
%patch7 -p1 -b .checksignals
%patch8 -p1 -b .checkterminate
%patch9 -p1 -b .py-exithook
+%patch10 -p1 -b .checkterminate-noexit
%build
@@ -436,6 +438,9 @@ exit 0
%{__includedir}/popt.h
%changelog
+* Sat Jul 21 2007 Panu Matilainen <pmatilai@redhat.com> 4.4.2.1-0.6.rc3
+- dont mess up python exit codes
+
* Fri Jul 20 2007 Panu Matilainen <pmatilai@redhat.com> 4.4.2.1-0.5.rc3
- require logrotate (#248629)
- allow checking for pending signals from python (#181434)
reply other threads:[~2026-11-23 9:24 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179542585581.1.3804748155997415436.rpms-rpm-748554e20c77@fedoraproject.org \
--to=pmatilai@fedoraproject.org \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox