summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlof Johansson <olof.johansson@axis.com>2018-07-03 14:00:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-07-05 00:22:08 +0100
commit6d3617d0f658fdb45fecabb396a404c8141cd82b (patch)
treef0891f992518062c0ab2b4db63ff7984b001a4d8
parent846193422cd0cd02cdc6c923ec40f2d5d7672a29 (diff)
downloadpoky-6d3617d0f658fdb45fecabb396a404c8141cd82b.tar.gz
rpm: Avoid leaking temporary scriplet files
RPM writes each package scriptlet (post-/preinstall) to /var/tmp/rpm-tmp.XXXXXX --- a lot of files potentially gets 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). Normally, the temporary files would have been written to the tmp directory of the target sysroot (which we can easily clean up), but in this tree, you can't necessarily run the scriptlets. Fixes [YOCTO #12792] (From OE-Core rev: ffb0ece83e74797f4c3da3866bb3d691c388a5e5) Signed-off-by: Olof Johansson <olofjn@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch35
1 files changed, 30 insertions, 5 deletions
diff --git a/meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch b/meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch
index 2be3cb5af3..4020a31092 100644
--- a/meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch
+++ b/meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch
@@ -1,4 +1,4 @@
1From a6f269f879221f2777169c5f7291322afe6b661b Mon Sep 17 00:00:00 2001 1From a89daa75ac970d8e247edc762d1181e9a5b0c5d0 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com> 2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 17 Jan 2017 14:07:17 +0200 3Date: Tue, 17 Jan 2017 14:07:17 +0200
4Subject: [PATCH] When cross-installing, execute package scriptlets without 4Subject: [PATCH] When cross-installing, execute package scriptlets without
@@ -7,17 +7,42 @@ Subject: [PATCH] When cross-installing, execute package scriptlets without
7This is triggered only when RPM_NO_CHROOT_FOR_SCRIPTS environment variable is defined. 7This is triggered only when RPM_NO_CHROOT_FOR_SCRIPTS environment variable is defined.
8Otherwise they will trigger an explosion of failures, obviously. 8Otherwise they will trigger an explosion of failures, obviously.
9 9
10Amended 2018-07-03 by Olof Johansson <olofjn@axis.com>:
11
12 Remove leaking temporary scriptlet files
13
14 Since we tell dnf to run rpm with debug output, this will result in rpm not
15 cleaning up written temporary scriptlet files (same flag controls both
16 behaviors). This wouldn't have been a problem since we normally would use the
17 target sysroot also for temporary files, but we need to chroot out to be able
18 to actually run the rpm scriptlets (purpose of this patch), so the temporary
19 files are written to the host's /var/tmp/ directory, causing a gradual
20 resource leakage on the host system for every RPM based do_rootfs task
21 executed.
22
23 Signed-off-by: Olof Johansson <olofjn@axis.com>
24
10Upstream-Status: Inappropriate [oe-core specific] 25Upstream-Status: Inappropriate [oe-core specific]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> 26Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12--- 27---
13 lib/rpmscript.c | 8 +++++++- 28 lib/rpmscript.c | 11 ++++++++---
14 1 file changed, 7 insertions(+), 1 deletion(-) 29 1 file changed, 8 insertions(+), 3 deletions(-)
15 30
16diff --git a/lib/rpmscript.c b/lib/rpmscript.c 31diff --git a/lib/rpmscript.c b/lib/rpmscript.c
17index 98d3f420d..b95b5d606 100644 32index cc98c4885..f8bd3df04 100644
18--- a/lib/rpmscript.c 33--- a/lib/rpmscript.c
19+++ b/lib/rpmscript.c 34+++ b/lib/rpmscript.c
20@@ -467,7 +467,13 @@ rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd, 35@@ -394,8 +394,7 @@ exit:
36 Fclose(out); /* XXX dup'd STDOUT_FILENO */
37
38 if (fn) {
39- if (!rpmIsDebug())
40- unlink(fn);
41+ unlink(fn);
42 free(fn);
43 }
44 free(mline);
45@@ -428,7 +427,13 @@ rpmRC rpmScriptRun(rpmScript script, int arg1, int arg2, FD_t scriptFd,
21 46
22 if (rc != RPMRC_FAIL) { 47 if (rc != RPMRC_FAIL) {
23 if (script_type & RPMSCRIPTLET_EXEC) { 48 if (script_type & RPMSCRIPTLET_EXEC) {