All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rpm: Avoid leaking temporary scriplet files
@ 2018-06-25  9:27 Olof Johansson
  2018-06-25 13:25 ` Alexander Kanavin
  0 siblings, 1 reply; 12+ messages in thread
From: Olof Johansson @ 2018-06-25  9:27 UTC (permalink / raw)
  To: openembedded-core; +Cc: Olof Johansson

RPM writes each package scriptlet (post-/preinstall) to /var/tmp/rpm-tmp.XXXXXX
 --- a lot of files get created. When debugging is enabled, these temporary
scriptlet files aren't cleaned up at all and after a while this results in the
filesystem resources are eaten up (like running out of available inodes).

This is a quick fix to avoid this. It does degrade functionality for
those working with debugging pre-/postintall scripts.

Fixes [YOCTO #12792]

Signed-off-by: Olof Johansson <olofjn@axis.com>
---
 ...ve-written-tmp-scriptlets-even-with-debug.patch | 37 ++++++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.14.1.bb            |  6 ++++
 2 files changed, 43 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch

diff --git a/meta/recipes-devtools/rpm/files/0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch b/meta/recipes-devtools/rpm/files/0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch
new file mode 100644
index 00000000000..fe4b45bfb3b
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch
@@ -0,0 +1,37 @@
+From b74b549ff61ab8a2bdb041febbe135ad10fa303c Mon Sep 17 00:00:00 2001
+From: Olof Johansson <olofjn@axis.com>
+Date: Sun, 17 Jun 2018 12:12:36 +0200
+Subject: [PATCH] Always remove written tmp scriptlets, even with debugging
+ enabled
+
+RPM writes each package scriptlet (post-/preinstall) to /var/tmp/rpm-tmp.XXXXXX
+ --- a lot of files get created. When debugging is enabled, these temporary
+scriptlet files aren't cleaned up at all and after a while this results in the
+filesystem resources are eaten up (like running out of available inodes).
+
+This is a quick fix to avoid this. It does degrade functionality for
+those working with debugging pre-/postintall scripts.
+
+Upstream-Status: inappropriate [OE specific]
+Signed-off-by: Olof Johansson <olofjn@axis.com>
+---
+ lib/rpmscript.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/lib/rpmscript.c b/lib/rpmscript.c
+index 98d3f420d..6bf23c18c 100644
+--- a/lib/rpmscript.c
++++ b/lib/rpmscript.c
+@@ -430,8 +430,7 @@ exit:
+ 	Fclose(out);	/* XXX dup'd STDOUT_FILENO */
+ 
+     if (fn) {
+-	if (!rpmIsDebug())
+-	    unlink(fn);
++	unlink(fn);
+ 	free(fn);
+     }
+     free(mline);
+-- 
+2.11.0
+
diff --git a/meta/recipes-devtools/rpm/rpm_4.14.1.bb b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
index e5e87d39039..63a00ea1c0b 100644
--- a/meta/recipes-devtools/rpm/rpm_4.14.1.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.14.1.bb
@@ -45,6 +45,12 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
            file://0003-rpmSetCloseOnExec-use-getrlimit.patch \
            "
 
+# When we use RPM internally in OpenEmbedded, we enable debug output. This
+# unfortunately makes rpm not remove generated temporary files, which causes
+# incremental leakage for every build. Change behavior in rpm-native to always
+# remove the temporary files.
+SRC_URI_append_class-native = " file://0001-Always-remove-written-tmp-scriptlets-even-with-debug.patch"
+
 PE = "1"
 SRCREV = "bfee1410af51c1cc9724791fb8d985260a62102b"
 
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-07-04 21:46 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-25  9:27 [PATCH] rpm: Avoid leaking temporary scriplet files Olof Johansson
2018-06-25 13:25 ` Alexander Kanavin
2018-06-25 16:47   ` Mark Hatle
2018-06-25 19:20     ` Alexander Kanavin
2018-06-25 19:43       ` Alexander Kanavin
2018-06-26 10:33         ` Alexander Kanavin
2018-06-29 23:53           ` Olof Johansson
2018-06-30  6:37             ` Alexander Kanavin
2018-07-03 12:01               ` Olof Johansson
2018-07-03 12:33                 ` Alexander Kanavin
2018-07-04 21:46                   ` Peter Kjellerstedt
2018-06-25 18:43   ` Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.