systemd/0212-meson-also-skip-uid-gid-check-for-nobody-user-group-.patch
Jan Macku e0b00a8ea2 systemd-257-7
Resolves: RHEL-71409
2025-02-10 08:20:10 +01:00

129 lines
6.0 KiB
Diff

From c7767b606a77af10b66975200c6fd830150f2fe5 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 7 Feb 2025 11:36:46 +0900
Subject: [PATCH] meson: also skip uid/gid check for nobody user/group when id
command not found
Follow-up for 8b413ae4060b21ed4712fdad7eba195890740756.
(cherry picked from commit be4f4c4343f05f2b53deb326c241c6031c36c911)
---
meson.build | 70 ++++++++++++++++++++++++++++-------------------------
1 file changed, 37 insertions(+), 33 deletions(-)
diff --git a/meson.build b/meson.build
index bfc35b88e6..caf2af0753 100644
--- a/meson.build
+++ b/meson.build
@@ -692,17 +692,20 @@ endif
#####################################################################
-sh = find_program('sh')
-echo = find_program('echo')
-sed = find_program('sed')
awk = find_program('awk')
-stat = find_program('stat')
-ln = find_program('ln')
-git = find_program('git', required : false)
-env = find_program('env')
-rsync = find_program('rsync', required : false)
diff = find_program('diff')
+echo = find_program('echo')
+env = find_program('env')
find = find_program('find')
+getent = find_program('getent', required : false)
+git = find_program('git', required : false)
+gperf = find_program('gperf')
+id = find_program('id', required : false)
+ln = find_program('ln')
+rsync = find_program('rsync', required : false)
+sed = find_program('sed')
+sh = find_program('sh')
+stat = find_program('stat')
ln_s = ln.full_path() + ' -frsT -- "${DESTDIR:-}@0@" "${DESTDIR:-}@1@"'
@@ -740,8 +743,6 @@ endif
#####################################################################
-gperf = find_program('gperf')
-
gperf_test_format = '''
#include <string.h>
const char* in_word_set(const char *, @0@);
@@ -890,11 +891,10 @@ nobody_user = get_option('nobody-user')
nobody_group = get_option('nobody-group')
if not meson.is_cross_build()
- find_getent_result = find_program('getent', required : false)
- if find_getent_result.found()
- getent_result = run_command('getent', 'passwd', '65534', check : false)
- if getent_result.returncode() == 0
- name = getent_result.stdout().split(':')[0]
+ if getent.found()
+ ret = run_command(getent, 'passwd', '65534', check : false)
+ if ret.returncode() == 0
+ name = ret.stdout().split(':')[0]
if name != nobody_user
warning('\n' +
'The local user with the UID 65534 does not match the configured user name "@0@" of the nobody user (its name is @1@).\n'.format(nobody_user, name) +
@@ -902,20 +902,22 @@ if not meson.is_cross_build()
endif
endif
endif
- id_result = run_command('id', '-u', nobody_user, check : false)
- if id_result.returncode() == 0
- id = id_result.stdout().strip().to_int()
- if id != 65534
- warning('\n' +
- 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, id) +
- 'Your build will result in an user table setup that is incompatible with the local system.')
+ if id.found()
+ ret = run_command(id, '-u', nobody_user, check : false)
+ if ret.returncode() == 0
+ uid = ret.stdout().strip().to_int()
+ if uid != 65534
+ warning('\n' +
+ 'The local user with the configured user name "@0@" of the nobody user does not have UID 65534 (it has @1@).\n'.format(nobody_user, uid) +
+ 'Your build will result in an user table setup that is incompatible with the local system.')
+ endif
endif
endif
- if find_getent_result.found()
- getent_result = run_command('getent', 'group', '65534', check : false)
- if getent_result.returncode() == 0
- name = getent_result.stdout().split(':')[0]
+ if getent.found()
+ ret = run_command(getent, 'group', '65534', check : false)
+ if ret.returncode() == 0
+ name = ret.stdout().split(':')[0]
if name != nobody_group
warning('\n' +
'The local group with the GID 65534 does not match the configured group name "@0@" of the nobody group (its name is @1@).\n'.format(nobody_group, name) +
@@ -923,13 +925,15 @@ if not meson.is_cross_build()
endif
endif
endif
- id_result = run_command('id', '-g', nobody_group, check : false)
- if id_result.returncode() == 0
- id = id_result.stdout().strip().to_int()
- if id != 65534
- warning('\n' +
- 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, id) +
- 'Your build will result in an group table setup that is incompatible with the local system.')
+ if id.found()
+ ret = run_command(id, '-g', nobody_group, check : false)
+ if ret.returncode() == 0
+ gid = ret.stdout().strip().to_int()
+ if gid != 65534
+ warning('\n' +
+ 'The local group with the configured group name "@0@" of the nobody group does not have GID 65534 (it has @1@).\n'.format(nobody_group, gid) +
+ 'Your build will result in an group table setup that is incompatible with the local system.')
+ endif
endif
endif
endif