summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2016-06-16 21:22:26 +0000
committeremaste <emaste@FreeBSD.org>2016-06-16 21:22:26 +0000
commit71cb38c340327b7907b35f1febf2b5d1e0449e1d (patch)
treeb1d8ffca66ceb68f565921f653c22ae47e94edd2 /usr.bin
parent0178fb72fc58e545ac43d815e63da9ac616c161a (diff)
downloadFreeBSD-src-71cb38c340327b7907b35f1febf2b5d1e0449e1d.zip
FreeBSD-src-71cb38c340327b7907b35f1febf2b5d1e0449e1d.tar.gz
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 Reviewed by: bdrewery Approved by: re (gjb) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6871
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ar/ar.19
-rw-r--r--usr.bin/ar/ar.c3
2 files changed, 9 insertions, 3 deletions
diff --git a/usr.bin/ar/ar.1 b/usr.bin/ar/ar.1
index 6998c04..9d9a860 100644
--- a/usr.bin/ar/ar.1
+++ b/usr.bin/ar/ar.1
@@ -23,7 +23,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 24, 2015
+.Dd June 16, 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 b93c968..c1050aa 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)
OpenPOWER on IntegriCloud