bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] to be included in tar-1.29 perhaps


From: Denis Excoffier
Subject: [Bug-tar] to be included in tar-1.29 perhaps
Date: Thu, 23 Oct 2014 22:17:03 +0200

Hello,

I didn't get any comments on these points since July 30th. Perhaps someone will
be more interested now?

1) I have some problems to make
--create --format=posix --pax-option=mtime:=1,atime:=2,ctime:=3
to work as expected. I expect an extended header to be created for
all archive members. Apparently, the extended header is present only when it is
created for other reasons (eg path too long), and in this case, the keywords
are indeed set with the values indicated. The following patch works for me in
this respect, at least for archive creation:

--- xheader.c.original  2014-02-25 23:25:37.000000000 +0100
+++ xheader.c.patched   2014-07-30 18:29:25.000000000 +0200
@@ -803,10 +803,11 @@
   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);
+  if (xheader_keyword_override_p (keyword))
+    return;
   t->coder (st, keyword, &st->xhdr, data);
 }
 

2) I suggest that the value of the --mtime option (when
specified) be used as the default value for exthdr.mtime,
instead of using the modification time of the corresponding
member. This is implemented in the following patch (a test case
is missing):

diff -uNr tar-1.28.original/doc/tar.texi tar-1.28.patched/doc/tar.texi
--- tar-1.28.original/doc/tar.texi      2014-07-22 02:37:16.000000000 +0200
+++ tar-1.28.patched/doc/tar.texi       2014-07-30 18:50:10.000000000 +0200
@@ -9925,8 +9925,10 @@
 
 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.
+By default, the @samp{mtime} field is set to the argument of the
address@hidden option if it is specified, otherwise it is set to
+the modification time of the archive member described by
+that extended headers.
 
 @item address@hidden
 This keyword allows user control over the name that is written into
diff -uNr tar-1.28.original/src/create.c tar-1.28.patched/src/create.c
--- tar-1.28.original/src/create.c      2014-03-02 20:06:36.000000000 +0100
+++ tar-1.28.patched/src/create.c       2014-07-30 18:36:05.000000000 +0200
@@ -706,7 +706,7 @@
     {
       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);


3) About the documentation: in the node 'PAX keywords' it is indicated
that any two archives created using
--pax-option=exthdr.name=%d/PaxHeaders/%f,atime:=0
will be binary equivalent. Although this can be understood to be true
in theory, in practice you always have to manage 'ctime' (eg once your
archive is created, you cannot extract + create it again and still obtain
the same archive). Therefore i'd suggest that 'delete=ctime' or 'ctime:=0'
is added in the example if one is especially concerned with binary equivalence.


4)
s/pax.opion/pax.option/ in NEWS
s/that extended headers/that extended header/ in tar.texi


Regards,

Denis Excoffier.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]