Files
poky/meta/recipes-devtools/rpm/files/0001-When-cross-installing-execute-package-scriptlets-wit.patch
Richard Purdie 31565c258d rpm: Upgrade 4.17.1 -> 4.18rc1
rpm is close to release and give our release timings, update to the
rc1 of 4.18.

Includes fixes for CVE-2021-35937, CVE-2021-35938 and CVE-2021-35939
which can't be easily backported.

Add a PACKAGECONFIG option for a new readline dependency and disable
it by default since it pulls in GPLv3 and that breaks a number of
our test configurations as things stand.

Refresh patches and drop the error.h patch as error() no longer used.

(From OE-Core rev: 4b31e4f2aea490bd5056c97742b5e25a8dcc8b36)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2022-09-20 23:17:53 +01:00

69 lines
2.6 KiB
Diff

From a89daa75ac970d8e247edc762d1181e9a5b0c5d0 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Tue, 17 Jan 2017 14:07:17 +0200
Subject: [PATCH] When cross-installing, execute package scriptlets without
chrooting into destination rootfs
This is triggered only when RPM_NO_CHROOT_FOR_SCRIPTS environment variable is defined.
Otherwise they will trigger an explosion of failures, obviously.
Amended 2018-07-03 by Olof Johansson <olofjn@axis.com>:
Remove leaking temporary scriptlet files
Since we tell dnf to run rpm with debug output, this will result in rpm not
cleaning up written temporary scriptlet files (same flag controls both
behaviors). This wouldn't have been a problem since we normally would use the
target sysroot also for temporary files, but we need to chroot out to be able
to actually run the rpm scriptlets (purpose of this patch), so the temporary
files are written to the host's /var/tmp/ directory, causing a gradual
resource leakage on the host system for every RPM based do_rootfs task
executed.
Signed-off-by: Olof Johansson <olofjn@axis.com>
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
lib/rpmscript.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
Index: git/lib/rpmscript.c
===================================================================
--- git.orig/lib/rpmscript.c
+++ git/lib/rpmscript.c
@@ -18,7 +18,7 @@
#include "rpmio/rpmio_internal.h"
#include "lib/rpmplugins.h" /* rpm plugins hooks */
-
+#include "lib/rpmchroot.h" /* rpmChrootOut */
#include "debug.h"
struct scriptNextFileFunc_s {
@@ -427,8 +427,7 @@ exit:
Fclose(out); /* XXX dup'd STDOUT_FILENO */
if (fn) {
- if (!rpmIsDebug())
- unlink(fn);
+ unlink(fn);
free(fn);
}
free(mline);
@@ -462,7 +461,13 @@ rpmRC rpmScriptRun(rpmScript script, int
if (rc != RPMRC_FAIL) {
if (script_type & RPMSCRIPTLET_EXEC) {
- rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, script->nextFileFunc);
+ if (getenv("RPM_NO_CHROOT_FOR_SCRIPTS") != NULL) {
+ rpmChrootOut();
+ rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, script->nextFileFunc);
+ rpmChrootIn();
+ } else {
+ rc = runExtScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, script->nextFileFunc);
+ }
} else {
rc = runLuaScript(plugins, prefixes, script->descr, lvl, scriptFd, &args, script->body, arg1, arg2, script->nextFileFunc);
}