Skip to content

Commit

Permalink
Handle unsupported 'r' and 'm' sysusers types more gracefully
Browse files Browse the repository at this point in the history
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
  • Loading branch information
pmatilai committed Nov 7, 2023
1 parent d141c87 commit 43cf645
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions macros.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/data/SPECS/klang.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions tests/rpmi.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 43cf645

Please sign in to comment.