git: b0c147af0862 - stable/13 - cp: Simplify sameness checks

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 09 Oct 2025 12:21:33 UTC
The branch stable/13 has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=b0c147af08621b476f5b50905ecf13ba1124228f

commit b0c147af08621b476f5b50905ecf13ba1124228f
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-10-07 16:23:39 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-10-08 11:44:39 +0000

    cp: Simplify sameness checks
    
    Sponsored by:   Klara, Inc.
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D52926
    
    (cherry picked from commit 95de78614a57733807c28c05125ed0636309d88b)
---
 bin/cp/tests/cp_test.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/cp/tests/cp_test.sh b/bin/cp/tests/cp_test.sh
index 397c06d75bbb..d3d1d6e42c93 100755
--- a/bin/cp/tests/cp_test.sh
+++ b/bin/cp/tests/cp_test.sh
@@ -74,7 +74,7 @@ hardlink_body()
 	echo "foo" >foo
 	atf_check cp -l foo bar
 	atf_check -o inline:"foo\n" cat bar
-	atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
+	atf_check test foo -ef bar
 }
 
 atf_test_case hardlink_exists
@@ -84,7 +84,7 @@ hardlink_exists_body()
 	echo "bar" >bar
 	atf_check -s not-exit:0 -e match:exists cp -l foo bar
 	atf_check -o inline:"bar\n" cat bar
-	atf_check_not_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
+	atf_check test ! foo -ef bar
 }
 
 atf_test_case hardlink_exists_force
@@ -94,7 +94,7 @@ hardlink_exists_force_body()
 	echo "bar" >bar
 	atf_check cp -fl foo bar
 	atf_check -o inline:"foo\n" cat bar
-	atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
+	atf_check test foo -ef bar
 }
 
 atf_test_case matching_srctgt
@@ -247,7 +247,7 @@ file_is_sparse()
 
 files_are_equal()
 {
-	atf_check_not_equal "$(stat -f%d,%i "$1")" "$(stat -f%d,%i "$2")"
+	atf_check test ! "$1" -ef "$2"
 	atf_check cmp "$1" "$2"
 }