1 diff --git a/src/common.h b/src/common.h
2 index eb801bb..4aaace5 100644
5 @@ -907,4 +907,6 @@ void finish_deferred_unlinks (void);
7 extern void (*fatal_exit_hook) (void);
9 +GLOBAL int debian_longlink_hack;
12 diff --git a/src/create.c b/src/create.c
13 index e14e13d..3a84c79 100644
20 +extern int debian_longlink_hack;
22 /* Error number to use when an impostor is discovered.
23 Pretend the impostor isn't there. */
24 enum { IMPOSTOR_ERRNO = ENOENT };
25 @@ -724,7 +726,7 @@ write_header_name (struct tar_stat_info *st)
26 return write_short_name (st);
28 else if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
29 - < strlen (st->file_name))
30 + < strlen (st->file_name) + debian_longlink_hack)
31 return write_long_name (st);
33 return write_short_name (st);
34 @@ -1476,7 +1478,7 @@ dump_hard_link (struct tar_stat_info *st)
35 block_ordinal = current_block_ordinal ();
36 assign_string (&st->link_name, link_name);
37 if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
38 - < strlen (link_name))
39 + < strlen (link_name) + debian_longlink_hack)
43 diff --git a/src/tar.c b/src/tar.c
44 index 4f5017d..e9a5126 100644
47 @@ -1246,6 +1246,16 @@ expand_pax_option (struct tar_args *targs, const char *arg)
51 +/* Debian specific environment variable used by pristine-tar to enable use of
52 + * longlinks for filenames exactly 100 bytes long. */
53 +void debian_longlink_hack_init () {
54 + char *s=getenv ("TAR_LONGLINK_100");
55 + if (s && strcmp(s, "1") == 0)
56 + debian_longlink_hack=1;
58 + debian_longlink_hack=0;
63 parse_owner_group (char *arg, uintmax_t field_max, char const **name_option)
64 @@ -2626,6 +2636,8 @@ main (int argc, char **argv)
65 filename_terminator = '\n';
66 set_quoting_style (0, DEFAULT_QUOTING_STYLE);
68 + debian_longlink_hack_init ();
70 /* Make sure we have first three descriptors available */