summaryrefslogtreecommitdiff
path: root/app-arch/tar
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-arch/tar
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'app-arch/tar')
-rw-r--r--app-arch/tar/Manifest12
-rw-r--r--app-arch/tar/files/rmt8
-rw-r--r--app-arch/tar/files/tar-1.29-add-files.patch194
-rw-r--r--app-arch/tar/files/tar-1.29-extract-pathname-bypass-upstream.patch60
-rw-r--r--app-arch/tar/files/tar-1.29-extract-pathname-bypass.patch27
-rw-r--r--app-arch/tar/files/tar-1.30-fix-test-117-and-118.patch89
-rw-r--r--app-arch/tar/files/tar-1.30-fix-test-92.patch13
-rw-r--r--app-arch/tar/metadata.xml14
-rw-r--r--app-arch/tar/tar-1.29-r1.ebuild80
-rw-r--r--app-arch/tar/tar-1.29-r3.ebuild81
-rw-r--r--app-arch/tar/tar-1.30.ebuild81
11 files changed, 659 insertions, 0 deletions
diff --git a/app-arch/tar/Manifest b/app-arch/tar/Manifest
new file mode 100644
index 000000000000..61712921af97
--- /dev/null
+++ b/app-arch/tar/Manifest
@@ -0,0 +1,12 @@
+AUX rmt 263 BLAKE2B 7535dd27d5ba367066cd519dee06f053cde9d4f1e86728059935fb80e9a9880e7a934076949af54e47ee7de3f91452f2c642780e7d56619f166574633d1e4759 SHA512 2f1a9d3a522fc1f0d5385d1ea4c27da88a1c9357b866340432c6310604c01d3e328e33080ed1e951c0da6f025c3ee2a0c9f170d4b86a1d235ebb56be48fef152
+AUX tar-1.29-add-files.patch 6602 BLAKE2B ac4687bccd88e1fb3b2c565901815988b0ff0d9d42b46f71878c0293db0e0ce453d3b2fd3ead26d136997bd6f87b1400eb2310fd4d40c07a56b63a5528e5a7fa SHA512 5c87dd4a8e6d86c8e2311ac8487958abbda846484aec664ab82b7502ac1bb6a6cd43d3869fc64e06f792915b6a0659c41b9481357e5da19fbe43f9c913a10f3e
+AUX tar-1.29-extract-pathname-bypass-upstream.patch 1604 BLAKE2B 83364c5dee8d12b7cb67d8497666ec3082e0e209aeb4c84cc26292d43da0820bd14188f3003244a379cf5b6bdb5d3d7d566b42ec2c35d62f1d5713be7395e001 SHA512 c13046f8b0bcc435197c859006b1cfd12b79377f3b90edfd4b77f86ec6d3ca431c716d731be84884f0ec6d6129765cbfbccb5971d0b909c3f45aff8f0b9b45cb
+AUX tar-1.29-extract-pathname-bypass.patch 723 BLAKE2B c63c23dd1f256263cb4d1371e7a3eeccfe1da4aa74c13fd23f9bc1721b06e06d388eb99e1d9d17fb3344875be8b80e2a433f78360c89f6b2b7408302f346d0cc SHA512 ba06ae53b4effcdd0996be07ae03fae7237c579a82d2606fe25100bed447287a68e37282ba2b017eed0c26cb0f4bf77dcdb4fca2f5175e1bbaed91408b0bd54a
+AUX tar-1.30-fix-test-117-and-118.patch 3109 BLAKE2B d547dfb115d6cdbdf565c93dcdc70c9d2d0cde70228f58763e74d4cf5df7d621a5fccea375c3e103f8dcc04a19b3318b227384db2dc983cec5876eed8861cece SHA512 d104bbd88dafc0c3bb0308fbfb1dfb39b6c26fed14a316c30c2355d57ebe16172c0dde8ed6c91696b90f37622a43b5b1d70f397f7de521b9bd1552a5af78bb14
+AUX tar-1.30-fix-test-92.patch 257 BLAKE2B ee4fe8420f56191a8e4d9edefd109c948eb693532e2c3bb2073a8d55631aed142ab9c3adfa64d6461eb1aa9221a1aca6ec5086f15b3b9154effdb8e7128a8601 SHA512 aa1c80edbf1c846e23aa34ed343ffebad969b26fed9d4ccdc779f3df5bc384bb44d6c78044c385dbb7c01e68462568b941e8ec1060eb97bf36606d7beb790c1c
+DIST tar-1.29.tar.bz2 2715993 BLAKE2B 656b77a49c463ec7ade87a97b71469dadbf01551131bdf0cfa895b7b2a7d073a4cd51e9bec4169b134d83155aca18af1a89ddb5d14cb1dc0d9968184870d69f3 SHA512 d2cea9892892dfa0c8efd390303b75dccc085c4895e07ced684074592d69729916d6ea12475aa6aff873d076a729bb7dc2499c233edcfb9c7e8e8995481eef3b
+DIST tar-1.30.tar.bz2 2858639 BLAKE2B 82a8b1fbf1eb5c0347b2f8cf35854498e2955eb85eaf041ec44a38bbd9bc82cc7184d5cb858f9905f503c9178ec6d0ed50be2dc27be9933b29e0a18b8e6c0b8f SHA512 07a1157430898fee1a2c6fd3853d59d4ae13998db685669c8c702f73d2466eeb9892f84a5f0495bfe088c8190a643a99ac9f2cb16b85c9fe3ae0d83cc0f338e8
+EBUILD tar-1.29-r1.ebuild 2157 BLAKE2B 4a1e4e3cbbc34cf71f41b5ce9e1f7b8b65a9413fdc3e08bb97f09eb64a4f72b8952461fef59d7b6beca00350ea0b7718d2a4d99d3f9a8a830479d1e194f44641 SHA512 9445561ce892822feb1365f6a227143a3bea6767a19bacea08345057ac2fab80cd5035c81281b27161a443c5103e5432288e9b69ec0fe33218c587ccb9d20a4b
+EBUILD tar-1.29-r3.ebuild 2227 BLAKE2B 50afab4df588f55fdab5d3cfd4258d3c65192ee0cc7079527a05fcbee0a2ec50e3875302a241faa351edc41e5f77351382ecd3e291037eec11115d4c729aebde SHA512 270db39d7490c4829fb11cb680b39e75963bb065fe3ebdf78ab024300dae27f78e18453dc76c029a6cdfc4af9511074322aaafc3e89910e63e976065d92867a3
+EBUILD tar-1.30.ebuild 2201 BLAKE2B 47202beceb4d1780e307b6bb5edf17a3275cbab15d9d91641a47c0912cb295a63597189e952d4a8a49a3a3824a4ac8f54ea35ce4894a76da548be3c8021bb563 SHA512 722c0d360a4be6d9b7507bd349a866becaa2adbf4346a257a68ab5b2fde29125767e9c90fa402a81e3d793879b45e52946f9cdf1fee0627018fda687786f9abe
+MISC metadata.xml 387 BLAKE2B 6d37d364bd888503b868af168aa496d57abf7bac5c4c69f4c02933b5715312ec65f43babb347d34c665873247e4feaa9b9de2d3bb2d224e1751922c159f2fa87 SHA512 e5bce64bc18a7c6313d0818182941f49ea7e89617c97338fff29297bb2bfc2f4e56a9c124aa97fcb5f2a3a54e0e7cfd209bce09c2ced40a398381b7970c08cf7
diff --git a/app-arch/tar/files/rmt b/app-arch/tar/files/rmt
new file mode 100644
index 000000000000..15ed6aa91fad
--- /dev/null
+++ b/app-arch/tar/files/rmt
@@ -0,0 +1,8 @@
+#!/bin/sh
+#
+# This is not a mistake. This shell script (/etc/rmt) has been provided
+# for compatibility with other Unix-like systems, some of which have
+# utilities that expect to find (and execute) rmt in the /etc directory
+# on remote systems.
+#
+exec rmt "$@"
diff --git a/app-arch/tar/files/tar-1.29-add-files.patch b/app-arch/tar/files/tar-1.29-add-files.patch
new file mode 100644
index 000000000000..8ab15ac32aff
--- /dev/null
+++ b/app-arch/tar/files/tar-1.29-add-files.patch
@@ -0,0 +1,194 @@
+From 3a283cfe9f8f1f127e8dc5597a5ea1d249985a54 Mon Sep 17 00:00:00 2001
+From: Sergey Poznyakoff <gray@gnu.org>
+Date: Sat, 12 Nov 2016 11:20:47 +0200
+Subject: [PATCH] Fix the --add-file option.
+
+* src/common.h (name_more_files): New proto.
+(files_from_option): Remove.
+* src/names.c (name_more_files): New file.
+(names_options): Fix declaration of the
+add-file option.
+(names_parse_opt): Handle --add-file.
+* src/tar.c (struct tar_args): Remove the input_files member.
+Change all uses: use name_more_files() instead.
+* tests/Makefile.am: Add new test.
+* tests/add-file.at: New testcase.
+* tests/testsuite.at: Add new test.
+---
+ src/common.h | 4 +---
+ src/names.c | 24 ++++++++++++-------
+ src/tar.c | 16 ++++---------
+ tests/Makefile.am | 3 ++-
+ tests/add-file.at | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ tests/testsuite.at | 1 +
+ 6 files changed, 92 insertions(+), 23 deletions(-)
+ create mode 100644 tests/add-file.at
+
+diff --git a/src/common.h b/src/common.h
+index 50c34cc7c09b..6fdb6225f18b 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -414,9 +414,6 @@ GLOBAL bool show_transformed_names_option;
+ timestamps from archives with an unusual member order. It is automatically
+ set for incremental archives. */
+ GLOBAL bool delay_directory_restore_option;
+-
+-/* When set, tar will not refuse to create empty archives */
+-GLOBAL bool files_from_option;
+
+ /* Declarations for each module. */
+
+@@ -738,6 +735,7 @@ void uid_to_uname (uid_t uid, char **uname);
+ int uname_to_uid (char const *uname, uid_t *puid);
+
+ void name_init (void);
++bool name_more_files (void);
+ void name_add_name (const char *name);
+ void name_term (void);
+ const char *name_next (int change_dirs);
+diff --git a/src/names.c b/src/names.c
+index 219aa77a4356..1a9465667cd3 100644
+--- a/src/names.c
++++ b/src/names.c
+@@ -32,7 +32,8 @@ static void name_add_file (const char *name);
+
+ enum
+ {
+- EXCLUDE_BACKUPS_OPTION = 256,
++ ADD_FILE_OPTION = 256,
++ EXCLUDE_BACKUPS_OPTION,
+ EXCLUDE_CACHES_OPTION,
+ EXCLUDE_CACHES_UNDER_OPTION,
+ EXCLUDE_CACHES_ALL_OPTION,
+@@ -67,7 +68,7 @@ static struct argp_option names_options[] = {
+ {NULL, 0, NULL, 0,
+ N_("Local file name selection:"), GRID },
+
+- {"add-file", ARGP_KEY_ARG, N_("FILE"), 0,
++ {"add-file", ADD_FILE_OPTION, N_("FILE"), 0,
+ N_("add given FILE to the archive (useful if its name starts with a dash)"), GRID+1 },
+ {"directory", 'C', N_("DIR"), 0,
+ N_("change to directory DIR"), GRID+1 },
+@@ -190,10 +191,10 @@ names_parse_opt (int key, char *arg, struct argp_state *state)
+
+ case 'T':
+ name_add_file (arg);
+- /* Indicate we've been given -T option. This is for backward
+- compatibility only, so that `tar cfT archive /dev/null will
+- succeed */
+- files_from_option = true;
++ break;
++
++ case ADD_FILE_OPTION:
++ name_add_name (arg);
+ break;
+
+ default:
+@@ -651,8 +652,8 @@ struct name_elt /* A name_array element. */
+ } v;
+ };
+
+-static struct name_elt *name_head; /* store a list of names */
+-size_t name_count; /* how many of the entries are names? */
++static struct name_elt *name_head;/* store a list of names */
++size_t name_count; /* how many of the entries are file names? */
+
+ static struct name_elt *
+ name_elt_alloc (void)
+@@ -784,6 +785,12 @@ name_list_advance (void)
+ }
+ }
+
++/* Return true if there are names or options in the list */
++bool
++name_more_files (void)
++{
++ return name_count > 0;
++}
+
+ /* Add to name_array the file NAME with fnmatch options MATFLAGS */
+ void
+@@ -823,6 +830,7 @@ name_add_file (const char *name)
+ ep->v.file.name = name;
+ ep->v.file.line = 0;
+ ep->v.file.fp = NULL;
++ name_count++;
+ }
+
+ /* Names from external name file. */
+diff --git a/src/tar.c b/src/tar.c
+index 35bac38c2793..a361fc2c607f 100644
+--- a/src/tar.c
++++ b/src/tar.c
+@@ -813,7 +813,6 @@ struct tar_args /* Variables used during option parsing */
+ bool pax_option; /* True if --pax-option was given */
+ char const *backup_suffix_string; /* --suffix option argument */
+ char const *version_control_string; /* --backup option argument */
+- bool input_files; /* True if some input files where given */
+ int compress_autodetect; /* True if compression autodetection should
+ be attempted when creating archives */
+ };
+@@ -1322,7 +1321,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
+ case ARGP_KEY_ARG:
+ /* File name or non-parsed option, because of ARGP_IN_ORDER */
+ name_add_name (arg);
+- args->input_files = true;
+ break;
+
+ case 'A':
+@@ -2179,7 +2177,7 @@ more_options (int argc, char **argv, struct option_locus *loc)
+ args.loc = loc;
+ if (argp_parse (&argp, argc, argv, ARGP_IN_ORDER|ARGP_NO_EXIT, &idx, &args))
+ abort (); /* shouldn't happen */
+- if (loc->source == OPTS_ENVIRON && args.input_files)
++ if (loc->source == OPTS_ENVIRON && name_more_files ())
+ USAGE_ERROR ((0, 0, _("non-option arguments in %s"), loc->name));
+ }
+
+@@ -2221,7 +2219,6 @@ decode_options (int argc, char **argv)
+ args.pax_option = false;
+ args.backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
+ args.version_control_string = 0;
+- args.input_files = false;
+ args.compress_autodetect = false;
+
+ subcommand_option = UNKNOWN_SUBCOMMAND;
+@@ -2340,10 +2337,7 @@ decode_options (int argc, char **argv)
+
+ /* Handle operands after any "--" argument. */
+ for (; idx < argc; idx++)
+- {
+- name_add_name (argv[idx]);
+- args.input_files = true;
+- }
++ name_add_name (argv[idx]);
+
+ /* Derive option values and check option consistency. */
+
+@@ -2365,7 +2359,7 @@ decode_options (int argc, char **argv)
+
+ if (occurrence_option)
+ {
+- if (!args.input_files)
++ if (!name_more_files ())
+ USAGE_ERROR ((0, 0,
+ _("--occurrence is meaningless without a file list")));
+ if (!IS_SUBCOMMAND_CLASS (SUBCL_OCCUR))
+@@ -2569,7 +2563,7 @@ decode_options (int argc, char **argv)
+ {
+ /* --test-label is silent if the user has specified the label name to
+ compare against. */
+- if (!args.input_files)
++ if (!name_more_files ())
+ verbose_option++;
+ }
+ else if (utc_option)
+@@ -2598,7 +2592,7 @@ decode_options (int argc, char **argv)
+ switch (subcommand_option)
+ {
+ case CREATE_SUBCOMMAND:
+- if (!args.input_files && !files_from_option)
++ if (!name_more_files ())
+ USAGE_ERROR ((0, 0,
+ _("Cowardly refusing to create an empty archive")));
+ if (args.compress_autodetect && archive_names
diff --git a/app-arch/tar/files/tar-1.29-extract-pathname-bypass-upstream.patch b/app-arch/tar/files/tar-1.29-extract-pathname-bypass-upstream.patch
new file mode 100644
index 000000000000..2030ca6d2bdd
--- /dev/null
+++ b/app-arch/tar/files/tar-1.29-extract-pathname-bypass-upstream.patch
@@ -0,0 +1,60 @@
+https://bugs.gentoo.org/598334
+
+From 7340f67b9860ea0531c1450e5aa261c50f67165d Mon Sep 17 00:00:00 2001
+From: Paul Eggert <eggert@Penguin.CS.UCLA.EDU>
+Date: Sat, 29 Oct 2016 21:04:40 -0700
+Subject: [PATCH] When extracting, skip ".." members
+
+* NEWS: Document this.
+* src/extract.c (extract_archive): Skip members whose names
+contain "..".
+---
+ NEWS | 8 +++++++-
+ src/extract.c | 8 ++++++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+--- a/NEWS
++++ b/NEWS
+@@ -1,6 +1,16 @@
+ GNU tar NEWS - User visible changes. 2016-05-16
+ Please send GNU tar bug reports to <bug-tar@gnu.org>
+
++
++
++version 1.29-r2+ Gentoo
++
++* Member names containing '..' components are now skipped when extracting.
++
++This fixes tar's behavior to match its documentation, and is a bit
++safer when extracting untrusted archives over old files (an unsafe
++practice that the tar manual has long recommended against).
++
+
+ version 1.29 - Sergey Poznyakoff, 2016-05-16
+
+--- a/src/extract.c
++++ b/src/extract.c
+@@ -1629,12 +1629,20 @@
+ {
+ char typeflag;
+ tar_extractor_t fun;
++ bool skip_dotdot_name;
+
+ fatal_exit_hook = extract_finish;
+
+ set_next_block_after (current_header);
+
++ skip_dotdot_name = (!absolute_names_option
++ && contains_dot_dot (current_stat_info.orig_file_name));
++ if (skip_dotdot_name)
++ ERROR ((0, 0, _("%s: Member name contains '..'"),
++ quotearg_colon (current_stat_info.orig_file_name)));
++
+ if (!current_stat_info.file_name[0]
++ || skip_dotdot_name
+ || (interactive_option
+ && !confirm ("extract", current_stat_info.file_name)))
+ {
+--
+2.11.0.rc2
+
diff --git a/app-arch/tar/files/tar-1.29-extract-pathname-bypass.patch b/app-arch/tar/files/tar-1.29-extract-pathname-bypass.patch
new file mode 100644
index 000000000000..6470fe082bda
--- /dev/null
+++ b/app-arch/tar/files/tar-1.29-extract-pathname-bypass.patch
@@ -0,0 +1,27 @@
+--- a/lib/paxnames.c 2016-04-06 00:04:47.314860045 +0300
++++ b/lib/paxnames.c 2016-04-06 02:08:44.962297881 +0300
+@@ -18,6 +18,7 @@
+ #include <system.h>
+ #include <hash.h>
+ #include <paxlib.h>
++#include <quotearg.h>
+
+
+ /* Hash tables of strings. */
+@@ -114,7 +115,15 @@
+ for (p = file_name + prefix_len; *p; )
+ {
+ if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2]))
+- prefix_len = p + 2 - file_name;
++ {
++ static char const *const diagnostic[] =
++ {
++ N_("%s: Member name contains '..'"),
++ N_("%s: Hard link target contains '..'")
++ };
++ ERROR ((0, 0, _(diagnostic[link_target]),
++ quotearg_colon (file_name)));
++ }
+
+ do
+ {
diff --git a/app-arch/tar/files/tar-1.30-fix-test-117-and-118.patch b/app-arch/tar/files/tar-1.30-fix-test-117-and-118.patch
new file mode 100644
index 000000000000..2f75da6cd247
--- /dev/null
+++ b/app-arch/tar/files/tar-1.30-fix-test-117-and-118.patch
@@ -0,0 +1,89 @@
+tests: fix race in dirrem01 and dirrem02
+
+Previously the '--checkpoint-action=echo' was triggered after
+'--checkpoint-action=sleep=1' - so the order of events *usually*
+was (for --format='gnu'):
+
+ ...
+ 1. checkpoint handler before write of 'dir/sub' member
+ 2. one-second delay
+ 3. stderr write: 'tar: Write checkpoint 3'
+ 4. write the member 'dir/sub' into the archive
+ 5. check that the member's ctime has not been changed
+ 6. genfile's detecting 'Write checkpoint', doing unlink
+ ...
+
+But sometimes, the genfile was fast enough to win the race and
+unlinked the directory before the member was written into the
+archive (IOW, the order was 1-2-3-6-4-5). This led to the
+occasional warning 'tar: dir/sub: file changed as we read it'.
+
+Swap the order of 'sleep=1' and 'echo' actions so the genfile
+utility has (hopefully) enough time to do the unlink before
+writing the file into the archive (enforce 1-2-3-6-4-5 order).
+
+* tests/dirrem01.at: Swap 'sleep=1' and 'echo' actions.
+* tests/dirrem02.at: Likewise.
+
+Origin: https://lists.gnu.org/archive/html/bug-tar/2018-01/msg00000.html
+---
+ tests/dirrem01.at | 5 +++--
+ tests/dirrem02.at | 7 ++++---
+ 2 files changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/tests/dirrem01.at b/tests/dirrem01.at
+index 40344dc..dabc206 100644
+--- a/tests/dirrem01.at
++++ b/tests/dirrem01.at
+@@ -47,14 +47,15 @@ gnu) CPT=3;;
+ esac
+
+ genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
+- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
+- --checkpoint-action='echo' -c -f archive.tar \
++ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
++ --checkpoint-action='sleep=1' -c -f archive.tar \
+ --listed-incremental db -v dir >/dev/null
+ ],
+ [1],
+ [ignore],
+ [tar: dir: Directory is new
+ tar: dir/sub: Directory is new
++tar: dir/sub: file changed as we read it
+ tar: dir/sub: File removed before we read it
+ ],[],[],[gnu,posix])
+
+diff --git a/tests/dirrem02.at b/tests/dirrem02.at
+index e1cf9ef..924454f 100644
+--- a/tests/dirrem02.at
++++ b/tests/dirrem02.at
+@@ -20,7 +20,7 @@
+
+ # Description:
+ #
+-# When an explicitley named directory disappears during creation
++# When an explicitly named directory disappears during creation
+ # of incremental dump, tar should still exit with TAREXIT_FAILURE (2).
+ #
+ # For further details see dirrem01.at
+@@ -44,14 +44,15 @@ gnu) CPT=3;;
+ esac
+
+ genfile --run --checkpoint=$CPT --unlink dir/sub/file2 --unlink dir/sub -- \
+- tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='sleep=1' \
+- --checkpoint-action='echo' -c -f archive.tar \
++ tar --blocking-factor=1 --checkpoint=1 --checkpoint-action='echo' \
++ --checkpoint-action='sleep=1' -c -f archive.tar \
+ --listed-incremental db -v dir dir/sub >/dev/null
+ ],
+ [2],
+ [ignore],
+ [tar: dir: Directory is new
+ tar: dir/sub: Directory is new
++tar: dir/sub: file changed as we read it
+ tar: dir/sub: Cannot open: No such file or directory
+ tar: Exiting with failure status due to previous errors
+ ],[],[],[gnu,posix])
+--
+cgit v1.0-41-gc330
+
diff --git a/app-arch/tar/files/tar-1.30-fix-test-92.patch b/app-arch/tar/files/tar-1.30-fix-test-92.patch
new file mode 100644
index 000000000000..d5a63e4ab355
--- /dev/null
+++ b/app-arch/tar/files/tar-1.30-fix-test-92.patch
@@ -0,0 +1,13 @@
+http://lists.gnu.org/archive/html/bug-tar/2017-12/msg00027.html
+
+--- a/tests/difflink.at
++++ b/tests/difflink.at
+@@ -21,7 +21,7 @@ mkdir a
+ genfile -f a/x
+ ln -s x a/y
+ ln a/y a/z
+-tar cf a.tar a
++tar cf a.tar a/x a/y a/z
+ rm a/z
+ ln -s x a/z
+ tar df a.tar
diff --git a/app-arch/tar/metadata.xml b/app-arch/tar/metadata.xml
new file mode 100644
index 000000000000..c7c95933065b
--- /dev/null
+++ b/app-arch/tar/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>base-system@gentoo.org</email>
+ <name>Gentoo Base System</name>
+</maintainer>
+<use>
+ <flag name="minimal">just install `tar`</flag>
+</use>
+<upstream>
+ <remote-id type="cpe">cpe:/a:gnu:tar</remote-id>
+</upstream>
+</pkgmetadata>
diff --git a/app-arch/tar/tar-1.29-r1.ebuild b/app-arch/tar/tar-1.29-r1.ebuild
new file mode 100644
index 000000000000..cc4cfe9bcbef
--- /dev/null
+++ b/app-arch/tar/tar-1.29-r1.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Use this to make tarballs :)"
+HOMEPAGE="https://www.gnu.org/software/tar/"
+SRC_URI="mirror://gnu/tar/${P}.tar.bz2
+ mirror://gnu-alpha/tar/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="acl elibc_glibc minimal nls selinux static userland_GNU xattr"
+
+RDEPEND="acl? ( virtual/acl )
+ selinux? ( sys-libs/libselinux )"
+DEPEND="${RDEPEND}
+ nls? ( >=sys-devel/gettext-0.10.35 )
+ xattr? ( elibc_glibc? ( sys-apps/attr ) )"
+
+PATCHES=(
+ "${FILESDIR}/${P}-extract-pathname-bypass.patch"
+)
+
+src_prepare() {
+ epatch "${PATCHES[@]}"
+ epatch_user
+
+ if ! use userland_GNU ; then
+ sed -i \
+ -e 's:/backup\.sh:/gbackup.sh:' \
+ scripts/{backup,dump-remind,restore}.in \
+ || die "sed non-GNU"
+ fi
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ FORCE_UNSAFE_CONFIGURE=1 \
+ econf \
+ --enable-backup-scripts \
+ --bindir="${EPREFIX}"/bin \
+ --libexecdir="${EPREFIX}"/usr/sbin \
+ $(usex userland_GNU "" "--program-prefix=g") \
+ $(use_with acl posix-acls) \
+ $(use_enable nls) \
+ $(use_with selinux) \
+ $(use_with xattr xattrs)
+}
+
+src_install() {
+ default
+
+ local p=$(usex userland_GNU "" "g")
+ if [[ -z ${p} ]] ; then
+ # a nasty yet required piece of baggage
+ exeinto /etc
+ doexe "${FILESDIR}"/rmt
+ fi
+
+ # autoconf looks for gtar before tar (in configure scripts), hence
+ # in Prefix it is important that it is there, otherwise, a gtar from
+ # the host system (FreeBSD, Solaris, Darwin) will be found instead
+ # of the Prefix provided (GNU) tar
+ if use prefix ; then
+ dosym tar /bin/gtar
+ fi
+
+ mv "${ED}"/usr/sbin/${p}backup{,-tar} || die
+ mv "${ED}"/usr/sbin/${p}restore{,-tar} || die
+
+ if use minimal ; then
+ find "${ED}"/etc "${ED}"/*bin/ "${ED}"/usr/*bin/ \
+ -type f -a '!' '(' -name tar -o -name ${p}tar ')' \
+ -delete || die
+ fi
+}
diff --git a/app-arch/tar/tar-1.29-r3.ebuild b/app-arch/tar/tar-1.29-r3.ebuild
new file mode 100644
index 000000000000..7f8e1ba1631b
--- /dev/null
+++ b/app-arch/tar/tar-1.29-r3.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="5"
+
+inherit flag-o-matic eutils
+
+DESCRIPTION="Use this to make tarballs :)"
+HOMEPAGE="https://www.gnu.org/software/tar/"
+SRC_URI="mirror://gnu/tar/${P}.tar.bz2
+ mirror://gnu-alpha/tar/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="acl elibc_glibc minimal nls selinux static userland_GNU xattr"
+
+RDEPEND="acl? ( virtual/acl )
+ selinux? ( sys-libs/libselinux )"
+DEPEND="${RDEPEND}
+ nls? ( >=sys-devel/gettext-0.10.35 )
+ xattr? ( elibc_glibc? ( sys-apps/attr ) )"
+
+PATCHES=(
+ "${FILESDIR}/${P}-extract-pathname-bypass-upstream.patch" #598334
+ "${FILESDIR}/${P}-add-files.patch"
+)
+
+src_prepare() {
+ epatch "${PATCHES[@]}"
+ epatch_user
+
+ if ! use userland_GNU ; then
+ sed -i \
+ -e 's:/backup\.sh:/gbackup.sh:' \
+ scripts/{backup,dump-remind,restore}.in \
+ || die "sed non-GNU"
+ fi
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ FORCE_UNSAFE_CONFIGURE=1 \
+ econf \
+ --enable-backup-scripts \
+ --bindir="${EPREFIX}"/bin \
+ --libexecdir="${EPREFIX}"/usr/sbin \
+ $(usex userland_GNU "" "--program-prefix=g") \
+ $(use_with acl posix-acls) \
+ $(use_enable nls) \
+ $(use_with selinux) \
+ $(use_with xattr xattrs)
+}
+
+src_install() {
+ default
+
+ local p=$(usex userland_GNU "" "g")
+ if [[ -z ${p} ]] ; then
+ # a nasty yet required piece of baggage
+ exeinto /etc
+ doexe "${FILESDIR}"/rmt
+ fi
+
+ # autoconf looks for gtar before tar (in configure scripts), hence
+ # in Prefix it is important that it is there, otherwise, a gtar from
+ # the host system (FreeBSD, Solaris, Darwin) will be found instead
+ # of the Prefix provided (GNU) tar
+ if use prefix ; then
+ dosym tar /bin/gtar
+ fi
+
+ mv "${ED}"/usr/sbin/${p}backup{,-tar} || die
+ mv "${ED}"/usr/sbin/${p}restore{,-tar} || die
+
+ if use minimal ; then
+ find "${ED}"/etc "${ED}"/*bin/ "${ED}"/usr/*bin/ \
+ -type f -a '!' '(' -name tar -o -name ${p}tar ')' \
+ -delete || die
+ fi
+}
diff --git a/app-arch/tar/tar-1.30.ebuild b/app-arch/tar/tar-1.30.ebuild
new file mode 100644
index 000000000000..f202b7126d40
--- /dev/null
+++ b/app-arch/tar/tar-1.30.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit flag-o-matic
+
+DESCRIPTION="Use this to make tarballs :)"
+HOMEPAGE="https://www.gnu.org/software/tar/"
+SRC_URI="mirror://gnu/tar/${P}.tar.bz2
+ mirror://gnu-alpha/tar/${P}.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="alpha amd64 ~arm arm64 hppa ia64 ~m68k ~mips ppc ppc64 s390 ~sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="acl elibc_glibc minimal nls selinux static userland_GNU xattr"
+
+RDEPEND="acl? ( virtual/acl )
+ selinux? ( sys-libs/libselinux )"
+DEPEND="${RDEPEND}
+ nls? ( >=sys-devel/gettext-0.10.35 )
+ xattr? ( elibc_glibc? ( sys-apps/attr ) )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-fix-test-92.patch
+ "${FILESDIR}"/${P}-fix-test-117-and-118.patch
+)
+
+src_prepare() {
+ default
+
+ if ! use userland_GNU ; then
+ sed -i \
+ -e 's:/backup\.sh:/gbackup.sh:' \
+ scripts/{backup,dump-remind,restore}.in \
+ || die "sed non-GNU"
+ fi
+}
+
+src_configure() {
+ use static && append-ldflags -static
+ local myeconfargs=(
+ --bindir="${EPREFIX}"/bin
+ --enable-backup-scripts
+ --libexecdir="${EPREFIX}"/usr/sbin
+ $(usex userland_GNU "" "--program-prefix=g")
+ $(use_with acl posix-acls)
+ $(use_enable nls)
+ $(use_with selinux)
+ $(use_with xattr xattrs)
+ )
+ FORCE_UNSAFE_CONFIGURE=1 econf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+
+ local p=$(usex userland_GNU "" "g")
+ if [[ -z ${p} ]] ; then
+ # a nasty yet required piece of baggage
+ exeinto /etc
+ doexe "${FILESDIR}"/rmt
+ fi
+
+ # autoconf looks for gtar before tar (in configure scripts), hence
+ # in Prefix it is important that it is there, otherwise, a gtar from
+ # the host system (FreeBSD, Solaris, Darwin) will be found instead
+ # of the Prefix provided (GNU) tar
+ if use prefix ; then
+ dosym tar /bin/gtar
+ fi
+
+ mv "${ED%/}"/usr/sbin/${p}backup{,-tar} || die
+ mv "${ED%/}"/usr/sbin/${p}restore{,-tar} || die
+
+ if use minimal ; then
+ find "${ED}"/etc "${ED}"/*bin/ "${ED}"/usr/*bin/ \
+ -type f -a '!' '(' -name tar -o -name ${p}tar ')' \
+ -delete || die
+ fi
+}