From nobody Tue Dec 10 23:38:03 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 4Y7FXX4cXtz5g2yS; Tue, 10 Dec 2024 23:38:04 +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 4Y7FXW5wspz4lb7; Tue, 10 Dec 2024 23:38:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733873883; 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=gCdlSbiWwtV4C8Wa9/305CixJ+08RN6sqZIkwtwDFvI=; b=UEa9IX5e6jJFvPQoKJ8uIMX8v7I16mTSlvVx/fpPvoz6Pl+XSBa8xber9lP1it3Yser6TN Q6VC6Mus9tRdYp2aa8igKyldcu1uKS09OoOIOVe/tsL+o7mSfHH1yWNOK1kP0eRGfADEKa d1c5U/VQx7gK+qgk3CzC7B7aEo3FWb8StSvdxlDi2APVlF1jpr2ZfQygCNaxSs6LX4kUug Dc1lpSq8SI5Iv7M/bFf8rpp5cHK9+Re52rxtIV+ngBsRwaaP30Mqw+jYnc7ogKgWenuZwL lMzJqog3CVGYvMqYfxDGaMmTDEmnbJYC/emhrMwlSfoLxFsW9vKpIRm8A5arcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733873883; 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=gCdlSbiWwtV4C8Wa9/305CixJ+08RN6sqZIkwtwDFvI=; b=LAnTGAwwS18jG2XQDMlo4JvCjqOs3U7JdFNkWIJAZ72yk42daVHQc7d1zWMpMZiQoUZZA5 TsGo7ri6KPG1dTDToPj5FNmqmgDpq9ZqfIgILFFZZmZzXdnWynlLzUjgUzaDi9MiH+ZfLC V8flwbmKH3OQ7hPAJtd4EhYde6heJr8iz547YsWldGRlcXyKYIJU9MGr8oD0S96+/Y5bXo Qe27HQojyHWFvhsrxxpG8R/fd7OwF99A5UoiH9OSC3teMejYy20L1xAFwFtwtaVk1Ftv1m WmAYG0OSS4kE10Onb45dOa6RfuURW+fw/RWnDPxDRRNlLNBQ/YzLAP0hH7hJLA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733873883; a=rsa-sha256; cv=none; b=hrthf2rYJZk1UHkAA3O3jSLlvdpW12uovbdnLwHtacoP+HiCx8hFCo4rWt4E4nE7V5Qhza R/5me70HIdm3mccBD77MAW9O7o81G7T5INNw3a5cO/2QbDED8OI2LKMgQlC+bI5JzF06EQ l788l/KyXunBEgvJx4vLcja4W2tmbE5PF8RMYIgoo3K4h7bfnRL6BIqx75NemkiCaLhsiq aISyNMR47TcV7ZtgXI1G/h8IgOmJ5U78bu9fJJcUJ7BMEFWf/ygkRFMA+pXSe4DTcOkdI2 Tmo5FAaZq/wdTQYWArKUGvDf+q6aMPO6O6fU0MmwYdIzgFHf+Y79dV3kh+sM1w== 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 4Y7FXW4b7TzkT9; Tue, 10 Dec 2024 23:38:03 +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 4BANc3X8019962; Tue, 10 Dec 2024 23:38:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BANc336019957; Tue, 10 Dec 2024 23:38:03 GMT (envelope-from git) Date: Tue, 10 Dec 2024 23:38:03 GMT Message-Id: <202412102338.4BANc336019957@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: 9aac1584c846 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 9aac1584c846cbb1dce638222ffc239ed712eb9b Auto-Submitted: auto-generated The branch stable/14 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=9aac1584c846cbb1dce638222ffc239ed712eb9b commit 9aac1584c846cbb1dce638222ffc239ed712eb9b Author: Jose Luis Duran AuthorDate: 2024-12-01 19:05:58 +0000 Commit: Kyle Evans CommitDate: 2024-12-10 23:05:51 +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 b4efa42bada7..6413c063d482 100755 --- a/usr.sbin/pw/tests/pw_useradd_test.sh +++ b/usr.sbin/pw/tests/pw_useradd_test.sh @@ -329,6 +329,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 @@ -528,6 +543,7 @@ atf_init_test_cases() { atf_add_test_case user_add_R_no_symlink atf_add_test_case user_add_R_intermed 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