summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2011-11-05 21:08:07 -0700
committerRoland McGrath <roland@hack.frob.com>2011-11-05 21:08:07 -0700
commite5ba2a160bea234b1f38d6e4e7a09ef898017c51 (patch)
treee906a628062ca023550d2212b6c934e74ef225bd
parent4fa988e13d09465b8ae4f605333fabf39d50fd30 (diff)
downloadelfutils-e5ba2a160bea234b1f38d6e4e7a09ef898017c51.tar.gz
ar: Implement -D.
-rw-r--r--NEWS2
-rw-r--r--src/ChangeLog4
-rw-r--r--src/ar.c13
3 files changed, 16 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 75db63c0..324644dd 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 d777ca1a..8cfa9860 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
2011-11-05 Roland McGrath <roland@hack.frob.com>
+ * 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 <mpolacek@redhat.com>
diff --git a/src/ar.c b/src/ar.c
index 37d56b64..ce5078e4 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;