From 310752c11a616e8db5fcbf76be0bf753af262dc8 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Sun, 3 Nov 2013 09:43:29 -0700 Subject: [PATCH] patch from Joey Hess for pristine-tar backwards compatibility --- debian/changelog | 6 +- debian/gbp.conf | 3 + debian/patches/pristine_tar_compat | 216 +++++++++++++++++++++++++++++ debian/patches/series | 1 + 4 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 debian/gbp.conf create mode 100644 debian/patches/pristine_tar_compat diff --git a/debian/changelog b/debian/changelog index 5b10a56b..9c678ff4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,13 @@ -tar (1.27-3) UNRELEASED; urgency=low +tar (1.27-3) unstable; urgency=low + * patch from Joey Hess to allow tar to replicate 1.26 output on behalf + of pristine-tar, closes: #728025 * honor DEB_BUILD_OPTIONS parallel=, honor dpkg-buildflags in build target in addition to configure target, closes: #727196 * lower mime priority to 1 so interactive packages using the default priority of 5 win, closes: #727303 - -- Bdale Garbee Wed, 23 Oct 2013 16:13:07 -0600 + -- Bdale Garbee Sun, 03 Nov 2013 09:40:31 -0700 tar (1.27-2) unstable; urgency=low diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 00000000..1f64e8c1 --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,3 @@ +[DEFAULT] +upstream-branch = dfsg-orig +debian-branch = dfsg-debian diff --git a/debian/patches/pristine_tar_compat b/debian/patches/pristine_tar_compat new file mode 100644 index 00000000..e15d4f61 --- /dev/null +++ b/debian/patches/pristine_tar_compat @@ -0,0 +1,216 @@ +From e36454201ec81374bf4d2d09877e6c345a6fddab Mon Sep 17 00:00:00 2001 +From: Joey Hess +Date: Sun, 27 Oct 2013 13:16:52 -0400 +Subject: [PATCH] add PRISTINE_TAR_COMPAT + +--- + debian/patches/longlink-hack.diff | 72 ------------------------- + debian/patches/pristine-tar.diff | 108 ++++++++++++++++++++++++++++++++++++++ + debian/patches/series | 2 +- + 3 files changed, 109 insertions(+), 73 deletions(-) + delete mode 100644 debian/patches/longlink-hack.diff + create mode 100644 debian/patches/pristine-tar.diff + +diff --git a/debian/patches/longlink-hack.diff b/debian/patches/longlink-hack.diff +deleted file mode 100644 +index b6bc385..0000000 +--- a/debian/patches/longlink-hack.diff ++++ /dev/null +@@ -1,72 +0,0 @@ +-diff --git a/src/common.h b/src/common.h +-index eb801bb..4aaace5 100644 +---- a/src/common.h +-+++ b/src/common.h +-@@ -907,4 +907,6 @@ void finish_deferred_unlinks (void); +- /* Module exit.c */ +- extern void (*fatal_exit_hook) (void); +- +-+GLOBAL int debian_longlink_hack; +-+ +- _GL_INLINE_HEADER_END +-diff --git a/src/create.c b/src/create.c +-index e14e13d..3a84c79 100644 +---- a/src/create.c +-+++ b/src/create.c +-@@ -27,6 +27,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 }; +-@@ -724,7 +726,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); +-@@ -1476,7 +1478,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 4f5017d..e9a5126 100644 +---- a/src/tar.c +-+++ b/src/tar.c +-@@ -1246,6 +1246,16 @@ expand_pax_option (struct tar_args *targs, const char *arg) +- return res; +- } +- +-+/* 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; +-+} +-+ +- +- static uintmax_t +- parse_owner_group (char *arg, uintmax_t field_max, char const **name_option) +-@@ -2626,6 +2636,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 (); +- +diff --git a/debian/patches/pristine-tar.diff b/debian/patches/pristine-tar.diff +new file mode 100644 +index 0000000..f350acc +--- /dev/null ++++ b/debian/patches/pristine-tar.diff +@@ -0,0 +1,108 @@ ++diff --git a/src/common.h b/src/common.h ++index eb801bb..30f8cf5 100644 ++--- a/src/common.h +++++ b/src/common.h ++@@ -907,4 +907,7 @@ void finish_deferred_unlinks (void); ++ /* Module exit.c */ ++ extern void (*fatal_exit_hook) (void); ++ +++GLOBAL int debian_longlink_hack; +++GLOBAL int pristine_tar_compat; +++ ++ _GL_INLINE_HEADER_END ++diff --git a/src/create.c b/src/create.c ++index e14e13d..d6e8ea7 100644 ++--- a/src/create.c +++++ b/src/create.c ++@@ -27,6 +27,9 @@ ++ #include "common.h" ++ #include ++ +++extern int debian_longlink_hack; +++extern int pristine_tar_compat; +++ ++ /* Error number to use when an impostor is discovered. ++ Pretend the impostor isn't there. */ ++ enum { IMPOSTOR_ERRNO = ENOENT }; ++@@ -534,6 +537,11 @@ write_short_name (struct tar_stat_info *st) ++ return header; ++ } ++ +++#define FILL(field,byte) do { \ +++ memset(field, byte, sizeof(field)-1); \ +++ (field)[sizeof(field)-1] = 0; \ +++} while (0) +++ ++ /* Write a GNUTYPE_LONGLINK or GNUTYPE_LONGNAME block. */ ++ static void ++ write_gnu_long_link (struct tar_stat_info *st, const char *p, char type) ++@@ -544,6 +552,10 @@ write_gnu_long_link (struct tar_stat_info *st, const char *p, char type) ++ char *tmpname; ++ ++ header = start_private_header ("././@LongLink", size, start_time.tv_sec); +++ if (pristine_tar_compat) { +++ FILL (header->header.mtime, '0'); +++ FILL (header->header.mode, '0'); +++ } ++ uid_to_uname (0, &tmpname); ++ UNAME_TO_CHARS (tmpname, header->header.uname); ++ free (tmpname); ++@@ -724,7 +736,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); ++@@ -1476,7 +1488,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 4f5017d..b72e25b 100644 ++--- a/src/tar.c +++++ b/src/tar.c ++@@ -1246,6 +1246,26 @@ expand_pax_option (struct tar_args *targs, const char *arg) ++ return res; ++ } ++ +++/* Debian specific environment variable used by pristine-tar to enable use of +++ * longlinks for filenames exactly 100 bytes long. */ +++void debian_longlink_hack_init (void) { +++ char *s=getenv ("TAR_LONGLINK_100"); +++ if (s && strcmp(s, "1") == 0) +++ debian_longlink_hack=1; +++ else +++ debian_longlink_hack=0; +++} +++ +++/* pristine-tar sets this environment variable to force fields in longlinks +++ * to be zeroed as was the case in tar 1.26. */ +++void pristine_tar_compat_init (void) { +++ char *s=getenv ("PRISTINE_TAR_COMPAT"); +++ if (s && strcmp(s, "1") == 0) +++ pristine_tar_compat=1; +++ else +++ pristine_tar_compat=0; +++} +++ ++ ++ static uintmax_t ++ parse_owner_group (char *arg, uintmax_t field_max, char const **name_option) ++@@ -2626,6 +2646,9 @@ main (int argc, char **argv) ++ filename_terminator = '\n'; ++ set_quoting_style (0, DEFAULT_QUOTING_STYLE); ++ +++ debian_longlink_hack_init (); +++ pristine_tar_compat_init (); +++ ++ /* Make sure we have first three descriptors available */ ++ stdopen (); ++ +diff --git a/debian/patches/series b/debian/patches/series +index 1dfef41..5974cbb 100644 +--- a/debian/patches/series ++++ b/debian/patches/series +@@ -1,2 +1,2 @@ +-longlink-hack.diff ++pristine-tar.diff + listed03-linux-only +-- +1.8.4.rc0 + diff --git a/debian/patches/series b/debian/patches/series index 1dfef41d..f3d235b4 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ longlink-hack.diff listed03-linux-only +pristine_tar_compat -- 2.30.2