1 /* POSIX extended headers for tar.
3 Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any later
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
31 static bool xheader_protected_pattern_p (char const *pattern
);
32 static bool xheader_protected_keyword_p (char const *keyword
);
33 static void xheader_set_single_keyword (char *) __attribute__ ((noreturn
));
35 /* Used by xheader_finish() */
36 static void code_string (char const *string
, char const *keyword
,
37 struct xheader
*xhdr
);
38 static void extended_header_init (void);
40 /* Number of global headers written so far. */
41 static size_t global_header_count
;
42 /* FIXME: Possibly it should be reset after changing the volume.
43 POSIX %n specification says that it is expanded to the sequence
44 number of current global header in *the* archive. However, for
45 multi-volume archives this will yield duplicate header names
46 in different volumes, which I'd like to avoid. The best way
47 to solve this would be to use per-archive header count as required
48 by POSIX *and* set globexthdr.name to, say,
49 $TMPDIR/GlobalHead.%p.$NUMVOLUME.%n.
51 However it should wait until buffer.c is finally rewritten */
58 struct keyword_list
*next
;
64 /* List of keyword patterns set by delete= option */
65 static struct keyword_list
*keyword_pattern_list
;
67 /* List of keyword/value pairs set by `keyword=value' option */
68 static struct keyword_list
*keyword_global_override_list
;
70 /* List of keyword/value pairs set by `keyword:=value' option */
71 static struct keyword_list
*keyword_override_list
;
73 /* List of keyword/value pairs decoded from the last 'g' type header */
74 static struct keyword_list
*global_header_override_list
;
76 /* Template for the name field of an 'x' type header */
77 static char *exthdr_name
;
79 /* Template for the name field of a 'g' type header */
80 static char *globexthdr_name
;
83 xheader_keyword_deleted_p (const char *kw
)
85 struct keyword_list
*kp
;
87 for (kp
= keyword_pattern_list
; kp
; kp
= kp
->next
)
88 if (fnmatch (kp
->pattern
, kw
, 0) == 0)
94 xheader_keyword_override_p (const char *keyword
)
96 struct keyword_list
*kp
;
98 for (kp
= keyword_override_list
; kp
; kp
= kp
->next
)
99 if (strcmp (kp
->pattern
, keyword
) == 0)
105 xheader_list_append (struct keyword_list
**root
, char const *kw
,
108 struct keyword_list
*kp
= xmalloc (sizeof *kp
);
109 kp
->pattern
= xstrdup (kw
);
110 kp
->value
= value
? xstrdup (value
) : NULL
;
116 xheader_list_destroy (struct keyword_list
**root
)
120 struct keyword_list
*kw
= *root
;
123 struct keyword_list
*next
= kw
->next
;
134 xheader_set_single_keyword (char *kw
)
136 USAGE_ERROR ((0, 0, _("Keyword %s is unknown or not yet imlemented"), kw
));
140 xheader_set_keyword_equal (char *kw
, char *eq
)
151 while (p
> kw
&& isspace (*p
))
156 for (p
= eq
+ 1; *p
&& isspace (*p
); p
++)
159 if (strcmp (kw
, "delete") == 0)
161 if (xheader_protected_pattern_p (p
))
162 USAGE_ERROR ((0, 0, _("Pattern %s cannot be used"), quote (p
)));
163 xheader_list_append (&keyword_pattern_list
, p
, NULL
);
165 else if (strcmp (kw
, "exthdr.name") == 0)
166 assign_string (&exthdr_name
, p
);
167 else if (strcmp (kw
, "globexthdr.name") == 0)
168 assign_string (&globexthdr_name
, p
);
171 if (xheader_protected_keyword_p (kw
))
172 USAGE_ERROR ((0, 0, _("Keyword %s cannot be overridden"), kw
));
174 xheader_list_append (&keyword_global_override_list
, kw
, p
);
176 xheader_list_append (&keyword_override_list
, kw
, p
);
181 xheader_set_option (char *string
)
184 for (token
= strtok (string
, ","); token
; token
= strtok (NULL
, ","))
186 char *p
= strchr (token
, '=');
188 xheader_set_single_keyword (token
);
190 xheader_set_keyword_equal (token
, p
);
195 string Includes: Replaced By:
196 %d The directory name of the file,
197 equivalent to the result of the
198 dirname utility on the translated
200 %f The filename of the file, equivalent
201 to the result of the basename
202 utility on the translated file name.
203 %p The process ID of the pax process.
204 %% A '%' character. */
207 xheader_format_name (struct tar_stat_info
*st
, const char *fmt
, bool allow_n
)
210 size_t len
= strlen (fmt
);
215 char pidbuf
[UINTMAX_STRSIZE_BOUND
];
217 char nbuf
[UINTMAX_STRSIZE_BOUND
];
218 char const *nptr
= NULL
;
220 for (p
= fmt
; *p
&& (p
= strchr (p
, '%')); )
231 dir
= safer_name_suffix (dir_name (st
->orig_file_name
),
232 false, absolute_names_option
);
233 len
+= strlen (dir
) - 1;
240 base
= base_name (st
->orig_file_name
);
241 len
+= strlen (base
) - 1;
246 pptr
= umaxtostr (getpid (), pidbuf
);
247 len
+= pidbuf
+ sizeof pidbuf
- 1 - pptr
- 1;
253 nptr
= umaxtostr (global_header_count
+ 1, nbuf
);
254 len
+= nbuf
+ sizeof nbuf
- 1 - nptr
- 1;
261 buf
= xmalloc (len
+ 1);
262 for (q
= buf
, p
= fmt
; *p
; )
281 q
= stpcpy (q
, base
);
286 q
= stpcpy (q
, pptr
);
293 q
= stpcpy (q
, nptr
);
296 /* else fall through */
308 /* Do not allow it to end in a slash */
309 while (q
> buf
&& ISSLASH (q
[-1]))
316 xheader_xhdr_name (struct tar_stat_info
*st
)
319 assign_string (&exthdr_name
, "%d/PaxHeaders.%p/%f");
320 return xheader_format_name (st
, exthdr_name
, false);
323 #define GLOBAL_HEADER_TEMPLATE "/GlobalHead.%p.%n"
326 xheader_ghdr_name (void)
328 if (!globexthdr_name
)
331 const char *tmp
= getenv ("TMPDIR");
334 len
= strlen (tmp
) + sizeof (GLOBAL_HEADER_TEMPLATE
); /* Includes nul */
335 globexthdr_name
= xmalloc (len
);
336 strcpy(globexthdr_name
, tmp
);
337 strcat(globexthdr_name
, GLOBAL_HEADER_TEMPLATE
);
340 return xheader_format_name (NULL
, globexthdr_name
, true);
344 xheader_write (char type
, char *name
, struct xheader
*xhdr
)
351 header
= start_private_header (name
, size
);
352 header
->header
.typeflag
= type
;
354 simple_finish_header (header
);
362 header
= find_next_block ();
366 memcpy (header
->buffer
, p
, len
);
368 memset (header
->buffer
+ len
, 0, BLOCKSIZE
- len
);
371 set_next_block_after (header
);
374 xheader_destroy (xhdr
);
378 xheader_write_global (void)
381 struct keyword_list
*kp
;
383 if (!keyword_global_override_list
)
386 extended_header_init ();
387 for (kp
= keyword_global_override_list
; kp
; kp
= kp
->next
)
388 code_string (kp
->value
, kp
->pattern
, &extended_header
);
389 xheader_finish (&extended_header
);
390 xheader_write (XGLTYPE
, name
= xheader_ghdr_name (),
393 global_header_count
++;
397 /* General Interface */
402 void (*coder
) (struct tar_stat_info
const *, char const *,
403 struct xheader
*, void *data
);
404 void (*decoder
) (struct tar_stat_info
*, char const *);
408 /* This declaration must be extern, because ISO C99 section 6.9.2
409 prohibits a tentative definition that has both internal linkage and
410 incomplete type. If we made it static, we'd have to declare its
411 size which would be a maintenance pain; if we put its initializer
412 here, we'd need a boatload of forward declarations, which would be
413 even more of a pain. */
414 extern struct xhdr_tab
const xhdr_tab
[];
416 static struct xhdr_tab
const *
417 locate_handler (char const *keyword
)
419 struct xhdr_tab
const *p
;
421 for (p
= xhdr_tab
; p
->keyword
; p
++)
422 if (strcmp (p
->keyword
, keyword
) == 0)
428 xheader_protected_pattern_p (const char *pattern
)
430 struct xhdr_tab
const *p
;
432 for (p
= xhdr_tab
; p
->keyword
; p
++)
433 if (p
->protect
&& fnmatch (pattern
, p
->keyword
, 0) == 0)
439 xheader_protected_keyword_p (const char *keyword
)
441 struct xhdr_tab
const *p
;
443 for (p
= xhdr_tab
; p
->keyword
; p
++)
444 if (p
->protect
&& strcmp (p
->keyword
, keyword
) == 0)
449 /* Decode a single extended header record, advancing *PTR to the next record.
450 Return true on success, false otherwise. */
452 decode_record (char **ptr
,
453 void (*handler
) (void *, char const *, char const *),
458 unsigned long int len
;
462 size_t len_max
= extended_header
.buffer
+ extended_header
.size
- start
;
464 while (*p
== ' ' || *p
== '\t')
470 ERROR ((0, 0, _("Malformed extended header: missing length")));
475 len
= strtoul (p
, &len_lim
, 10);
479 int len_len
= len_lim
- p
;
480 ERROR ((0, 0, _("Extended header length %*s is out of range"),
487 for (p
= len_lim
; *p
== ' ' || *p
== '\t'; p
++)
492 _("Malformed extended header: missing blank after length")));
498 if (! (p
&& p
< nextp
))
500 ERROR ((0, 0, _("Malformed extended header: missing equal sign")));
504 if (nextp
[-1] != '\n')
506 ERROR ((0, 0, _("Malformed extended header: missing newline")));
510 *p
= nextp
[-1] = '\0';
511 handler (data
, keyword
, p
+ 1);
519 run_override_list (struct keyword_list
*kp
, struct tar_stat_info
*st
)
521 for (; kp
; kp
= kp
->next
)
523 struct xhdr_tab
const *t
= locate_handler (kp
->pattern
);
525 t
->decoder (st
, kp
->value
);
530 decx (void *data
, char const *keyword
, char const *value
)
532 struct xhdr_tab
const *t
;
533 struct tar_stat_info
*st
= data
;
535 if (xheader_keyword_deleted_p (keyword
)
536 || xheader_keyword_override_p (keyword
))
539 t
= locate_handler (keyword
);
541 t
->decoder (st
, value
);
545 xheader_decode (struct tar_stat_info
*st
)
547 run_override_list (keyword_global_override_list
, st
);
548 run_override_list (global_header_override_list
, st
);
550 if (extended_header
.size
)
552 char *p
= extended_header
.buffer
+ BLOCKSIZE
;
553 while (decode_record (&p
, decx
, st
))
556 run_override_list (keyword_override_list
, st
);
560 decg (void *data
, char const *keyword
, char const *value
)
562 struct keyword_list
**kwl
= data
;
563 xheader_list_append (kwl
, keyword
, value
);
567 xheader_decode_global (void)
569 if (extended_header
.size
)
571 char *p
= extended_header
.buffer
+ BLOCKSIZE
;
573 xheader_list_destroy (&global_header_override_list
);
574 while (decode_record (&p
, decg
, &global_header_override_list
))
580 extended_header_init (void)
582 if (!extended_header
.stk
)
584 extended_header
.stk
= xmalloc (sizeof *extended_header
.stk
);
585 obstack_init (extended_header
.stk
);
590 xheader_store (char const *keyword
, struct tar_stat_info
const *st
, void *data
)
592 struct xhdr_tab
const *t
;
594 if (extended_header
.buffer
)
596 t
= locate_handler (keyword
);
599 if (xheader_keyword_deleted_p (keyword
)
600 || xheader_keyword_override_p (keyword
))
602 extended_header_init ();
603 t
->coder (st
, keyword
, &extended_header
, data
);
607 xheader_read (union block
*p
, size_t size
)
612 free (extended_header
.buffer
);
614 extended_header
.size
= size
;
615 nblocks
= (size
+ BLOCKSIZE
- 1) / BLOCKSIZE
;
616 extended_header
.buffer
= xmalloc (size
+ 1);
617 extended_header
.buffer
[size
] = '\0';
626 memcpy (&extended_header
.buffer
[j
], p
->buffer
, len
);
627 set_next_block_after (p
);
629 p
= find_next_block ();
638 xheader_print (struct xheader
*xhdr
, char const *keyword
, char const *value
)
640 size_t len
= strlen (keyword
) + strlen (value
) + 3; /* ' ' + '=' + '\n' */
643 char nbuf
[UINTMAX_STRSIZE_BOUND
];
649 np
= umaxtostr (len
+ p
, nbuf
);
650 n
= nbuf
+ sizeof nbuf
- 1 - np
;
654 obstack_grow (xhdr
->stk
, np
, n
);
655 obstack_1grow (xhdr
->stk
, ' ');
656 obstack_grow (xhdr
->stk
, keyword
, strlen (keyword
));
657 obstack_1grow (xhdr
->stk
, '=');
658 obstack_grow (xhdr
->stk
, value
, strlen (value
));
659 obstack_1grow (xhdr
->stk
, '\n');
663 xheader_finish (struct xheader
*xhdr
)
665 struct keyword_list
*kp
;
667 for (kp
= keyword_override_list
; kp
; kp
= kp
->next
)
668 code_string (kp
->value
, kp
->pattern
, xhdr
);
670 obstack_1grow (xhdr
->stk
, 0);
671 xhdr
->buffer
= obstack_finish (xhdr
->stk
);
672 xhdr
->size
= strlen (xhdr
->buffer
);
676 xheader_destroy (struct xheader
*xhdr
)
680 obstack_free (xhdr
->stk
, NULL
);
691 /* Implementations */
694 out_of_range_header (char const *keyword
, char const *value
,
695 uintmax_t minus_minval
, uintmax_t maxval
)
697 char minval_buf
[UINTMAX_STRSIZE_BOUND
+ 1];
698 char maxval_buf
[UINTMAX_STRSIZE_BOUND
];
699 char *minval_string
= umaxtostr (minus_minval
, minval_buf
+ 1);
700 char *maxval_string
= umaxtostr (maxval
, maxval_buf
);
702 *--minval_string
= '-';
704 /* TRANSLATORS: The first %s is the pax extended header keyword
705 (atime, gid, etc.). */
706 ERROR ((0, 0, _("Extended header %s=%s is out of range %s..%s"),
707 keyword
, value
, minval_string
, maxval_string
));
711 code_string (char const *string
, char const *keyword
, struct xheader
*xhdr
)
714 if (!utf8_convert (true, string
, &outstr
))
716 /* FIXME: report error */
717 outstr
= xstrdup (string
);
719 xheader_print (xhdr
, keyword
, outstr
);
724 decode_string (char **string
, char const *arg
)
731 if (!utf8_convert (false, arg
, string
))
733 /* FIXME: report error and act accordingly to --pax invalid=UTF-8 */
734 assign_string (string
, arg
);
739 code_time (struct timespec t
, char const *keyword
, struct xheader
*xhdr
)
741 char buf
[TIMESPEC_STRSIZE_BOUND
];
742 xheader_print (xhdr
, keyword
, code_timespec (t
, buf
));
746 decode_time (struct timespec
*ts
, char const *arg
, char const *keyword
)
749 unsigned long int ns
= 0;
752 bool negative
= *arg
== '-';
756 if (ISDIGIT (arg
[negative
]))
760 intmax_t i
= strtoimax (arg
, &arg_lim
, 10);
761 if (TYPE_SIGNED (time_t) ? i
< TYPE_MINIMUM (time_t) : i
< 0)
767 uintmax_t i
= strtoumax (arg
, &arg_lim
, 10);
768 if (TYPE_MAXIMUM (time_t) < i
)
781 bool trailing_nonzero
= false;
783 while (ISDIGIT (*++p
))
784 if (digits
< LOG10_BILLION
)
786 ns
= 10 * ns
+ (*p
- '0');
790 trailing_nonzero
|= *p
!= '0';
792 while (digits
++ < LOG10_BILLION
)
797 /* Convert "-1.10000000000001" to s == -2, ns == 89999999.
798 I.e., truncate time stamps towards minus infinity while
799 converting them to internal form. */
800 ns
+= trailing_nonzero
;
803 if (s
== TYPE_MINIMUM (time_t))
819 ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
824 out_of_range_header (keyword
, arg
, - (uintmax_t) TYPE_MINIMUM (time_t),
825 TYPE_MAXIMUM (time_t));
830 code_num (uintmax_t value
, char const *keyword
, struct xheader
*xhdr
)
832 char sbuf
[UINTMAX_STRSIZE_BOUND
];
833 xheader_print (xhdr
, keyword
, umaxtostr (value
, sbuf
));
837 decode_num (uintmax_t *num
, char const *arg
, uintmax_t maxval
,
843 if (! (ISDIGIT (*arg
)
844 && (errno
= 0, u
= strtoumax (arg
, &arg_lim
, 10), !*arg_lim
)))
846 ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
851 if (! (u
<= maxval
&& errno
!= ERANGE
))
853 out_of_range_header (keyword
, arg
, 0, maxval
);
862 dummy_coder (struct tar_stat_info
const *st
__attribute__ ((unused
)),
863 char const *keyword
__attribute__ ((unused
)),
864 struct xheader
*xhdr
__attribute__ ((unused
)),
865 void *data
__attribute__ ((unused
)))
870 dummy_decoder (struct tar_stat_info
*st
__attribute__ ((unused
)),
871 char const *arg
__attribute__ ((unused
)))
876 atime_coder (struct tar_stat_info
const *st
, char const *keyword
,
877 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
879 code_time (st
->atime
, keyword
, xhdr
);
883 atime_decoder (struct tar_stat_info
*st
, char const *arg
)
886 if (decode_time (&ts
, arg
, "atime"))
891 gid_coder (struct tar_stat_info
const *st
, char const *keyword
,
892 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
894 code_num (st
->stat
.st_gid
, keyword
, xhdr
);
898 gid_decoder (struct tar_stat_info
*st
, char const *arg
)
901 if (decode_num (&u
, arg
, TYPE_MAXIMUM (gid_t
), "gid"))
906 gname_coder (struct tar_stat_info
const *st
, char const *keyword
,
907 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
909 code_string (st
->gname
, keyword
, xhdr
);
913 gname_decoder (struct tar_stat_info
*st
, char const *arg
)
915 decode_string (&st
->gname
, arg
);
919 linkpath_coder (struct tar_stat_info
const *st
, char const *keyword
,
920 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
922 code_string (st
->link_name
, keyword
, xhdr
);
926 linkpath_decoder (struct tar_stat_info
*st
, char const *arg
)
928 decode_string (&st
->link_name
, arg
);
932 ctime_coder (struct tar_stat_info
const *st
, char const *keyword
,
933 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
935 code_time (st
->ctime
, keyword
, xhdr
);
939 ctime_decoder (struct tar_stat_info
*st
, char const *arg
)
942 if (decode_time (&ts
, arg
, "ctime"))
947 mtime_coder (struct tar_stat_info
const *st
, char const *keyword
,
948 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
950 code_time (st
->mtime
, keyword
, xhdr
);
954 mtime_decoder (struct tar_stat_info
*st
, char const *arg
)
957 if (decode_time (&ts
, arg
, "mtime"))
962 path_coder (struct tar_stat_info
const *st
, char const *keyword
,
963 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
965 code_string (st
->file_name
, keyword
, xhdr
);
969 path_decoder (struct tar_stat_info
*st
, char const *arg
)
971 decode_string (&st
->orig_file_name
, arg
);
972 decode_string (&st
->file_name
, arg
);
973 st
->had_trailing_slash
= strip_trailing_slashes (st
->file_name
);
977 size_coder (struct tar_stat_info
const *st
, char const *keyword
,
978 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
980 code_num (st
->stat
.st_size
, keyword
, xhdr
);
984 size_decoder (struct tar_stat_info
*st
, char const *arg
)
987 if (decode_num (&u
, arg
, TYPE_MAXIMUM (off_t
), "size"))
988 st
->stat
.st_size
= u
;
992 uid_coder (struct tar_stat_info
const *st
, char const *keyword
,
993 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
995 code_num (st
->stat
.st_uid
, keyword
, xhdr
);
999 uid_decoder (struct tar_stat_info
*st
, char const *arg
)
1002 if (decode_num (&u
, arg
, TYPE_MAXIMUM (uid_t
), "uid"))
1003 st
->stat
.st_uid
= u
;
1007 uname_coder (struct tar_stat_info
const *st
, char const *keyword
,
1008 struct xheader
*xhdr
, void *data
__attribute__ ((unused
)))
1010 code_string (st
->uname
, keyword
, xhdr
);
1014 uname_decoder (struct tar_stat_info
*st
, char const *arg
)
1016 decode_string (&st
->uname
, arg
);
1020 sparse_size_coder (struct tar_stat_info
const *st
, char const *keyword
,
1021 struct xheader
*xhdr
, void *data
)
1023 size_coder (st
, keyword
, xhdr
, data
);
1027 sparse_size_decoder (struct tar_stat_info
*st
, char const *arg
)
1030 if (decode_num (&u
, arg
, TYPE_MAXIMUM (off_t
), "GNU.sparse.size"))
1031 st
->stat
.st_size
= u
;
1035 sparse_numblocks_coder (struct tar_stat_info
const *st
, char const *keyword
,
1036 struct xheader
*xhdr
,
1037 void *data
__attribute__ ((unused
)))
1039 code_num (st
->sparse_map_avail
, keyword
, xhdr
);
1043 sparse_numblocks_decoder (struct tar_stat_info
*st
, char const *arg
)
1046 if (decode_num (&u
, arg
, SIZE_MAX
, "GNU.sparse.numblocks"))
1048 st
->sparse_map_size
= u
;
1049 st
->sparse_map
= xcalloc (u
, sizeof st
->sparse_map
[0]);
1050 st
->sparse_map_avail
= 0;
1055 sparse_offset_coder (struct tar_stat_info
const *st
, char const *keyword
,
1056 struct xheader
*xhdr
, void *data
)
1059 code_num (st
->sparse_map
[*pi
].offset
, keyword
, xhdr
);
1063 sparse_offset_decoder (struct tar_stat_info
*st
, char const *arg
)
1066 if (decode_num (&u
, arg
, TYPE_MAXIMUM (off_t
), "GNU.sparse.offset"))
1068 if (st
->sparse_map_avail
< st
->sparse_map_size
)
1069 st
->sparse_map
[st
->sparse_map_avail
].offset
= u
;
1071 ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
1072 "GNU.sparse.offset", arg
));
1077 sparse_numbytes_coder (struct tar_stat_info
const *st
, char const *keyword
,
1078 struct xheader
*xhdr
, void *data
)
1081 code_num (st
->sparse_map
[*pi
].numbytes
, keyword
, xhdr
);
1085 sparse_numbytes_decoder (struct tar_stat_info
*st
, char const *arg
)
1088 if (decode_num (&u
, arg
, SIZE_MAX
, "GNU.sparse.numbytes"))
1090 if (st
->sparse_map_avail
< st
->sparse_map_size
)
1091 st
->sparse_map
[st
->sparse_map_avail
++].numbytes
= u
;
1093 ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
1094 "GNU.sparse.numbytes", arg
));
1098 struct xhdr_tab
const xhdr_tab
[] = {
1099 { "atime", atime_coder
, atime_decoder
, false },
1100 { "comment", dummy_coder
, dummy_decoder
, false },
1101 { "charset", dummy_coder
, dummy_decoder
, false },
1102 { "ctime", ctime_coder
, ctime_decoder
, false },
1103 { "gid", gid_coder
, gid_decoder
, false },
1104 { "gname", gname_coder
, gname_decoder
, false },
1105 { "linkpath", linkpath_coder
, linkpath_decoder
, false },
1106 { "mtime", mtime_coder
, mtime_decoder
, false },
1107 { "path", path_coder
, path_decoder
, false },
1108 { "size", size_coder
, size_decoder
, false },
1109 { "uid", uid_coder
, uid_decoder
, false },
1110 { "uname", uname_coder
, uname_decoder
, false },
1112 /* Sparse file handling */
1113 { "GNU.sparse.size", sparse_size_coder
, sparse_size_decoder
, true },
1114 { "GNU.sparse.numblocks", sparse_numblocks_coder
, sparse_numblocks_decoder
,
1116 { "GNU.sparse.offset", sparse_offset_coder
, sparse_offset_decoder
,
1118 { "GNU.sparse.numbytes", sparse_numbytes_coder
, sparse_numbytes_decoder
,
1121 #if 0 /* GNU private keywords (not yet implemented) */
1123 /* The next directory entry actually contains the names of files
1124 that were in the directory at the time the dump was made.
1125 Supersedes GNUTYPE_DUMPDIR header type. */
1126 { "GNU.dump.name", dump_name_coder
, dump_name_decoder
, false },
1127 { "GNU.dump.status", dump_status_coder
, dump_status_decoder
, false },
1129 /* Keeps the tape/volume header. May be present only in the global headers.
1130 Equivalent to GNUTYPE_VOLHDR. */
1131 { "GNU.volume.header", volume_header_coder
, volume_header_decoder
, false },
1133 /* These may be present in a first global header of the archive.
1134 They provide the same functionality as GNUTYPE_MULTIVOL header.
1135 The GNU.volume.size keeps the real_s_sizeleft value, which is
1136 otherwise kept in the size field of a multivolume header. The
1137 GNU.volume.offset keeps the offset of the start of this volume,
1138 otherwise kept in oldgnu_header.offset. */
1139 { "GNU.volume.size", volume_size_coder
, volume_size_decoder
, false },
1140 { "GNU.volume.offset", volume_offset_coder
, volume_offset_decoder
, false },
1143 { NULL
, NULL
, NULL
, false }