From: Roland McGrath Date: Sun, 6 Nov 2011 04:08:07 +0000 (-0700) Subject: ar: Implement -D. X-Git-Tag: elfutils-0.153~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e5ba2a160bea234b1f38d6e4e7a09ef898017c51;p=platform%2Fupstream%2Felfutils.git ar: Implement -D. --- diff --git a/NEWS b/NEWS index 75db63c..324644d 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,8 @@ libdw: Support reading .zdebug_* DWARF sections compressed via zlib. nm: Support C++ demangling. +ar: Support D modifier for "deterministic output" with no uid/gid/mtime info. + Version 0.152 Various build and warning nits fixed for newest GCC and Autoconf. diff --git a/src/ChangeLog b/src/ChangeLog index d777ca1..8cfa986 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,9 @@ 2011-11-05 Roland McGrath + * ar.c (deterministic_output): New flag variable. + (options, parse_opt): Grok -D to set it. + (do_oper_insert): When set, use zero from mtime, uid, and gid. + * ar.c (do_oper_insert): Fix check on elf_rawfile return value. 2011-10-04 Marek Polacek diff --git a/src/ar.c b/src/ar.c index 37d56b6..ce5078e 100644 --- a/src/ar.c +++ b/src/ar.c @@ -95,6 +95,8 @@ static const struct argp_option options[] = { NULL, 'a', NULL, 0, N_("Insert file after [MEMBER]."), 0 }, { NULL, 'b', NULL, 0, N_("Insert file before [MEMBER]."), 0 }, { NULL, 'i', NULL, 0, N_("Same as -b."), 0 }, + { NULL, 'D', NULL, 0, + N_("Use zero for uid, gid, and date in archive members."), 0 }, { NULL, 'c', NULL, 0, N_("Suppress message when library has to be created."), 0 }, { NULL, 'P', NULL, 0, N_("Use full path for file matching."), 0 }, @@ -141,6 +143,7 @@ static bool allow_truncate_fname; static bool force_symtab; static bool suppress_create_msg; static bool full_path; +static bool deterministic_output; static bool update_newer; static enum { ipos_none, ipos_before, ipos_after } ipos; @@ -380,6 +383,10 @@ parse_opt (int key, char *arg __attribute__ ((unused)), allow_truncate_fname = true; break; + case 'D': + deterministic_output = true; + break; + case 'u': update_newer = true; break; @@ -1295,9 +1302,9 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc, found[cnt]->old_off == -1l ? 'a' : 'r', argv[cnt]); found[cnt]->elf = newelf; - found[cnt]->sec = newst.st_mtime; - found[cnt]->uid = newst.st_uid; - found[cnt]->gid = newst.st_gid; + found[cnt]->sec = deterministic_output ? 0 : newst.st_mtime; + found[cnt]->uid = deterministic_output ? 0 : newst.st_uid; + found[cnt]->gid = deterministic_output ? 0 : newst.st_gid; found[cnt]->mode = newst.st_mode; found[cnt]->name = bname;