From nobody Thu Dec 14 16:07:28 2023 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 4Srcgj0GXDz52gDg; Thu, 14 Dec 2023 16:07:29 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Srcgh6q0Mz3S8P; Thu, 14 Dec 2023 16:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702570049; 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=RFOPfsAaCRFaGtjicpHgLgNcfJMw0AuToOkzqw+lgFg=; b=NSZBbReG6NyaGd9J4+Z6CbFrjrl/OolfmQg54tWnQ+aDXzZFXSK/GClX/MKDq4+Ade72JD +tgIWYZdvu1xDeo9hzO+BBxH19Epnj2aTrQ+Ac9OthBPCl6A7Ycr1J2Fl2gmblOVHJwsi6 W4tSNfKM723IawNXarLO4hKPEypaQcILTxMuyxZM9QIQENUbAMLyOLuQzHlQl78l1txBQZ E/d6iF62koj+E6S2xR1jaJasV9TomlbjvsyCnqkxT1VzYSowNLFhRF6NN2j3jL+djeWvyQ o7CuSPrZj8OwhMDQ2n/CjqIkTZf06ZFI0Mx6rPvTAXijFcgXCgVKHEDCfS98pw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702570049; a=rsa-sha256; cv=none; b=X8nQ+mjb7hGfoNr0UpA4nS5xLNEZ5TAQvSB31qI1LCoG4Qs5wZjR5reRX0QgDw2JytfNcT YlyZ/uVDXnf/u2g3AUvwC0+4b6Zl2YvSPHBX2A63R2z50Y2AEA28qRMmM1POtcIjOdxvJ4 YDyuczpAYtv8KG3NfsflaKZ6D0b3n2iPncI5ekxF0tf9P+klfhPaWNQk2mFmFywXb1mveK WZ1v6UZl+f4P8xDLd1WJ2l3qaNRPW7kChc6bmFEV72y8QyLKSOlutVX4hQfNO9WRrxcVYL G9b53YSQ5Dl7XGWyx/Y/nfGqMoYEB3/Oe4RjciuNTHUFLmTZUS+qIkWVAYpMWA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702570049; 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=RFOPfsAaCRFaGtjicpHgLgNcfJMw0AuToOkzqw+lgFg=; b=X7r0VeWIVFBshe23tWhho3p6fy0soO5f3KNMZaTKXLWGZQogynJQM6IXbgmiA8wkR08TnN GV6ZZAtp03gfJ/QdPBjmWzICtdqFy1Foa7+m+A7TjgXWcw5lBPGVy6y2Nl27C/NVQPll5h WMLrrfn89LmaDeeymcSZ4AGGA03WSyx12CRY+D6EG2NNRPZDSObf9sr09XVpJ1zpzP2Jc3 UrP4vmwGXAeE6ebCPCeRpX2rBObv80kYuFyTAvb4nhWaruOqmTdEQ552pFntGjQe+L2Zr7 HSQiopqY1cbSoniV8WMkfqgJpxT4cJAHbZ+RPwCjtGgmq3er6/YRrKHsXgmx7Q== 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 4Srcgh5rJgzYr2; Thu, 14 Dec 2023 16:07:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BEG7ScZ015406; Thu, 14 Dec 2023 16:07:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BEG7SdP015403; Thu, 14 Dec 2023 16:07:28 GMT (envelope-from git) Date: Thu, 14 Dec 2023 16:07:28 GMT Message-Id: <202312141607.3BEG7SdP015403@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: ac56b9d83c75 - main - cp: Split the basic_symlink test case in two. 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac56b9d83c75f548667912ffe422be6bd4f5c27e Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=ac56b9d83c75f548667912ffe422be6bd4f5c27e commit ac56b9d83c75f548667912ffe422be6bd4f5c27e Author: Dag-Erling Smørgrav AuthorDate: 2023-12-14 16:06:57 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-12-14 16:06:57 +0000 cp: Split the basic_symlink test case in two. This test case tests two different things: first, that copying a symlink results in a file with the same contents as the target of the symlink, rather than a second symlink, and second, that cp will refuse to copy a file to itself, or to a link to itself, or a link to its target. Leave the first part in basic_symlink, move the second part to a new test case named samefile, and slightly expand both cases. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D43062 --- bin/cp/tests/cp_test.sh | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh index a9e419bb39a9..397c06d75bbb 100755 --- a/bin/cp/tests/cp_test.sh +++ b/bin/cp/tests/cp_test.sh @@ -51,10 +51,7 @@ basic_symlink_body() atf_check cp baz foo atf_check test '!' -L foo - atf_check -e inline:"cp: baz and baz are identical (not copied).\n" \ - -s exit:1 cp baz baz - atf_check -e inline:"cp: bar and baz are identical (not copied).\n" \ - -s exit:1 cp baz bar + atf_check cmp foo bar } atf_test_case chrdev @@ -227,6 +224,22 @@ recursive_link_Lflag_body() '(' ! -L foo-mirror/foo/baz ')' } +atf_test_case samefile +samefile_body() +{ + echo "foo" >foo + ln foo bar + ln -s bar baz + atf_check -e match:"baz and baz are identical" \ + -s exit:1 cp baz baz + atf_check -e match:"bar and baz are identical" \ + -s exit:1 cp baz bar + atf_check -e match:"foo and baz are identical" \ + -s exit:1 cp baz foo + atf_check -e match:"bar and foo are identical" \ + -s exit:1 cp foo bar +} + file_is_sparse() { atf_check ${0%/*}/sparse "$1" @@ -234,7 +247,7 @@ file_is_sparse() files_are_equal() { - atf_check test "$(stat -f "%d %i" "$1")" != "$(stat -f "%d %i" "$2")" + atf_check_not_equal "$(stat -f%d,%i "$1")" "$(stat -f%d,%i "$2")" atf_check cmp "$1" "$2" } @@ -365,6 +378,7 @@ atf_init_test_cases() atf_add_test_case recursive_link_dflt atf_add_test_case recursive_link_Hflag atf_add_test_case recursive_link_Lflag + atf_add_test_case samefile atf_add_test_case sparse_leading_hole atf_add_test_case sparse_multiple_holes atf_add_test_case sparse_only_hole