From nobody Sun Dec 01 19:10:52 2024 X-Original-To: dev-commits-src-main@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 4Y1c2N6m26z5g3rQ; Sun, 01 Dec 2024 19:10:52 +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 4Y1c2N1XXkz46Vr; Sun, 1 Dec 2024 19:10:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733080252; 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=x2cTdXRpcO2JdFKZ4t8rwt4WuX+CozOcXpfMmejElmo=; b=XglU3ajkIyMiADJtc3Zce8b/ZlS3zWPhdDPHEIfxMOE5gidWjpVTjgVtzS2pGAYeJ2jYHy w2+SlywRVRiYdu3XwaKM23vj2Xp1SoN65eEVZWFqA3Dz1J2nH22vroAfi+Pyeeht6+J70J 7CCHTjw7r0qaFuDaL2gyFiovMiWGbF9cb80uV9efJOIjoGmOsDN9HLGNLZMpvURAnKPp+z w4J4vOFbKc3xojnn74UZPmXFM9zCjRWnlTg3x/odlOauUkQSQ52pqSBXTfJh6t6Vsu9bw8 VLgHQ8taqblReJ79xAZXByXpNBdIPtkqZSly/3rKYKalNYLGpebkHkgegaMV7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733080252; 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=x2cTdXRpcO2JdFKZ4t8rwt4WuX+CozOcXpfMmejElmo=; b=uYg+12xelUlyMTfxHEQThYZYv6IfitpcY1i1onqUiYWyb3MnRxhusLKjZa8X2V9sYt4hTs fyIljlBcHYFuNwo4Ai23hUvGkxFyN2iO18CRVssp0b2RThIkjwfmLqcFqYOMZTUmeK7m/r A5NxBjKqZR0S5/VkOY4S/LGUKO/nyVthVgXyVPfkJ/ZDLFVCukjmel2WQhXxxQ6qkLYMCN e/XCxMig+BjHaRQwk3JpbKLdiH1J+bQTk0YcgC4uBv5lA5c0OUi/xDJfa9RuFKXeBmQf9a mscXJZQ0GcxNvs/LBmrzKCJTYKR20K+c1uTC1FePEjInj6zXQXzEBKyntTCPNA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733080252; a=rsa-sha256; cv=none; b=r9WEMgySwvTNaMvkM+ELg1nsnal83tg6VpUTbS07uUi6VICpUdmtBhZIiv3E1MfMPFTip0 JvoIR8qQdapJdj/bH6OTOlyMGeobwrxlTp3Ihoi8uNb7L1WHDpuyXH2Y8vlg7ptUlTWOq4 MQT3qiTwgAi3sdjEwGuzDSrM4jXoiD+dSvfOOTwMrlVUNLMYu7p30ACvGxn4qKsrsc2jkT wXVlaAWfMJlrBWHBhEYDo3j/cUHIP+KgtppUryNUC2arFinuQ4OI43YCk/tvMMU99NAwGV ooezbYlI++6TzyQwPdl92zV/aU82Bsv2RhTSwdYziOPs76QJ9Ik4RNzsu4vNag== 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 4Y1c2N15xtz159t; Sun, 1 Dec 2024 19:10:52 +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 4B1JAqlH095892; Sun, 1 Dec 2024 19:10:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B1JAqY9095889; Sun, 1 Dec 2024 19:10:52 GMT (envelope-from git) Date: Sun, 1 Dec 2024 19:10:52 GMT Message-Id: <202412011910.4B1JAqY9095889@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f7cf62cf728a - main - pw: tests: add a test for -M with a pre-existing home directory List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: f7cf62cf728a942e494a5b58438600998606617a Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f7cf62cf728a942e494a5b58438600998606617a commit f7cf62cf728a942e494a5b58438600998606617a Author: Jose Luis Duran AuthorDate: 2024-12-01 19:05:58 +0000 Commit: Kyle Evans CommitDate: 2024-12-01 19:10:35 +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 --- 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