[OE-core] [PATCH] rpm: Avoid leaking temporary scriplet files

Olof Johansson olof.johansson at axis.com
Mon Jun 25 09:27:38 UTC 2018


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 at 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 at 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 at 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




More information about the Openembedded-core mailing list