Date: Fri, 25 Sep 2015 00:23:36 +0000 (UTC) From: Ed Maste <emaste@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r288202 - stable/10/usr.bin/ar Message-ID: <201509250023.t8P0Nap8026114@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: emaste Date: Fri Sep 25 00:23:36 2015 New Revision: 288202 URL: https://svnweb.freebsd.org/changeset/base/288202 Log: MFC r286010: ar: enable deterministic mode by default Ar cannot handle UIDs with more than 6 digits, and storing the mtime, uid, gid and mode provides little to negative value anyhow for ar's uses. Turn on deterministic (-D) mode by default; it can be disabled by the user with -U. Also MFC follow-on fixes in r286024 and r287324. PR: 196929 Relnotes: Yes Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/ar/ar.1 stable/10/usr.bin/ar/ar.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/ar/ar.1 ============================================================================== --- stable/10/usr.bin/ar/ar.1 Fri Sep 25 00:07:31 2015 (r288201) +++ stable/10/usr.bin/ar/ar.1 Fri Sep 25 00:23:36 2015 (r288202) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 31, 2015 +.Dd September 24, 2015 .Dt AR 1 .Os .Sh NAME @@ -210,6 +210,7 @@ and 0644 instead of file mode from the m .Ar . This ensures that checksums on the resulting archives are reproducible when member contents are identical. +This option is enabled by default. If multiple .Fl D and Modified: stable/10/usr.bin/ar/ar.c ============================================================================== --- stable/10/usr.bin/ar/ar.c Fri Sep 25 00:07:31 2015 (r288201) +++ stable/10/usr.bin/ar/ar.c Fri Sep 25 00:23:36 2015 (r288202) @@ -100,10 +100,12 @@ main(int argc, char **argv) struct bsdar *bsdar, bsdar_storage; char *p; size_t len; - int i, opt; + int i, opt, Dflag, Uflag; bsdar = &bsdar_storage; memset(bsdar, 0, sizeof(*bsdar)); + Dflag = 0; + Uflag = 0; if ((bsdar->progname = getprogname()) == NULL) bsdar->progname = "ar"; @@ -120,10 +122,12 @@ main(int argc, char **argv) /* Ignored. */ break; case 'D': - bsdar->options |= AR_D; + Dflag = 1; + Uflag = 0; break; case 'U': - bsdar->options &= ~AR_D; + Uflag = 1; + Dflag = 0; break; case 'V': ranlib_version(); @@ -140,6 +144,9 @@ main(int argc, char **argv) if (*argv == NULL) ranlib_usage(); + /* Enable determinstic mode unless -U is set. */ + if (Uflag == 0) + bsdar->options |= AR_D; bsdar->options |= AR_S; while ((bsdar->filename = *argv++) != NULL) ar_mode_s(bsdar); @@ -180,7 +187,8 @@ main(int argc, char **argv) set_mode(bsdar, opt); break; case 'D': - bsdar->options |= AR_D; + Dflag = 1; + Uflag = 0; break; case 'f': case 'T': @@ -220,7 +228,8 @@ main(int argc, char **argv) set_mode(bsdar, opt); break; case 'U': - bsdar->options &= ~AR_D; + Uflag = 1; + Dflag = 0; break; case 'u': bsdar->options |= AR_U; @@ -273,6 +282,10 @@ main(int argc, char **argv) argv++; } + /* Set determinstic mode for -D, and by default without -U. */ + if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r'))) + bsdar->options |= AR_D; + if (bsdar->options & AR_A) only_mode(bsdar, "-a", "mqr"); if (bsdar->options & AR_B) @@ -281,8 +294,10 @@ main(int argc, char **argv) only_mode(bsdar, "-c", "qr"); if (bsdar->options & AR_CC) only_mode(bsdar, "-C", "x"); - if (bsdar->options & AR_D) + if (Dflag) only_mode(bsdar, "-D", "qr"); + if (Uflag) + only_mode(bsdar, "-U", "qr"); if (bsdar->options & AR_O) only_mode(bsdar, "-o", "x"); if (bsdar->options & AR_SS)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509250023.t8P0Nap8026114>