Page MenuHomeFreeBSD

sockstat: Fix build reproducibility
ClosedPublic

Authored by cperciva on Fri, Oct 10, 8:25 PM.
Tags
None
Referenced Files
F133205562: D53032.id163977.diff
Thu, Oct 23, 11:14 PM
Unknown Object (File)
Sat, Oct 18, 5:15 AM
Unknown Object (File)
Sat, Oct 18, 1:27 AM
Unknown Object (File)
Fri, Oct 17, 3:09 AM
Unknown Object (File)
Mon, Oct 13, 9:54 PM
Unknown Object (File)
Mon, Oct 13, 9:54 PM
Unknown Object (File)
Mon, Oct 13, 9:54 PM
Unknown Object (File)
Mon, Oct 13, 9:54 PM
Subscribers

Details

Summary
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

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

bdrewery added inline comments.
usr.bin/sockstat/tests/Makefile
2–3

Try just .PATH: ${.CURDIR:H} (which is .PATH: ${.CURDIR}/... It should keep 1 copy of the source file but have per-dir object files.

usr.bin/sockstat/tests/Makefile
2–3

To be clear, keep your patch as-is except remove the cp target. Add .PATH line anywhere.

usr.bin/sockstat/tests/Makefile
3

My example had some unintended excess spaces after .PATH:. Is your spacing intended?

usr.bin/sockstat/tests/Makefile
3

It's a single tab character, phabricator just mangles it.

This revision is now accepted and ready to land.Fri, Oct 10, 8:49 PM