From nobody Tue Dec 10 23:38:10 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y7FXg18wWz5g2yZ; Tue, 10 Dec 2024 23:38:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y7FXf6Cwcz4lH4; Tue, 10 Dec 2024 23:38:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733873890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qtGQU/49NTs1Um3QWjhF2AH6I9qgGAMncLlmqrRE6eo=; b=bgghvrlFAfsJWAY37bvs1/qHPuVAfucNAS8KoN7Fkwm57ZoTniVlJoCEBlGR8lEXyxQ14B ZEdTLybDOXRu4B/iWwKRWVPRaZjK31aR+QlSsR+yfn771EyDFlehF+HgtYXqva7T5qYk0V nGNwvrUGbroGAekFZDQ0BLfWJpY2uU4GIwiMI1wE9bVxOMRTMqygtVAys2pfF2P71icj0V TvdCB4HSBh4PXpZdUatbVsmddyQAQ2e3L/tkpStAedVfx9C9dtRKljQ0vClI/p+44FBwRN +281kYVlEgovONAo39J2MVspWlP6WGN9gCt32Ge04IGr7UbtK1M3X/JOb13+nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733873890; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qtGQU/49NTs1Um3QWjhF2AH6I9qgGAMncLlmqrRE6eo=; b=NF3CHfg31cTdXGsmceZIPKEfhAnykuPk85xbzfIaFqRD+a0EOBhPj4qa26ZFRNFw5HEwJ5 +aNjsAsSGspBqhulTsgeIpt+TM/ZTLqDBw/u9DGEWAYdfX6IU2IWcEzhsUXGWI1EGaYMga etkFNTLxN5g+o7Yf2Z9AwxZ6XJUkCPi+IMoN8GAAsAE6lj60TLACIUT2oSAQ8x9LlIgzj1 Y7Vp77TYY7jW0Np4KVwO5jsC+nu4v35RWPulMQQiLSDPUW2g+xFCyeMn1b3kIZCmmFAjLh ypIT88rqVYpakYuJ/3C7Dn1Wh7/BbKGeSgOb/J/mYKI9h6IZDQLs0rmqqfl6Bg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733873890; a=rsa-sha256; cv=none; b=ebKZaaPVukAprSmAZ1vu4zSdJKtnNPzDcqbxwIKooBZ4qBXVGw79Th5qXDi0diQxkSNH0B jy+rsBoKAeYUfrK3zc6RhCGtOc47u9QSLl4SjZEQr0K8mL4h+XnC/kJJxmwbfe0uPcVRd+ V3tRbclZCidy3SsQmqcbO1zspAFXbbAwLADYQ2h0tiEqUOlfZ1/WBIOfXAkEzXGPPP2RiQ AlhKpy3DrYVpWpLEiF4a5pzVQB2M6VUPgA9OsY3Can1+HAnSK89SSj59BibjLu+f8b7I0R INgKWnjQcybyBrmuXunOLRpWZIIJVl5hQ8v7WLVnX/Mm8beUJIGY9XpPnija5A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y7FXf5r9hzkQm; Tue, 10 Dec 2024 23:38:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BANcAUH020429; Tue, 10 Dec 2024 23:38:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BANcAEw020424; Tue, 10 Dec 2024 23:38:10 GMT (envelope-from git) Date: Tue, 10 Dec 2024 23:38:10 GMT Message-Id: <202412102338.4BANcAEw020424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: 9d8a178b38ed - stable/13 - pw: tests: add a test for -M with a pre-existing home directory List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9d8a178b38ed0953f2beaa49c0dd3981cce56179 Auto-Submitted: auto-generated The branch stable/13 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9d8a178b38ed0953f2beaa49c0dd3981cce56179 commit 9d8a178b38ed0953f2beaa49c0dd3981cce56179 Author: Jose Luis Duran AuthorDate: 2024-12-01 19:05:58 +0000 Commit: Kyle Evans CommitDate: 2024-12-10 23:06:16 +0000 pw: tests: add a test for -M with a pre-existing home directory Previous versions of pw(8) wouldn't chmod the home directory if it already existed prior to user creation, rendering adduser(8) -M ineffective in some cases. Add a test to cover that situation. PR: 280099 Reviewed by: kevans (cherry picked from commit f7cf62cf728a942e494a5b58438600998606617a) --- usr.sbin/pw/tests/pw_useradd_test.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/usr.sbin/pw/tests/pw_useradd_test.sh b/usr.sbin/pw/tests/pw_useradd_test.sh index 93a192c59409..0da1877c3283 100755 --- a/usr.sbin/pw/tests/pw_useradd_test.sh +++ b/usr.sbin/pw/tests/pw_useradd_test.sh @@ -321,6 +321,21 @@ user_add_dir_body() { stat -f '%p' ${HOME}/home/foo } +atf_test_case user_add_existing_dir +user_add_existing_dir_body() { + populate_root_etc_skel + + mkdir -p -m 0777 ${HOME}/home/foo + atf_check -o inline:"40777\n" \ + stat -f '%p' ${HOME}/home/foo + + atf_check -s exit:0 ${RPW} useradd foo -M 0705 -m + atf_check grep -q '^foo:' $HOME/etc/master.passwd + atf_check test -d ${HOME}/home/foo + atf_check -o inline:"40705\n" \ + stat -f '%p' ${HOME}/home/foo +} + atf_test_case user_add_skel user_add_skel_body() { populate_root_etc_skel @@ -496,6 +511,7 @@ atf_init_test_cases() { atf_add_test_case user_add_R atf_add_test_case user_add_R_symlink atf_add_test_case user_add_dir + atf_add_test_case user_add_existing_dir atf_add_test_case user_add_skel atf_add_test_case user_add_uid0 atf_add_test_case user_add_uid_too_large