diff options
author | emaste <emaste@FreeBSD.org> | 2016-07-25 14:35:14 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-07-25 14:35:14 +0000 |
commit | 8027677b691a675281628b8570a8d87dc82c7818 (patch) | |
tree | c3dad32ef6af03e99e207dc57c367b895ef9ab5b | |
parent | c41d5d1a73024e066e5b8cfa204ad0ca54ad79d7 (diff) | |
download | FreeBSD-src-8027677b691a675281628b8570a8d87dc82c7818.zip FreeBSD-src-8027677b691a675281628b8570a8d87dc82c7818.tar.gz |
MFC r301974: ar: enable reproducible output by default when invoked as 'ar -s'
ar output is already deterministic by default for ar -q and ar -r, and
when invoked as ranlib. Make ar -s equivalent to ranlib and enable
deterministic output by default in that case too.
PR: 210330
Sponsored by: The FreeBSD Foundation
-rw-r--r-- | usr.bin/ar/ar.1 | 9 | ||||
-rw-r--r-- | usr.bin/ar/ar.c | 3 |
2 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ar/ar.1 b/usr.bin/ar/ar.1 index 079d262..ed8266c 100644 --- a/usr.bin/ar/ar.1 +++ b/usr.bin/ar/ar.1 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 24, 2015 +.Dd July 25, 2016 .Dt AR 1 .Os .Sh NAME @@ -205,7 +205,12 @@ When used in combination with the .Fl r or .Fl q -option, insert 0's instead of the real mtime, uid and gid values +option, +with the +.Fl s +option without other options, or when invoked as +.Nm ranlib , +insert 0's instead of the real mtime, uid and gid values and 0644 instead of file mode from the members named by arguments .Ar . This ensures that checksums on the resulting archives are reproducible diff --git a/usr.bin/ar/ar.c b/usr.bin/ar/ar.c index 0c69315..0ab06a0 100644 --- a/usr.bin/ar/ar.c +++ b/usr.bin/ar/ar.c @@ -283,7 +283,8 @@ main(int argc, char **argv) } /* Set determinstic mode for -D, and by default without -U. */ - if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r'))) + if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r' || + (bsdar->mode == '\0' && bsdar->options & AR_S)))) bsdar->options |= AR_D; if (bsdar->options & AR_A) |