Fri, May 21, 2021 at 06:47:12PM CEST, thaller(a)redhat.com wrote:
NetworkManager is exec-ing teamd while running without CAP_CHOWN.
When teamd is configured to drop privileges, then it will call chown
while still running as root user. But the command will fail because of
lack of CAP_CHOWN.
Note that chown() succeeds if the calling process has CAP_CHOWN or if
the file already is owned by the calling user/group (whereas, changing
the group will still work, if the user is a member of that group).
The directory might have already been prepared with the right user/group.
Let's handle that. If the first chown() as root succeeds, we are good.
If it fails, we will retry after changing the user id. If the directory
already has the right/compatible user, this command will succeeds too
and teamd can proceed.
From the text I'm unable to tell what you are changing. Could you please
adjust the test to use the imperative mood as you would tell the
codebase what to do?