git: 9934558460e4 - main - sockstat: Fix build reproducibility

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Fri, 10 Oct 2025 20:51:07 UTC
The branch main has been updated by cperciva:

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

commit 9934558460e4e73e5b55648c4b13a702f4f019d7
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2025-10-10 20:13:58 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-10-10 20:50:45 +0000

    sockstat: Fix build reproducibility
    
    Both usr.bin/sockstat and usr.bin/sockstat/tests build the file
    src/usr.bin/sockstat/sockstat.c.  Unfortunately, they place the
    resulting object file in the same place, but produce different
    files due to paths appearing in the .debug files; this results
    in different binaries depending on how the race between the two
    builds ends.
    
    Use .PATH to tell make to find sockstat.c in the parent directory
    but place the object file in the current object directory, rather
    than placing '..' into the name of the source file.
    
    Suggested by:   bdrewery, emaste, jrtc27
    MFC after:      5 minutes (15.0 build fix)
    Sponsored by:   https://www.patreon.com/cperciva
    Differential Revision:  https://reviews.freebsd.org/D53032
---
 usr.bin/sockstat/tests/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/usr.bin/sockstat/tests/Makefile b/usr.bin/sockstat/tests/Makefile
index 9971bca2d474..5412e9d842aa 100644
--- a/usr.bin/sockstat/tests/Makefile
+++ b/usr.bin/sockstat/tests/Makefile
@@ -1,5 +1,6 @@
 ATF_TESTS_C+=	sockstat_test
-SRCS.sockstat_test= sockstat_test.c ../sockstat.c
+SRCS.sockstat_test= sockstat_test.c sockstat.c
+.PATH:	${.CURDIR:H}
 
 LIBADD=		xo