Fixes an issue raised in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238995.
Signed-off-by: Naman Sood <mail@nsood.in>
Differential D41057
pw: use existing group entry even if it already has members naman_freebsdfoundation.org on Jul 17 2023, 5:47 PM. Authored by Tags None Referenced Files
Details Fixes an issue raised in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238995. Signed-off-by: Naman Sood <mail@nsood.in> Try adding a new user with a non-login group such that /etc/group already lists that user as a member of that group
Diff Detail
Event TimelineComment Actions Runtime looks good. Without patch:
% tail -n2 /etc/group foo:*:12345:someuser,someuser someuser:*:1004: With patch:
% tail -n2 /etc/group foo:*:12345:someuser someuser:*:1002: Adding @bapt who has done some work here recently.
Comment Actions LGTM, I would appreciate if the 2 issues are solved in 2 differents commits, also since the rewrite pw(8) has a test suite, it would be nice to add regression tests for the issues fixed here, along with the fixes.
Comment Actions Split the changes into two commits and added tests. Checked that the tests fail before the two commits and pass after.
Comment Actions Runtime test of the second report in bug 238995. Without patch:
% tail -n2 /etc/group aarch64:*:31415:aarch64 aarch64:*:31416: With patch: % grep aarch64 /etc/group aarch64:*:31415:aarch64 Looks good. Comment Actions With new tests, but without pw updates: # kyua report ===> Failed tests pw_useradd_test:user_add_already_in_group -> failed: atf-check failed; see the output of the test for details [0.090s] pw_useradd_test:user_add_existing_login_group -> failed: atf-check failed; see the output of the test for details [0.138s] ===> Summary Results read from /root/.kyua/store/results.usr_tests_usr.sbin_pw.20230718-192827-913107.db Test cases: 95 total, 0 skipped, 0 expected failures, 0 broken, 2 failed Total time: 13.330s With new tests and pw updates: # kyua report ===> Summary Results read from /root/.kyua/store/results.usr_tests_usr.sbin_pw.20230718-193628-332707.db Test cases: 95 total, 0 skipped, 0 expected failures, 0 broken, 0 failed Total time: 10.816s |