summaryrefslogtreecommitdiffstats
path: root/pw/tests/pw_modify.sh
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2014-10-28 14:19:17 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2014-10-28 14:19:17 +0000
commitc61c6f66352171814a5d114527357d837df5cad9 (patch)
tree95e0782ff2f9ea07caf5df35e568926c688625cb /pw/tests/pw_modify.sh
parentb7e8ed77b08007dc43e75eeb44563caf5942668d (diff)
downloadpw-darwin-c61c6f66352171814a5d114527357d837df5cad9.tar.gz
pw-darwin-c61c6f66352171814a5d114527357d837df5cad9.zip
Fix a regression in pw usermod -G list
The user was perperly adding the to different groups from "list" but was not removed from the other groups it could have belong to. While here add a regression test about this bug PR: 185666 Reported by: sub.mesa@gmail.com MFC after: 1 week
Diffstat (limited to 'pw/tests/pw_modify.sh')
-rwxr-xr-xpw/tests/pw_modify.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/pw/tests/pw_modify.sh b/pw/tests/pw_modify.sh
index c3af517..5888111 100755
--- a/pw/tests/pw_modify.sh
+++ b/pw/tests/pw_modify.sh
@@ -38,8 +38,29 @@ groupmod_bug_193704_body() {
atf_check -s exit:65 -e match:"^pw: unknown group" -x pw -V ${HOME} groupshow test
}
+atf_test_case usermod_bug_185666
+usermod_bug_185666_head() {
+ atf_set "descr" "Regression test for the #185666 bug"
+}
+
+usermod_bug_185666_body() {
+ populate_etc_skel
+ atf_check -s exit:0 -x pw -V ${HOME} useradd testuser
+ atf_check -s exit:0 -x pw -V ${HOME} groupadd testgroup
+ atf_check -s exit:0 -x pw -V ${HOME} groupadd testgroup2
+ atf_check -s exit:0 -x pw -V ${HOME} usermod testuser -G testgroup
+ atf_check -o inline:"testuser:*:1001:\n" -x pw -V${HOME} groupshow testuser
+ atf_check -o inline:"testgroup:*:1002:testuser\n" -x pw -V ${HOME} groupshow testgroup
+ atf_check -o inline:"testgroup2:*:1003:\n" -x pw -V${HOME} groupshow testgroup2
+ atf_check -s exit:0 -x pw -V ${HOME} usermod testuser -G testgroup2
+ atf_check -o inline:"testuser:*:1001:\n" -x pw -V ${HOME} groupshow testuser
+ atf_check -o inline:"testgroup:*:1002:\n" -x pw -V ${HOME} groupshow testgroup
+ atf_check -o inline:"testgroup2:*:1003:testuser\n" -x pw -V ${HOME} groupshow testgroup2
+}
+
atf_init_test_cases() {
atf_add_test_case groupmod_user
atf_add_test_case groupmod_invalid_user
atf_add_test_case groupmod_bug_193704
+ atf_add_test_case usermod_bug_185666
}