r286024 lets ranlib ignore the -D flag and default to non-deterministic mode as the chunk that sets AR_D is only reached when running as ar.
The attached patch is one way to fix this. Obtained from ElectroBSD.
Created attachment 160479 [details]
usr.bin/ar: Fix deterministic mode when running as ranlib
A commit references this bug:
Date: Mon Aug 31 12:28:14 UTC 2015
New revision: 287324
ar: fix deterministic mode when running as ranlib
This was broken by r286024.
Submitted by: firstname.lastname@example.org
Obtained from: ElectroBSD
I intend to MFC the change to enable deterministic mode by default, and will include this fix.