]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
classes/package_rpm: set bogus locations for passwd/group files
authorAlexander Kanavin <alex.kanavin@gmail.com>
Fri, 26 Jan 2024 13:34:53 +0000 (14:34 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 27 Jan 2024 08:12:24 +0000 (08:12 +0000)
Since https://github.com/rpm-software-management/rpm/commit/f3eaeeb7341085e1850e914350cf1f33d538320d
rpm does its own parsing of /etc/passwd and /etc/group instead of relying on getpwnam() and friends.

This has an unfortunate effect of leaking build host uid/gid values for users and groups
into the cpio header inside rpm file (where previously those were always zero).

Installation of rpm packages relies on rpm header to set files ownership, and that
is a different structure that is build from .spec information, so we can avoid host
contamination by setting the paths to something bogus.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-global/package_rpm.bbclass

index 3ca6c5aa7b36841a62fdcf0fa8c297f9d5c3f782..e0f4de42a153d2bb056c7e6f6e63154c2061b15a 100644 (file)
@@ -722,6 +722,8 @@ python do_package_rpm () {
     cmd = cmd + " --define 'debug_package %{nil}'"
     cmd = cmd + " --define '_tmppath " + workdir + "'"
     cmd = cmd + " --define '_use_weak_usergroup_deps 1'"
+    cmd = cmd + " --define '_passwd_path " + "/completely/bogus/path" + "'"
+    cmd = cmd + " --define '_group_path " + "/completely/bogus/path" + "'"
     if d.getVarFlag('ARCHIVER_MODE', 'srpm') == '1' and bb.data.inherits_class('archiver', d):
         cmd = cmd + " --define '_sourcedir " + d.getVar('ARCHIVER_OUTDIR') + "'"
         cmdsrpm = cmd + " --define '_srcrpmdir " + d.getVar('ARCHIVER_RPMOUTDIR') + "'"