From 43cf645fc1fab93b5424cfc22cb520eb486fdbee Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 3 Nov 2023 11:53:11 +0200 Subject: [PATCH] Handle unsupported 'r' and 'm' sysusers types more gracefully People will want to use existing sysusers.d files through rpm and while we don't support 'r' and 'm' at this time, we shouldn't really call them "invalid" and error out. Issue a warning instead, and ignore. This is the first half of https://bugzilla.redhat.com/show_bug.cgi?id=2246236 --- macros.in | 3 +++ tests/data/SPECS/klang.spec | 2 ++ tests/rpmi.at | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/macros.in b/macros.in index 1f6d8b252f..fefb351ac3 100644 --- a/macros.in +++ b/macros.in @@ -1331,6 +1331,9 @@ end type = 'group' elseif arg[1] == 'u' then type = 'user' + elseif arg[1] == 'r' or arg[1] == 'm' then + macros.warn({'ignoring unsupported sysuser type: '..arg[1]}) + return else macros.error({'invalid sysuser type: '..arg[1]}) end diff --git a/tests/data/SPECS/klang.spec b/tests/data/SPECS/klang.spec index e6cce1add8..e7c03cd7f8 100644 --- a/tests/data/SPECS/klang.spec +++ b/tests/data/SPECS/klang.spec @@ -47,6 +47,8 @@ EOF cat << EOF > ${RPM_BUILD_ROOT}/%{_sysusersdir}/plong.conf u plong - "Plong fu" /var/lib/plong /sbin/nologin g klong - +m ding dong +r - 123-321 EOF %files common diff --git a/tests/rpmi.at b/tests/rpmi.at index 6339a70a7c..94d8967b12 100644 --- a/tests/rpmi.at +++ b/tests/rpmi.at @@ -1481,7 +1481,14 @@ AT_SETUP([rpm -i sysusers]) AT_KEYWORDS([install build sysusers]) RPMDB_INIT +RPMTEST_CHECK([ runroot rpmbuild -bb --quiet /data/SPECS/klang.spec +], +[0], +[], +[warning: ignoring unsupported sysuser type: m +warning: ignoring unsupported sysuser type: r +]) RPMTEST_CHECK([ runroot rpm -U /build/RPMS/noarch/klang-client-1.0-1.noarch.rpm