From be97699dcf999e7e292b225419ca27dd23f0e4d0 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Fri, 19 Aug 2011 10:13:35 -0600 Subject: [PATCH] need longlink patch in checked out tree --- src/common.h | 2 ++ src/create.c | 6 ++++-- src/tar.c | 12 ++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/common.h b/src/common.h index 0b9bd7a1..a7a73e97 100644 --- a/src/common.h +++ b/src/common.h @@ -832,3 +832,5 @@ void finish_deferred_unlinks (void); /* Module exit.c */ extern void (*fatal_exit_hook) (void); + +GLOBAL int debian_longlink_hack; diff --git a/src/create.c b/src/create.c index 43b5a4c2..b36cf137 100644 --- a/src/create.c +++ b/src/create.c @@ -26,6 +26,8 @@ #include "common.h" #include +extern int debian_longlink_hack; + /* Error number to use when an impostor is discovered. Pretend the impostor isn't there. */ enum { IMPOSTOR_ERRNO = ENOENT }; @@ -735,7 +737,7 @@ write_header_name (struct tar_stat_info *st) return write_short_name (st); } else if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) - < strlen (st->file_name)) + < strlen (st->file_name) + debian_longlink_hack) return write_long_name (st); else return write_short_name (st); @@ -1456,7 +1458,7 @@ dump_hard_link (struct tar_stat_info *st) block_ordinal = current_block_ordinal (); assign_string (&st->link_name, link_name); if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) - < strlen (link_name)) + < strlen (link_name) + debian_longlink_hack) write_long_link (st); st->stat.st_size = 0; diff --git a/src/tar.c b/src/tar.c index 928cfddd..ac44de86 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2566,6 +2566,16 @@ decode_options (int argc, char **argv) report_textual_dates (&args); } +/* Debian specific environment variable used by pristine-tar to enable use of + * longlinks for filenames exactly 100 bytes long. */ +void debian_longlink_hack_init () { + char *s=getenv ("TAR_LONGLINK_100"); + if (s && strcmp(s, "1") == 0) + debian_longlink_hack=1; + else + debian_longlink_hack=0; +} + /* Tar proper. */ @@ -2585,6 +2595,8 @@ main (int argc, char **argv) filename_terminator = '\n'; set_quoting_style (0, DEFAULT_QUOTING_STYLE); + debian_longlink_hack_init (); + /* Make sure we have first three descriptors available */ stdopen (); -- 2.30.2