4 int group_map_translate (gid_t gid, gid_t *new_gid, char const **new_name);
7 +GLOBAL int debian_longlink_hack;
8 +GLOBAL int pristine_tar_compat;
17 +extern int debian_longlink_hack;
18 +extern int pristine_tar_compat;
20 /* Error number to use when an impostor is discovered.
21 Pretend the impostor isn't there. */
22 enum { IMPOSTOR_ERRNO = ENOENT };
27 +#define FILL(field,byte) do { \
28 + memset(field, byte, sizeof(field)-1); \
29 + (field)[sizeof(field)-1] = 0; \
32 /* Write a GNUTYPE_LONGLINK or GNUTYPE_LONGNAME block. */
34 write_gnu_long_link (struct tar_stat_info *st, const char *p, char type)
38 header = start_private_header ("././@LongLink", size, 0);
39 + if (pristine_tar_compat) {
40 + FILL (header->header.mtime, '0');
41 + FILL (header->header.mode, '0');
44 uid_to_uname (0, &tmpname);
45 UNAME_TO_CHARS (tmpname, header->header.uname);
48 return write_short_name (st);
50 else if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
51 - < strlen (st->file_name))
52 + < strlen (st->file_name) + debian_longlink_hack)
53 return write_long_name (st);
55 return write_short_name (st);
57 block_ordinal = current_block_ordinal ();
58 assign_string (&st->link_name, link_name);
59 if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
60 - < strlen (link_name))
61 + < strlen (link_name) + debian_longlink_hack)
67 @@ -1204,6 +1204,26 @@
71 +/* Debian specific environment variable used by pristine-tar to enable use of
72 + * longlinks for filenames exactly 100 bytes long. */
73 +void debian_longlink_hack_init (void) {
74 + char *s=getenv ("TAR_LONGLINK_100");
75 + if (s && strcmp(s, "1") == 0)
76 + debian_longlink_hack=1;
78 + debian_longlink_hack=0;
81 +/* pristine-tar sets this environment variable to force fields in longlinks
82 + * to be zeroed as was the case in tar 1.26. */
83 +void pristine_tar_compat_init (void) {
84 + char *s=getenv ("PRISTINE_TAR_COMPAT");
85 + if (s && strcmp(s, "1") == 0)
86 + pristine_tar_compat=1;
88 + pristine_tar_compat=0;
93 parse_owner_group (char *arg, uintmax_t field_max, char const **name_option)
96 set_quoting_style (0, DEFAULT_QUOTING_STYLE);
98 + debian_longlink_hack_init ();
99 + pristine_tar_compat_init ();
101 /* Make sure we have first three descriptors available */