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
This commit is contained in:
Panu Matilainen 2023-11-03 11:53:11 +02:00
parent d141c874b3
commit 43cf645fc1
3 changed files with 12 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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