public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rpm] pmatilai-v6: - Dont wait for transaction lock within scriptlets (RhBug:1135596)
@ 2026-11-23  9:29 Panu Matilainen
  0 siblings, 0 replies; only message in thread
From: Panu Matilainen @ 2026-11-23  9:29 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/rpm
Branch : pmatilai-v6
Commit : 96d48126ff3fb4c52e78177dc4bf30b0e2f66971
Author : Panu Matilainen <pmatilai@redhat.com>
Date   : 2014-10-01T10:16:37+03:00
Stats  : +38/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/rpm/c/96d48126ff3fb4c52e78177dc4bf30b0e2f66971?branch=pmatilai-v6

Log:
- Dont wait for transaction lock within scriptlets (RhBug:1135596)

---
diff --git a/rpm-4.12.0-tslock-nowait.patch b/rpm-4.12.0-tslock-nowait.patch
new file mode 100644
index 0000000..28c7d69
--- /dev/null
+++ b/rpm-4.12.0-tslock-nowait.patch
@@ -0,0 +1,32 @@
+commit 6ce2d43e2533505aa252159bfa8cc799965655bb
+Author: Panu Matilainen <pmatilai@redhat.com>
+Date:   Wed Oct 1 09:59:21 2014 +0300
+
+    Dont wait for transaction lock within scriptlets (RhBug:1135596)
+    
+    - Packages doing stupid things like rpm -U/-i/-e from their scriptlets
+      can and will get hung waiting on the transaction lock, which can
+      prompt users to kill the entire transaction, possibly with severe
+      consequences. Starting with rpm >= 4.12 we also take the transaction
+      lock for importing public keys, which seems to have caught one of
+      the bigger fishes in the pond (Google Chrome packages).
+    - Only wait when stdin is a tty, this affects more than scriptlets but
+      most likely we dont want to wait for locks in those situations either.
+
+diff --git a/lib/rpmlock.c b/lib/rpmlock.c
+index 7696cbe..9c07654 100644
+--- a/lib/rpmlock.c
++++ b/lib/rpmlock.c
+@@ -124,10 +124,11 @@ rpmlock rpmlockNew(const char *lock_path, const char *descr)
+ int rpmlockAcquire(rpmlock lock)
+ {
+     int locked = 0; /* assume failure */
++    int maywait = isatty(STDIN_FILENO); /* dont wait within scriptlets */
+ 
+     if (lock) {
+ 	locked = rpmlock_acquire(lock, RPMLOCK_WRITE);
+-	if (!locked && (lock->openmode & RPMLOCK_WRITE)) {
++	if (!locked && (lock->openmode & RPMLOCK_WRITE) && maywait) {
+ 	    rpmlog(RPMLOG_WARNING, _("waiting for %s lock on %s\n"),
+ 		    lock->descr, lock->path);
+ 	    locked = rpmlock_acquire(lock, (RPMLOCK_WRITE|RPMLOCK_WAIT));

diff --git a/rpm.spec b/rpm.spec
index 1002f7d..36a80f2 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -27,7 +27,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}1%{?dist}
+Release: %{?snapver:0.%{snapver}.}2%{?dist}
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.12.x/%{name}-%{srcver}.tar.bz2
@@ -50,6 +50,8 @@ Patch4: rpm-4.8.1-use-gpg2.patch
 Patch5: rpm-4.12.0-rpm2cpio-hack.patch
 
 # Patches already upstream:
+# Dont wait for transaction lock inside scriptlets (#1135596)
+Patch100: rpm-4.12.0-tslock-nowait.patch
 
 # These are not yet upstream
 Patch302: rpm-4.7.1-geode-i686.patch
@@ -528,6 +530,9 @@ exit 0
 %doc doc/librpm/html/*
 
 %changelog
+* Wed Oct 01 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0.1-2
+- Dont wait for transaction lock inside scriptlets (#1135596)
+
 * Thu Sep 18 2014 Panu Matilainen <pmatilai@redhat.com> - 4.12.0.1-1
 - Update to rpm-4.12.0.1 final (http://rpm.org/wiki/Releases/4.12.0.1)
 - Temporary workaround payload size mismatch issue in rpm2cpio (#1142949)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-23  9:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-23  9:29 [rpms/rpm] pmatilai-v6: - Dont wait for transaction lock within scriptlets (RhBug:1135596) Panu Matilainen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox