]> Dogcows Code - chaz/tar/commitdiff
Honor the pax-option overrides when creating archive.
authorSergey Poznyakoff <gray@gnu.org>
Fri, 7 Nov 2014 11:03:18 +0000 (13:03 +0200)
committerSergey Poznyakoff <gray@gnu.org>
Fri, 7 Nov 2014 11:15:54 +0000 (13:15 +0200)
Changes proposed by Denis Excoffier.

* NEWS: Fix typos.
* doc/tar.texi: Fix typos.  Improve recipe for creation of binary
equivalent archives.
* src/create.c (write_extended): Use the value of the
--mtime option (if specified) as the default for exthdr.mtime.
* src/xheader.c (xheader_store): Create the header if at least
one override is supplied in --pax-option.

NEWS
doc/tar.texi
src/create.c
src/xheader.c

diff --git a/NEWS b/NEWS
index 32bc881da09040acd8d9eacca246204bfa03c4dd..c3385f8b6ce6e3864f250cde9efaac9ce4f4050a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU tar NEWS - User visible changes. 2014-07-27
+GNU tar NEWS - User visible changes. 2014-11-07
 Please send GNU tar bug reports to <bug-tar@gnu.org>
 
 \f
@@ -369,7 +369,7 @@ Modification times in ustar header blocks of extended headers
 are set to mtimes of the corresponding archive members.  This
 can be overridden by the
 
-  --pax-opion='exthdr.mtime=STRING'
+  --pax-option='exthdr.mtime=STRING'
 
 command line option.  The STRING is either number of seconds since
 the Epoch or a "Time reference" (see below).
@@ -379,7 +379,7 @@ headers are set to the time when tar was invoked.
 
 This can be overridden by the
 
-  --pax-opion='globexthdr.mtime=STRING'
+  --pax-option='globexthdr.mtime=STRING'
 
 command line option.  The STRING is either number of seconds since
 the Epoch or a "Time reference" (see below).
index 0adcfc0643f5ad1cd7cd613cb32e1e0f2005ce8c..119ae168ed98f352103955fbe0097168352de172 100644 (file)
@@ -9930,7 +9930,8 @@ will use the following default value:
 This keyword defines the value of the @samp{mtime} field that
 is written into the ustar header blocks for the extended headers.
 By default, the @samp{mtime} field is set to the modification time
-of the archive member described by that extended headers.
+of the archive member described by that extended header (or to the
+value of the @option{--mtime} option, if supplied).
 
 @item globexthdr.name=@var{string}
 This keyword allows user control over the name that is written into
@@ -10023,6 +10024,22 @@ same contents:
 --pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0
 @end smallexample
 
+@noindent
+If you extract files from such an archive and recreate the archive
+from them, you will also need to eliminate changes due to ctime, as
+shown in examples below:
+
+@smallexample
+--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,ctime:=0
+@end smallexample
+
+@noindent
+or
+
+@smallexample
+--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0,delete=ctime
+@end smallexample
+
 @node Checksumming
 @subsection Checksumming Problems
 
index e2f4ede6b8d12c1200c931f9f425c9537a72906b..0d1a5ffe99315f52410f1ca9ab9172fa3286d6d6 100644 (file)
@@ -706,7 +706,7 @@ write_extended (bool global, struct tar_stat_info *st, union block *old_header)
     {
       type = XHDTYPE;
       p = xheader_xhdr_name (st);
-      t = st->stat.st_mtime;
+      t = set_mtime_option ? mtime_option.tv_sec : st->stat.st_mtime;
     }
   xheader_write (type, p, t, &st->xhdr);
   free (p);
index 361f684751806c5482d44f9c1fa1ed1f397c6ac7..b7a54a66fb40b1329f7c23aaf4b40cdd4837a417 100644 (file)
@@ -813,11 +813,11 @@ xheader_store (char const *keyword, struct tar_stat_info *st,
   t = locate_handler (keyword);
   if (!t || !t->coder)
     return;
-  if (xheader_keyword_deleted_p (keyword)
-      || xheader_keyword_override_p (keyword))
+  if (xheader_keyword_deleted_p (keyword))
     return;
   xheader_init (&st->xhdr);
-  t->coder (st, keyword, &st->xhdr, data);
+  if (!xheader_keyword_override_p (keyword))
+    t->coder (st, keyword, &st->xhdr, data);
 }
 
 void
This page took 0.030167 seconds and 4 git commands to generate.