public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Panu Matilainen <pmatilai@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/rpm] pmatilai-v6: - Dont wait for transaction lock within scriptlets (RhBug:1135596)
Date: Mon, 23 Nov 2026 09:29:12 GMT	[thread overview]
Message-ID: <179542615253.1.7769154727717788596.rpms-rpm-96d48126ff3f@fedoraproject.org> (raw)

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)

                 reply	other threads:[~2026-11-23  9:29 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=179542615253.1.7769154727717788596.rpms-rpm-96d48126ff3f@fedoraproject.org \
    --to=pmatilai@redhat.com \
    --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