commit f83ab7e82cee86b2a081a378f46046d07df41579 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:18:06 2019 -0400 Package init diff --git a/Avoid-some-resource-leaks.patch b/Avoid-some-resource-leaks.patch new file mode 100644 index 0000000..12995b3 --- /dev/null +++ b/Avoid-some-resource-leaks.patch @@ -0,0 +1,83 @@ +From 577dc345653947a31b2841167dc1a9be0e44e043 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Tue, 31 Jul 2018 12:06:09 +0300 +Subject: [PATCH 20/58] Avoid some resource leaks + +* src/incremen.c (store_rename): Free temp_name, leaked before for +each renamed directory with --listed-incremental. +* src/transform.c (add_literal_segment): Tighten arguments by +const. +(parse_transform_expr): Free 'str', leaked storage for each +--transform option before. +* src/utf8.c (utf8_convert): Deallocate buffer for failed iconv() +call so callers don't have to. +--- + src/incremen.c | 1 + + src/transform.c | 3 ++- + src/utf8.c | 9 ++++++--- + 3 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/incremen.c b/src/incremen.c +index ca611f6..7c26eb8 100644 +--- a/src/incremen.c ++++ b/src/incremen.c +@@ -915,6 +915,7 @@ store_rename (struct directory *dir, struct obstack *stk) + obstack_code_rename (stk, p->orig->name, p->name); + + obstack_code_rename (stk, "", prev->name); ++ free (temp_name); + } + } + } +diff --git a/src/transform.c b/src/transform.c +index 3fae3c0..6ef0da6 100644 +--- a/src/transform.c ++++ b/src/transform.c +@@ -101,7 +101,7 @@ add_segment (struct transform *tf) + } + + static void +-add_literal_segment (struct transform *tf, char *str, char *end) ++add_literal_segment (struct transform *tf, const char *str, const char *end) + { + size_t len = end - str; + if (len) +@@ -403,6 +403,7 @@ parse_transform_expr (const char *expr) + cur++; + } + add_literal_segment (tf, beg, cur); ++ free(str); + + return p; + } +diff --git a/src/utf8.c b/src/utf8.c +index a018ce0..168d636 100644 +--- a/src/utf8.c ++++ b/src/utf8.c +@@ -68,7 +68,6 @@ utf8_convert (bool to_utf, char const *input, char **output) + char *ob; + size_t inlen; + size_t outlen; +- size_t rc; + iconv_t cd = utf8_init (to_utf); + + if (cd == 0) +@@ -83,9 +82,13 @@ utf8_convert (bool to_utf, char const *input, char **output) + outlen = inlen * MB_LEN_MAX + 1; + ob = *output = xmalloc (outlen); + ib = (char ICONV_CONST *) input; +- rc = iconv (cd, &ib, &inlen, &ob, &outlen); ++ if (iconv (cd, &ib, &inlen, &ob, &outlen) == -1) ++ { ++ free (*output); ++ return false; ++ } + *ob = 0; +- return rc != -1; ++ return true; + } + + +-- +2.19.1 + diff --git a/Bugfix.patch b/Bugfix.patch new file mode 100644 index 0000000..37d75e8 --- /dev/null +++ b/Bugfix.patch @@ -0,0 +1,29 @@ +From ea3aea06f1da077dbb4092672dc7e8768ae4f84e Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 21 Dec 2018 13:42:29 +0200 +Subject: [PATCH 37/58] Bugfix + +Bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00014.html + +* src/names.c (collect_and_sort_names): Fix iteration over namelist. +--- + src/names.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/names.c b/src/names.c +index d3728d8..025b682 100644 +--- a/src/names.c ++++ b/src/names.c +@@ -1857,7 +1857,7 @@ collect_and_sort_names (void) + + if (listed_incremental_option) + { +- for (name = namelist; name && name->name[0] == 0; name++) ++ for (name = namelist; name && name->name[0] == 0; name = name->next) + ; + if (name) + append_incremental_renames (name->directory); +-- +2.19.1 + diff --git a/Disallow-modifications-to-the-global-pax-extended-he.patch b/Disallow-modifications-to-the-global-pax-extended-he.patch new file mode 100644 index 0000000..cfdd8f3 --- /dev/null +++ b/Disallow-modifications-to-the-global-pax-extended-he.patch @@ -0,0 +1,75 @@ +From 3c2a2cd94d3b062aa5bf850b82364039ec9c6029 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 21 Dec 2018 14:18:14 +0200 +Subject: [PATCH 38/58] Disallow modifications to the global pax extended + header in update mode. + +Updating global headers in update mode is not possible, because: + +1) If the original archive was not in PAX format, writing the +global header would overwrite first member header (and eventually +data blocks) in the archive. +2) Otherwise, using the --pax-option can make the updated header +occupy more blocks than the original one, which would lead to the +same effect as in 1. + +This also fixes + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00007.html + +* src/xheader.c (xheader_forbid_global): New function. +* src/common.h (xheader_forbid_global): New prototype. +* src/update.c (update_archive): Use xheader_forbid_global, instead +of trying to write global extended header record. +--- + src/common.h | 1 + + src/update.c | 2 +- + src/xheader.c | 8 ++++++++ + 3 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/src/common.h b/src/common.h +index 32e6f8b..885169f 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -836,6 +836,7 @@ void xheader_store (char const *keyword, struct tar_stat_info *st, + void xheader_read (struct xheader *xhdr, union block *header, off_t size); + void xheader_write (char type, char *name, time_t t, struct xheader *xhdr); + void xheader_write_global (struct xheader *xhdr); ++void xheader_forbid_global (void); + void xheader_finish (struct xheader *hdr); + void xheader_destroy (struct xheader *hdr); + char *xheader_xhdr_name (struct tar_stat_info *st); +diff --git a/src/update.c b/src/update.c +index 2f823e4..4aa4ac6 100644 +--- a/src/update.c ++++ b/src/update.c +@@ -111,7 +111,7 @@ update_archive (void) + + name_gather (); + open_archive (ACCESS_UPDATE); +- buffer_write_global_xheader (); ++ xheader_forbid_global (); + + while (!found_end) + { +diff --git a/src/xheader.c b/src/xheader.c +index e938502..010cab7 100644 +--- a/src/xheader.c ++++ b/src/xheader.c +@@ -469,6 +469,14 @@ xheader_write_global (struct xheader *xhdr) + } + } + ++/* Forbid modifications of the global extended header */ ++void ++xheader_forbid_global (void) ++{ ++ if (keyword_global_override_list) ++ USAGE_ERROR ((0, 0, _("can't update global extended header record"))); ++} ++ + void + xheader_xattr_init (struct tar_stat_info *st) + { +-- +2.19.1 + diff --git a/Fix-buffer-overflow.patch b/Fix-buffer-overflow.patch new file mode 100644 index 0000000..0b5486e --- /dev/null +++ b/Fix-buffer-overflow.patch @@ -0,0 +1,111 @@ +From c7c59b57faa7bd60063f38d3517a8ad50fe1c430 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Thu, 20 Dec 2018 20:30:58 +0200 +Subject: [PATCH 33/58] Fix buffer overflow + +Bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00011.html + +* src/xheader.c (xheader_format_name): fix length calculation +--- + src/xheader.c | 70 ++++++++++++++++++++++++++++----------------------- + 1 file changed, 39 insertions(+), 31 deletions(-) + +diff --git a/src/xheader.c b/src/xheader.c +index 6d97131..980f050 100644 +--- a/src/xheader.c ++++ b/src/xheader.c +@@ -255,7 +255,7 @@ char * + xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n) + { + char *buf; +- size_t len = strlen (fmt); ++ size_t len; + char *q; + const char *p; + char *dirp = NULL; +@@ -266,43 +266,51 @@ xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n) + char nbuf[UINTMAX_STRSIZE_BOUND]; + char const *nptr = NULL; + +- for (p = fmt; *p && (p = strchr (p, '%')); ) ++ len = 0; ++ for (p = fmt; *p; p++) + { +- switch (p[1]) ++ if (*p == '%' && p[1]) + { +- case '%': +- len--; +- break; +- +- case 'd': +- if (st) ++ switch (*++p) + { +- if (!dirp) +- dirp = dir_name (st->orig_file_name); +- dir = safer_name_suffix (dirp, false, absolute_names_option); +- len += strlen (dir) - 2; +- } +- break; ++ case '%': ++ len++; ++ break; + +- case 'f': +- if (st) +- { +- base = last_component (st->orig_file_name); +- len += strlen (base) - 2; +- } +- break; ++ case 'd': ++ if (st) ++ { ++ if (!dirp) ++ dirp = dir_name (st->orig_file_name); ++ dir = safer_name_suffix (dirp, false, absolute_names_option); ++ len += strlen (dir); ++ } ++ break; + +- case 'p': +- pptr = umaxtostr (getpid (), pidbuf); +- len += pidbuf + sizeof pidbuf - 1 - pptr - 2; +- break; ++ case 'f': ++ if (st) ++ { ++ base = last_component (st->orig_file_name); ++ len += strlen (base); ++ } ++ break; + +- case 'n': +- nptr = umaxtostr (n, nbuf); +- len += nbuf + sizeof nbuf - 1 - nptr - 2; +- break; ++ case 'p': ++ pptr = umaxtostr (getpid (), pidbuf); ++ len += pidbuf + sizeof pidbuf - 1 - pptr; ++ break; ++ ++ case 'n': ++ nptr = umaxtostr (n, nbuf); ++ len += nbuf + sizeof nbuf - 1 - nptr; ++ break; ++ ++ default: ++ len += 2; ++ } + } +- p++; ++ else ++ len++; + } + + buf = xmalloc (len + 1); +-- +2.19.1 + diff --git a/Fix-build-on-AIX.patch b/Fix-build-on-AIX.patch new file mode 100644 index 0000000..e7241c2 --- /dev/null +++ b/Fix-build-on-AIX.patch @@ -0,0 +1,28 @@ +From bd1b0fc97c95686175057a203c7a1cf7b79cb19b Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Tue, 15 Jan 2019 15:21:03 +0200 +Subject: [PATCH 55/58] Fix build on AIX + +* src/unlink.c (flush_deferred_unlinks): Avoid possible duplicate case +(if ENOTEMPTY==EEXIST) +--- + src/unlink.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/unlink.c b/src/unlink.c +index 8f3a8a4..5a72f70 100644 +--- a/src/unlink.c ++++ b/src/unlink.c +@@ -127,7 +127,9 @@ flush_deferred_unlinks (bool force) + case EEXIST: + /* OpenSolaris >=10 sets EEXIST instead of ENOTEMPTY + if trying to remove a non-empty directory */ ++#if defined ENOTEMPTY && ENOTEMPTY != EEXIST + case ENOTEMPTY: ++#endif + /* Keep the record in list, in the hope we'll + be able to remove it later */ + prev = p; +-- +2.19.1 + diff --git a/Fix-compilation-without-iconv.patch b/Fix-compilation-without-iconv.patch new file mode 100644 index 0000000..b8e7eba --- /dev/null +++ b/Fix-compilation-without-iconv.patch @@ -0,0 +1,32 @@ +From 2f5a57be4bcb4b6e641457ef0fc99bdbe84828ba Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Mon, 14 Jan 2019 14:46:43 +0200 +Subject: [PATCH 50/58] Fix compilation without iconv. + +--- + src/utf8.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/src/utf8.c b/src/utf8.c +index 91476aa..53a1ab2 100644 +--- a/src/utf8.c ++++ b/src/utf8.c +@@ -35,11 +35,14 @@ + # define iconv_open(tocode, fromcode) ((iconv_t) -1) + + # undef iconv +-# define iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft) ((size_t) 0) ++# define iconv(cd, inbuf, inbytesleft, outbuf, outbytesleft) (errno = ENOSYS, (size_t) -1) + + # undef iconv_close + # define iconv_close(cd) 0 + ++# undef iconv_t ++# define iconv_t int ++ + #endif + + +-- +2.19.1 + diff --git a/Fix-double-free-introduced-by-577dc345.patch b/Fix-double-free-introduced-by-577dc345.patch new file mode 100644 index 0000000..7ca76d6 --- /dev/null +++ b/Fix-double-free-introduced-by-577dc345.patch @@ -0,0 +1,44 @@ +From 110e3bd7a6e63e0c5c734d97a0a44ed5c1b6de7c Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Tue, 31 Jul 2018 15:57:11 +0300 +Subject: [PATCH 22/58] Fix double-free introduced by 577dc345 + +* src/utf8.c (utf8_convert): Don't store freed value in *output +--- + src/utf8.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/src/utf8.c b/src/utf8.c +index 168d636..abf26bc 100644 +--- a/src/utf8.c ++++ b/src/utf8.c +@@ -65,7 +65,7 @@ bool + utf8_convert (bool to_utf, char const *input, char **output) + { + char ICONV_CONST *ib; +- char *ob; ++ char *ob, *ret; + size_t inlen; + size_t outlen; + iconv_t cd = utf8_init (to_utf); +@@ -80,14 +80,15 @@ utf8_convert (bool to_utf, char const *input, char **output) + + inlen = strlen (input) + 1; + outlen = inlen * MB_LEN_MAX + 1; +- ob = *output = xmalloc (outlen); ++ ob = ret = xmalloc (outlen); + ib = (char ICONV_CONST *) input; + if (iconv (cd, &ib, &inlen, &ob, &outlen) == -1) + { +- free (*output); ++ free (ret); + return false; + } + *ob = 0; ++ *output = ret; + return true; + } + +-- +2.19.1 + diff --git a/Fix-error-handling-when-reading-incremental-snapshot.patch b/Fix-error-handling-when-reading-incremental-snapshot.patch new file mode 100644 index 0000000..3d56b7d --- /dev/null +++ b/Fix-error-handling-when-reading-incremental-snapshot.patch @@ -0,0 +1,84 @@ +From 916fe62ae9b91a5d71cfa752f7cad89a558d7672 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 21 Dec 2018 07:59:02 +0200 +Subject: [PATCH 35/58] Fix error handling when reading incremental snapshots + +Bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00008.html + +* incremen.c (read_incr_db_01): Don't try to continue after errors. +--- + src/incremen.c | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/src/incremen.c b/src/incremen.c +index 7c26eb8..8335a0c 100644 +--- a/src/incremen.c ++++ b/src/incremen.c +@@ -998,10 +998,10 @@ read_incr_db_01 (int version, const char *initbuf) + newer_mtime_option = decode_timespec (buf, &ebuf, false); + + if (! valid_timespec (newer_mtime_option)) +- ERROR ((0, errno, "%s:%ld: %s", +- quotearg_colon (listed_incremental_option), +- lineno, +- _("Invalid time stamp"))); ++ FATAL_ERROR ((0, errno, "%s:%ld: %s", ++ quotearg_colon (listed_incremental_option), ++ lineno, ++ _("Invalid time stamp"))); + else + { + if (version == 1 && *ebuf) +@@ -1043,9 +1043,9 @@ read_incr_db_01 (int version, const char *initbuf) + mtime = decode_timespec (strp, &ebuf, false); + strp = ebuf; + if (!valid_timespec (mtime) || *strp != ' ') +- ERROR ((0, errno, "%s:%ld: %s", +- quotearg_colon (listed_incremental_option), lineno, +- _("Invalid modification time"))); ++ FATAL_ERROR ((0, errno, "%s:%ld: %s", ++ quotearg_colon (listed_incremental_option), lineno, ++ _("Invalid modification time"))); + + errno = 0; + u = strtoumax (strp, &ebuf, 10); +@@ -1053,9 +1053,9 @@ read_incr_db_01 (int version, const char *initbuf) + errno = ERANGE; + if (errno || strp == ebuf || *ebuf != ' ') + { +- ERROR ((0, errno, "%s:%ld: %s", +- quotearg_colon (listed_incremental_option), lineno, +- _("Invalid modification time (nanoseconds)"))); ++ FATAL_ERROR ((0, errno, "%s:%ld: %s", ++ quotearg_colon (listed_incremental_option), lineno, ++ _("Invalid modification time (nanoseconds)"))); + mtime.tv_nsec = -1; + } + else +@@ -1069,17 +1069,17 @@ read_incr_db_01 (int version, const char *initbuf) + TYPE_MINIMUM (dev_t), TYPE_MAXIMUM (dev_t)); + strp = ebuf; + if (errno || *strp != ' ') +- ERROR ((0, errno, "%s:%ld: %s", ++ FATAL_ERROR ((0, errno, "%s:%ld: %s", + quotearg_colon (listed_incremental_option), lineno, +- _("Invalid device number"))); ++ _("Invalid device number"))); + + ino = strtosysint (strp, &ebuf, + TYPE_MINIMUM (ino_t), TYPE_MAXIMUM (ino_t)); + strp = ebuf; + if (errno || *strp != ' ') +- ERROR ((0, errno, "%s:%ld: %s", +- quotearg_colon (listed_incremental_option), lineno, +- _("Invalid inode number"))); ++ FATAL_ERROR ((0, errno, "%s:%ld: %s", ++ quotearg_colon (listed_incremental_option), lineno, ++ _("Invalid inode number"))); + + strp++; + unquote_string (strp); +-- +2.19.1 + diff --git a/Fix-iconv-usage.patch b/Fix-iconv-usage.patch new file mode 100644 index 0000000..8f38576 --- /dev/null +++ b/Fix-iconv-usage.patch @@ -0,0 +1,39 @@ +From 3da8c2850d6589b9fa387ab2a2c87355d1224b1e Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Mon, 14 Jan 2019 13:59:39 +0200 +Subject: [PATCH 49/58] Fix iconv usage. + +Patch by Christian Weisgerber. + +* src/utf8.c (utf8_convert): non-zero return from iconv means failure. +--- + src/utf8.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/utf8.c b/src/utf8.c +index 95a016d..91476aa 100644 +--- a/src/utf8.c ++++ b/src/utf8.c +@@ -81,7 +81,18 @@ utf8_convert (bool to_utf, char const *input, char **output) + outlen = inlen * MB_LEN_MAX + 1; + ob = ret = xmalloc (outlen); + ib = (char ICONV_CONST *) input; +- if (iconv (cd, &ib, &inlen, &ob, &outlen) == -1) ++ /* According to POSIX, "if iconv() encounters a character in the input ++ buffer that is valid, but for which an identical character does not ++ exist in the target codeset, iconv() shall perform an ++ implementation-defined conversion on this character." It will "update ++ the variables pointed to by the arguments to reflect the extent of the ++ conversion and return the number of non-identical conversions performed". ++ On error, it returns -1. ++ In other words, non-zero return always indicates failure, either because ++ the input was not fully converted, or because it was converted in a ++ non-reversible way. ++ */ ++ if (iconv (cd, &ib, &inlen, &ob, &outlen) != 0) + { + free (ret); + return false; +-- +2.19.1 + diff --git a/Fix-improper-memory-access.patch b/Fix-improper-memory-access.patch new file mode 100644 index 0000000..30b8feb --- /dev/null +++ b/Fix-improper-memory-access.patch @@ -0,0 +1,30 @@ +From eae48289c0848c5812644f20dbb1b39fb117a8f6 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Thu, 20 Dec 2018 17:53:40 +0200 +Subject: [PATCH 32/58] Fix improper memory access + +Bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00009.html + +* src/transform.c (parse_transform_expr): Check if re is not empty +before accessing its last byte. +--- + src/transform.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/transform.c b/src/transform.c +index 6ef0da6..bbf2033 100644 +--- a/src/transform.c ++++ b/src/transform.c +@@ -273,7 +273,7 @@ parse_transform_expr (const char *expr) + USAGE_ERROR ((0, 0, _("Invalid transform expression: %s"), errbuf)); + } + +- if (str[0] == '^' || str[strlen (str) - 1] == '$') ++ if (str[0] == '^' || (i > 2 && str[i - 3] == '$')) + tf->transform_type = transform_first; + + free (str); +-- +2.19.1 + diff --git a/Fix-possible-NULL-dereference-savannah-bug-55369.patch b/Fix-possible-NULL-dereference-savannah-bug-55369.patch new file mode 100644 index 0000000..f34c672 --- /dev/null +++ b/Fix-possible-NULL-dereference-savannah-bug-55369.patch @@ -0,0 +1,35 @@ +From cb07844454d8cc9fb21f53ace75975f91185a120 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Mon, 14 Jan 2019 15:22:09 +0200 +Subject: [PATCH] Fix possible NULL dereference (savannah bug #55369) + +* src/sparse.c (pax_decode_header): Check return from find_next_block. +--- + src/sparse.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/sparse.c b/src/sparse.c +index 55c874f..6ec069d 100644 +--- a/src/sparse.c ++++ b/src/sparse.c +@@ -1247,6 +1247,8 @@ pax_decode_header (struct tar_sparse_file *file) + set_next_block_after (b); \ + file->dumped_size += BLOCKSIZE; \ + b = find_next_block (); \ ++ if (!b) \ ++ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \ + src = b->buffer; \ + endp = b->buffer + BLOCKSIZE; \ + } \ +@@ -1259,6 +1261,8 @@ pax_decode_header (struct tar_sparse_file *file) + set_next_block_after (current_header); + file->dumped_size += BLOCKSIZE; + blk = find_next_block (); ++ if (!blk) ++ FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); + p = blk->buffer; + COPY_BUF (blk,nbuf,p); + if (!decode_num (&u, nbuf, TYPE_MAXIMUM (size_t))) +-- +1.8.3.1 + diff --git a/Fix-semantics-of-K-used-together-with-explicit-membe.patch b/Fix-semantics-of-K-used-together-with-explicit-membe.patch new file mode 100644 index 0000000..e08044c --- /dev/null +++ b/Fix-semantics-of-K-used-together-with-explicit-membe.patch @@ -0,0 +1,130 @@ +From 983a82a3767da04cb3ca15eefe2e4b21154c335f Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 21 Dec 2018 13:24:29 +0200 +Subject: [PATCH 36/58] Fix semantics of -K used together with explicit member + names. + +This also fixes the bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00012.html + +* src/common.h (starting_file_option): Describe the variable. +* src/names.c (add_starting_file): New function. +(name_match): Ignore everything before the member indicated by the +--starting-file option +* src/tar.c: Use add_starting_file to handle the -K option. +--- + NEWS | 12 +++++++++++- + src/common.h | 5 +++++ + src/names.c | 45 ++++++++++++++++++++++++++++++++++++++------- + src/tar.c | 3 +-- + 4 files changed, 55 insertions(+), 10 deletions(-) + +diff --git a/src/common.h b/src/common.h +index 2877975..32e6f8b 100644 +--- a/src/common.h ++++ b/src/common.h +@@ -302,6 +302,10 @@ enum hole_detection_method + + GLOBAL enum hole_detection_method hole_detection; + ++/* The first entry in names.c:namelist specifies the member name to ++ start extracting from. Set by add_starting_file() upon seeing the ++ -K option. ++*/ + GLOBAL bool starting_file_option; + + /* Specified maximum byte length of each tape volume (multiple of 1024). */ +@@ -752,6 +756,7 @@ const char *name_next (int change_dirs); + void name_gather (void); + struct name *addname (char const *string, int change_dir, + bool cmdline, struct name *parent); ++void add_starting_file (char const *file_name); + void remname (struct name *name); + bool name_match (const char *name); + void names_notfound (void); +diff --git a/src/names.c b/src/names.c +index f4dc978..d3728d8 100644 +--- a/src/names.c ++++ b/src/names.c +@@ -1227,6 +1227,34 @@ addname (char const *string, int change_dir, bool cmdline, struct name *parent) + return name; + } + ++void ++add_starting_file (char const *file_name) ++{ ++ struct name *name = make_name (file_name); ++ ++ if (starting_file_option) ++ { ++ struct name *head = namelist; ++ remname (head); ++ free_name (head); ++ } ++ ++ name->prev = NULL; ++ name->next = namelist; ++ namelist = name; ++ if (!nametail) ++ nametail = namelist; ++ ++ name->found_count = 0; ++ name->matching_flags = INCLUDE_OPTIONS; ++ name->change_dir = 0; ++ name->directory = NULL; ++ name->parent = NULL; ++ name->cmdline = true; ++ ++ starting_file_option = true; ++} ++ + /* Find a match for FILE_NAME (whose string length is LENGTH) in the name + list. */ + static struct name * +@@ -1283,19 +1311,22 @@ name_match (const char *file_name) + } + + cursor = namelist_match (file_name, length); ++ if (starting_file_option) ++ { ++ /* If starting_file_option is set, the head of the list is the name ++ of the member to start extraction from. Skip the match unless it ++ is head. */ ++ if (cursor == namelist) ++ starting_file_option = false; ++ else ++ cursor = NULL; ++ } + if (cursor) + { + if (!(ISSLASH (file_name[cursor->length]) && recursion_option) + || cursor->found_count == 0) + cursor->found_count++; /* remember it matched */ +- if (starting_file_option) +- { +- free (namelist); +- namelist = NULL; +- nametail = NULL; +- } + chdir_do (cursor->change_dir); +- + /* We got a match. */ + return ISFOUND (cursor); + } +diff --git a/src/tar.c b/src/tar.c +index 1993887..9919e87 100644 +--- a/src/tar.c ++++ b/src/tar.c +@@ -1443,8 +1443,7 @@ parse_opt (int key, char *arg, struct argp_state *state) + + case 'K': + optloc_save (OC_STARTING_FILE, args->loc); +- starting_file_option = true; +- addname (arg, 0, true, NULL); ++ add_starting_file (arg); + break; + + case ONE_FILE_SYSTEM_OPTION: +-- +2.19.1 + diff --git a/Reject-pax-options-starting-with-equals-sign.patch b/Reject-pax-options-starting-with-equals-sign.patch new file mode 100644 index 0000000..7bee095 --- /dev/null +++ b/Reject-pax-options-starting-with-equals-sign.patch @@ -0,0 +1,31 @@ +From 99d415e1902c2309a4a3da41b2f08e5719771336 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 21 Dec 2018 07:32:47 +0200 +Subject: [PATCH 34/58] Reject pax options starting with equals sign + +Bug reported in + http://lists.gnu.org/archive/html/bug-tar/2018-12/msg00010.html + +* xheader.c (xheader_set_keyword_equal): Bail out if the keyword starts +with = +--- + src/xheader.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/src/xheader.c b/src/xheader.c +index 980f050..e938502 100644 +--- a/src/xheader.c ++++ b/src/xheader.c +@@ -185,6 +185,9 @@ xheader_set_keyword_equal (char *kw, char *eq) + bool global = true; + char *p = eq; + ++ if (eq == kw) ++ USAGE_ERROR ((0, 0, _("Malformed pax option: %s"), quote (kw))); ++ + if (eq[-1] == ':') + { + p--; +-- +2.19.1 + diff --git a/Remove-erroneous-abort-call.patch b/Remove-erroneous-abort-call.patch new file mode 100644 index 0000000..30cd7b2 --- /dev/null +++ b/Remove-erroneous-abort-call.patch @@ -0,0 +1,33 @@ +From 85c005ee1345c342f707f3c55317daf6cb050603 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Thu, 10 Jan 2019 18:18:49 +0200 +Subject: [PATCH 44/58] Remove erroneous abort() call + +The call was introduced by commit ccef8581. It caused tar to abort +on perfectly normal operations, like untarring archives containing +./ with the -U option, + +See http://lists.gnu.org/archive/html/bug-tar/2019-01/msg00019.html +for details. + +* src/extract.c (maybe_recoverable): Remove misplaced call to abort(). +--- + src/extract.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/extract.c b/src/extract.c +index 090b866..8276f8f 100644 +--- a/src/extract.c ++++ b/src/extract.c +@@ -787,7 +787,7 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) + case UNLINK_FIRST_OLD_FILES: + break; + } +- abort (); /* notreached */ ++ FALLTHROUGH; + + case ENOENT: + /* Attempt creating missing intermediate directories. */ +-- +2.19.1 + diff --git a/Report-race-on-systems-without-O_DIRECTORY.patch b/Report-race-on-systems-without-O_DIRECTORY.patch new file mode 100644 index 0000000..38e3af5 --- /dev/null +++ b/Report-race-on-systems-without-O_DIRECTORY.patch @@ -0,0 +1,30 @@ +From c1b569d9d61f129d2eefd1e87e6ea6cd96810788 Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Tue, 31 Jul 2018 12:13:48 +0300 +Subject: [PATCH 21/58] Report race on systems without O_DIRECTORY + +* src/names.c (collect_and_sort_names): Report ENOTDIR after +successful fstat() but !S_ISDIR. +--- + src/names.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/src/names.c b/src/names.c +index f6ad9fe..f4dc978 100644 +--- a/src/names.c ++++ b/src/names.c +@@ -1767,6 +1767,11 @@ collect_and_sort_names (void) + name->found_count++; + add_hierarchy_to_namelist (&st, name); + } ++ else ++ { ++ errno = ENOTDIR; ++ open_diag (name->name); ++ } + } + } + +-- +2.19.1 + diff --git a/Rewrite-struct-tm-formatting.patch b/Rewrite-struct-tm-formatting.patch new file mode 100644 index 0000000..3b19833 --- /dev/null +++ b/Rewrite-struct-tm-formatting.patch @@ -0,0 +1,45 @@ +From 2d00d8b32190ca7135673999b175850019746042 Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Sat, 7 Apr 2018 10:33:27 +0300 +Subject: [PATCH 10/58] Rewrite struct tm formatting + +* src/list.c (tartime): Use strftime instead of manually formatting +fields of the struct tm. This should also suppress some gcc warnings. +--- + src/list.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/src/list.c b/src/list.c +index 14388a5..2cc5d40 100644 +--- a/src/list.c ++++ b/src/list.c +@@ -23,7 +23,7 @@ + #include + #include + #include +- ++#include + #include "common.h" + + union block *current_header; /* points to current archive header */ +@@ -1049,15 +1049,11 @@ tartime (struct timespec t, bool full_time) + { + if (full_time) + { +- sprintf (buffer, "%04ld-%02d-%02d %02d:%02d:%02d", +- tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday, +- tm->tm_hour, tm->tm_min, tm->tm_sec); ++ strftime (buffer, sizeof buffer, "%Y-%m-%d %H:%M:%S", tm); + code_ns_fraction (ns, buffer + strlen (buffer)); + } + else +- sprintf (buffer, "%04ld-%02d-%02d %02d:%02d", +- tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday, +- tm->tm_hour, tm->tm_min); ++ strftime (buffer, sizeof buffer, "%Y-%m-%d %H:%M", tm); + return buffer; + } + +-- +2.19.1 + diff --git a/Work-over-a-bug-in-gnulib-error.patch b/Work-over-a-bug-in-gnulib-error.patch new file mode 100644 index 0000000..07e8246 --- /dev/null +++ b/Work-over-a-bug-in-gnulib-error.patch @@ -0,0 +1,94 @@ +From 9d1993f651d72f78b2afe416c72b1aeb0c1215ab Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 28 Dec 2018 17:49:08 +0200 +Subject: [PATCH 41/58] Work over a bug in gnulib error() + +The error() function from glibc correctly prefixes each message it +prints with program_name as set by set_program_name. However, its +replacement from gnulib, which is linked in on systems where this +function is not available, prints the name returned by getprogname() +instead. Due to this messages output by tar subprocess (which sets its +program name to 'tar (child)') become indiscernible from those printed +by the main process. In particular, this breaks the remfiles01.at and +remfiles02.at test cases. + +* configure.ac: Define ENABLE_ERROR_PRINT_PROGNAME if using +gnulib error(). +* src/tar.c [ENABLE_ERROR_PRINT_PROGNAME] (tar_print_progname): New function. +(main) [ENABLE_ERROR_PRINT_PROGNAME]: Set error_print_progname. +--- + configure.ac | 12 ++++++++++++ + src/tar.c | 27 +++++++++++++++++++++++++-- + 2 files changed, 37 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 66ed8ca..8e4207b 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -102,6 +102,18 @@ gt_TYPE_SSIZE_T + + # gnulib modules + gl_INIT ++ ++if test $ac_cv_lib_error_at_line = no; then ++ # This means that the error() function is not present in libc, so ++ # the one from gnulib will be used instead. This function precedes ++ # error messages it prints with the program name as returned by getprogname() ++ # call, instead of using the name set by set_program_name. ++ # Install workaround. ++ AC_DEFINE([ENABLE_ERROR_PRINT_PROGNAME],[1], ++ [Enable the use of error_print_progname to print program name with error messages. ++ See comment to function tar_print_progname in src/tar.c]) ++fi ++ + # paxutils modules + tar_PAXUTILS + +diff --git a/src/tar.c b/src/tar.c +index 9c939f3..721d777 100644 +--- a/src/tar.c ++++ b/src/tar.c +@@ -2666,7 +2666,28 @@ decode_options (int argc, char **argv) + + report_textual_dates (&args); + } +- ++ ++#ifdef ENABLE_ERROR_PRINT_PROGNAME ++/* The error() function from glibc correctly prefixes each message it ++ prints with program_name as set by set_program_name. However, its ++ replacement from gnulib, which is linked in on systems where this ++ function is not available, prints the name returned by getprogname() ++ instead. Due to this messages output by tar subprocess (which sets its ++ program name to 'tar (child)') become indiscernible from those printed ++ by the main process. In particular, this breaks the remfiles01.at and ++ remfiles02.at test cases. ++ ++ To avoid this, on such systems the following helper function is used ++ to print proper program name. Its address is assigned to the ++ error_print_progname variable, which error() then uses instead of ++ printing getprogname() result. ++ */ ++static void ++tar_print_progname (void) ++{ ++ fprintf (stderr, "%s: ", program_name); ++} ++#endif + + /* Tar proper. */ + +@@ -2676,7 +2697,9 @@ main (int argc, char **argv) + { + set_start_time (); + set_program_name (argv[0]); +- ++#ifdef ENABLE_ERROR_PRINT_PROGNAME ++ error_print_progname = tar_print_progname; ++#endif + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); +-- +2.19.1 + diff --git a/maint-avoid-Wstringop-truncation-warnings-from-upcom.patch b/maint-avoid-Wstringop-truncation-warnings-from-upcom.patch new file mode 100644 index 0000000..1754774 --- /dev/null +++ b/maint-avoid-Wstringop-truncation-warnings-from-upcom.patch @@ -0,0 +1,47 @@ +From 0a0242582f134c9994bbad77a57f64d388cf9e19 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sun, 18 Mar 2018 21:32:19 -0700 +Subject: [PATCH 13/58] maint: avoid -Wstringop-truncation warnings from + upcoming GCC8 + +* src/create.c (start_private_header, start_header): Convert +trivial uses of strncpy to memcpy, to avoid warnings like this: +In function 'strncpy', + inlined from 'start_private_header' at create.c:522:3: +/usr/include/bits/string_fortified.h:106:10: warning: \ + '__builtin_strncpy' output truncated before terminating nul \ + copying 2 bytes from a string of the same length \ + [-Wstringop-truncation] +--- + src/create.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/create.c b/src/create.c +index 35bcf5b..7737c52 100644 +--- a/src/create.c ++++ b/src/create.c +@@ -518,8 +518,8 @@ start_private_header (const char *name, size_t size, time_t t) + MODE_TO_CHARS (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, header->header.mode); + UID_TO_CHARS (0, header->header.uid); + GID_TO_CHARS (0, header->header.gid); +- strncpy (header->header.magic, TMAGIC, TMAGLEN); +- strncpy (header->header.version, TVERSION, TVERSLEN); ++ memcpy (header->header.magic, TMAGIC, TMAGLEN); ++ memcpy (header->header.version, TVERSION, TVERSLEN); + return header; + } + +@@ -917,8 +917,8 @@ start_header (struct tar_stat_info *st) + + case POSIX_FORMAT: + case USTAR_FORMAT: +- strncpy (header->header.magic, TMAGIC, TMAGLEN); +- strncpy (header->header.version, TVERSION, TVERSLEN); ++ memcpy (header->header.magic, TMAGIC, TMAGLEN); ++ memcpy (header->header.version, TVERSION, TVERSLEN); + break; + + default: +-- +2.19.1 + diff --git a/maint-avoid-Wstringop-truncation-warnings-upcoming-G.patch b/maint-avoid-Wstringop-truncation-warnings-upcoming-G.patch new file mode 100644 index 0000000..a5fa821 --- /dev/null +++ b/maint-avoid-Wstringop-truncation-warnings-upcoming-G.patch @@ -0,0 +1,50 @@ +From 2baa531ce53d5876d34f941a97b5041573da453a Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sun, 18 Mar 2018 21:20:28 -0700 +Subject: [PATCH 12/58] maint: avoid -Wstringop-truncation warnings upcoming + GCC8 + +* src/buffer.c (gnu_add_multi_volume_header): Convert a use of +strncpy to memcpy, to avoid this warning: +In function 'strncpy', + inlined from 'gnu_add_multi_volume_header' at buffer.c:1782:3, + ... +/usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy'\ + specified bound 100 equals destination size \ + [-Werror=stringop-truncation] +--- + src/buffer.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/src/buffer.c b/src/buffer.c +index 063e1be..b710c6a 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -1771,15 +1771,19 @@ gnu_add_multi_volume_header (struct bufmap *map) + { + int tmp; + union block *block = find_next_block (); ++ size_t len = strlen (map->file_name); + +- if (strlen (map->file_name) > NAME_FIELD_SIZE) +- WARN ((0, 0, +- _("%s: file name too long to be stored in a GNU multivolume header, truncated"), +- quotearg_colon (map->file_name))); ++ if (len > NAME_FIELD_SIZE) ++ { ++ WARN ((0, 0, ++ _("%s: file name too long to be stored in a GNU multivolume header, truncated"), ++ quotearg_colon (map->file_name))); ++ len = NAME_FIELD_SIZE; ++ } + + memset (block, 0, BLOCKSIZE); + +- strncpy (block->header.name, map->file_name, NAME_FIELD_SIZE); ++ memcpy (block->header.name, map->file_name, len); + block->header.typeflag = GNUTYPE_MULTIVOL; + + OFF_TO_CHARS (map->sizeleft, block->header.size); +-- +2.19.1 + diff --git a/maint-avoid-warnings-from-upcoming-GCC8.patch b/maint-avoid-warnings-from-upcoming-GCC8.patch new file mode 100644 index 0000000..e202c2b --- /dev/null +++ b/maint-avoid-warnings-from-upcoming-GCC8.patch @@ -0,0 +1,43 @@ +From ccef8581b8673cadd1c084595de4efde956c3c2b Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sun, 18 Mar 2018 17:59:25 -0700 +Subject: [PATCH 11/58] maint: avoid warnings from upcoming GCC8 + +* src/transform.c (_single_transform_name_to_obstack): Mark with +FALLTHROUGH statement rather than /* FALL THROUGH */ comment. +Only the former works with gcc-8. +* src/extract.c (maybe_recoverable): Call abort to tell gcc-8 that +this code is unreachable. +--- + src/extract.c | 1 + + src/transform.c | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/extract.c b/src/extract.c +index 395db55..74987bb 100644 +--- a/src/extract.c ++++ b/src/extract.c +@@ -788,6 +788,7 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) + case UNLINK_FIRST_OLD_FILES: + break; + } ++ abort (); /* notreached */ + + case ENOENT: + /* Attempt creating missing intermediate directories. */ +diff --git a/src/transform.c b/src/transform.c +index e450dd2..3fae3c0 100644 +--- a/src/transform.c ++++ b/src/transform.c +@@ -550,7 +550,7 @@ _single_transform_name_to_obstack (struct transform *tf, char *input) + default: + break; + } +- /*FALL THROUGH*/ ++ FALLTHROUGH; + + case ctl_upcase: + case ctl_locase: +-- +2.19.1 + diff --git a/one-top-level-avoid-a-heap-buffer-overflow.patch b/one-top-level-avoid-a-heap-buffer-overflow.patch new file mode 100644 index 0000000..6146841 --- /dev/null +++ b/one-top-level-avoid-a-heap-buffer-overflow.patch @@ -0,0 +1,73 @@ +From b531801d6f49d64a126720e6004aae7c800764b2 Mon Sep 17 00:00:00 2001 +From: Jim Meyering +Date: Sat, 7 Apr 2018 08:41:46 -0700 +Subject: [PATCH 16/58] --one-top-level: avoid a heap-buffer-overflow + +* NEWS: Mention this. +* src/suffix.c (strip_compression_suffix): Fix string comparison guard. +Without this change, some ASAN-enabled test runs would fail with the +following. Also, strip an additional .tar suffix only if the just- +stripped suffix did not match /^\.t/". + +==30815==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6020000002ed at pc 0x00000049d1f4 bp 0x7ffeb5906d50 sp 0x7ffeb5906500 +READ of size 1 at 0x6020000002ed thread T0 +SCARINESS: 12 (1-byte-read-heap-buffer-overflow) + #0 0x49d1f3 in __interceptor_strncmp /j/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:407 + #1 0x5670f3 in strip_compression_suffix /j/tar/src/suffix.c:107 + #2 0x575788 in decode_options /j/tar/src/tar.c:2545 + #3 0x5760c0 in main /j/tar/src/tar.c:2708 + #4 0x7f105090df29 in __libc_start_main ../csu/libc-start.c:308 + #5 0x408629 in _start (/j/tar/src/tar+0x408629) + +0x6020000002ed is located 3 bytes to the left of 6-byte region [0x6020000002f0,0x6020000002f6) +allocated by thread T0 here: + #0 0x4d0710 in __interceptor_malloc /j/gcc/libsanitizer/asan/asan_malloc_linux.cc:86 + #1 0x4908ad in __interceptor_strndup /j/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:326 + #2 0x5cbcbd in xstrndup /j/tar/gnu/xstrndup.c:32 + #3 0x5a325b in base_name /j/tar/gnu/basename.c:57 + #4 0x575772 in decode_options /j/tar/src/tar.c:2544 + #5 0x5760c0 in main /j/tar/src/tar.c:2708 + #6 0x7f105090df29 in __libc_start_main ../csu/libc-start.c:308 +--- + NEWS | 7 +++++-- + src/suffix.c | 11 +++++++---- + 2 files changed, 12 insertions(+), 6 deletions(-) + +diff --git a/src/suffix.c b/src/suffix.c +index 66b5694..d787ea8 100644 +--- a/src/suffix.c ++++ b/src/suffix.c +@@ -62,7 +62,7 @@ find_compression_suffix (const char *name, size_t *ret_len) + { + size_t len; + struct compression_suffix *p; +- ++ + suf++; + len = strlen (suf); + +@@ -101,10 +101,14 @@ strip_compression_suffix (const char *name) + { + char *s = NULL; + size_t len; ++ struct compression_suffix const *p = find_compression_suffix (name, &len); + +- if (find_compression_suffix (name, &len)) ++ if (p) + { +- if (strncmp (name + len - 4, ".tar", 4) == 0) ++ /* Strip an additional ".tar" suffix, but only if the just-stripped ++ "outer" suffix did not begin with "t". */ ++ if (len > 4 && strncmp (name + len - 4, ".tar", 4) == 0 ++ && p->suffix[0] != 't') + len -= 4; + if (len == 0) + return NULL; +@@ -114,4 +118,3 @@ strip_compression_suffix (const char *name) + } + return s; + } +- +-- +2.19.1 + diff --git a/tar-1.28-atime-rofs.patch b/tar-1.28-atime-rofs.patch new file mode 100644 index 0000000..f32114a --- /dev/null +++ b/tar-1.28-atime-rofs.patch @@ -0,0 +1,34 @@ +From 71769b9ea3c12b7fbb39fee2e9f4a4c1c36c0d0b Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Jul 2014 08:13:31 +0200 +Subject: [PATCH 4/9] utime & read-only FS + +Ignore errors from setting utime() for source file on read-only +file-system. + +Resolves: #500742 + +Upstream bugreport (still downstream): +http://lists.gnu.org/archive/html/bug-tar/2009-06/msg00016.html + +--- + src/create.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/create.c b/src/create.c +index e2f4ede..f644f23 100644 +--- a/src/create.c ++++ b/src/create.c +@@ -1824,7 +1824,8 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) + } + else if (atime_preserve_option == replace_atime_preserve + && fd && (is_dir || original_size != 0) +- && set_file_atime (fd, parentfd, name, st->atime) != 0) ++ && set_file_atime (fd, parentfd, name, st->atime) != 0 ++ && errno != EROFS ) + utime_error (p); + } + +-- +1.9.3 + diff --git a/tar-1.28-document-exclude-mistakes.patch b/tar-1.28-document-exclude-mistakes.patch new file mode 100644 index 0000000..73f4ed3 --- /dev/null +++ b/tar-1.28-document-exclude-mistakes.patch @@ -0,0 +1,97 @@ +From 18112ded916cf62b3bd3c0ffb9530e4ade3d2209 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Jul 2014 08:16:33 +0200 +Subject: [PATCH 7/9] Document exclude mistakes with + +.. usually with --no-wildcards-match-slash & --anchored options. + +Upstream bugreport (still downstream): +http://www.mail-archive.com/bug-tar@gnu.org/msg04488.html + +Related: #903666 + +--- + doc/tar.texi | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 67 insertions(+) + +diff --git a/doc/tar.texi b/doc/tar.texi +index a000f3f..2695d22 100644 +--- a/doc/tar.texi ++++ b/doc/tar.texi +@@ -8051,6 +8051,73 @@ The following table summarizes pattern-matching default values: + @item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash} + @end multitable + ++@subsubsection Wildcard matching confusion ++Using of @option{--[no-]anchored} and @option{--[no-]wildcards-match-slash} ++was proven to make confusion. The reasons for this are probably different ++default setting for inclusion and exclusion patterns (in general: you shouldn't ++rely on defaults if possible) and maybe also because when using any of these two ++options, the position on command line matters (these options should be placed ++prior to the member name on command line). ++ ++@noindent ++Consider following directory structure: ++ ++@smallexample ++$ find path/ | sort ++path/ ++path/file1 ++path/file2 ++path/subpath ++path/subpath/file1 ++path/subpath/file2 ++path/subpath2 ++path/subpath2/file1 ++path/subpath2/file2 ++@end smallexample ++ ++@noindent ++To archive full directory @samp{path} except all files named @samp{file1} may be ++reached by any of the two following commands: ++ ++@smallexample ++$ tar -cf a.tar --no-wildcards-match-slash --no-anchored path \ ++ --exclude='*/file1' ++$ tar -cf a.tar --wildcards-match-slash path --exclude='*/file1' ++@end smallexample ++ ++@noindent ++Note that the @option{--wildcards-match-slash} and @option{--no-anchored} may be ++omitted as it is default for @option{--exclude}. Anyway, we usually want just ++concrete file (or rather subset of files with the same name). Assume we want ++exclude only files named @samp{file1} from the first subdirectory level. ++Following command obviously does not work (it still excludes all files having ++@samp{file1} name): ++ ++@smallexample ++$ tar -cf a.tar --no-wildcards-match-slash path \ ++ --exclude='*/file1' | sort ++@end smallexample ++ ++@noindent ++This is because the @option{--no-anchored} is set by default for exclusion. ++What you need to fix is to put @option{--anchored} before pathname: ++ ++@smallexample ++$ tar -cvf a.tar --no-wildcards-match-slash --anchored path \ ++ --exclude='*/file1' | sort ++path/ ++path/file2 ++path/subpath1/ ++path/subpath1/file1 ++path/subpath1/file2 ++path/subpath2/ ++path/subpath2/file1 ++path/subpath2/file2 ++@end smallexample ++ ++@noindent ++Similarly you can exclude second level by specifying @samp{*/*/file1}. ++ + @node quoting styles + @section Quoting Member Names + +-- +1.9.3 + diff --git a/tar-1.28-loneZeroWarning.patch b/tar-1.28-loneZeroWarning.patch new file mode 100644 index 0000000..c142ea3 --- /dev/null +++ b/tar-1.28-loneZeroWarning.patch @@ -0,0 +1,43 @@ +From 60d08c6d82f0c33a6704c79afd416902eb8c663f Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Jul 2014 08:08:50 +0200 +Subject: [PATCH 1/9] Stop issuing lone zero block warnings (downstram) + +Resolves: #135601 + +--- + src/list.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/src/list.c b/src/list.c +index b4277e0..0c7a740 100644 +--- a/src/list.c ++++ b/src/list.c +@@ -240,6 +240,14 @@ read_and (void (*do_something) (void)) + + if (!ignore_zeros_option) + { ++ /* ++ * According to POSIX tar specs, this is wrong, but on the web ++ * there are some tar specs that can trigger this, and some tar ++ * implementations create tars according to that spec. For now, ++ * let's not be pedantic about issuing the warning. ++ */ ++#if 0 ++ + char buf[UINTMAX_STRSIZE_BOUND]; + + status = read_header (¤t_header, ¤t_stat_info, +@@ -249,6 +257,9 @@ read_and (void (*do_something) (void)) + WARNOPT (WARN_ALONE_ZERO_BLOCK, + (0, 0, _("A lone zero block at %s"), + STRINGIFY_BIGINT (current_block_ordinal (), buf))); ++#endif ++ status = read_header (¤t_header, ¤t_stat_info, ++ read_header_auto); + break; + } + status = prev_status; +-- +1.9.3 + diff --git a/tar-1.28-sparse-inf-loops.patch b/tar-1.28-sparse-inf-loops.patch new file mode 100644 index 0000000..94d2bb5 --- /dev/null +++ b/tar-1.28-sparse-inf-loops.patch @@ -0,0 +1,129 @@ +From b451bfd224da44e93cf842f23455d755e48421dd Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Mon, 28 Jul 2014 08:17:55 +0200 +Subject: [PATCH 8/9] Fix for infinite loops during sparse file handling + +Upstream bugreport (still downstream): +http://www.mail-archive.com/bug-tar@gnu.org/msg04432.html + +Resolves: #1082608 + +--- + THANKS | 1 + + src/sparse.c | 48 ++++++++++++++++++++++++++++++++---------------- + 2 files changed, 33 insertions(+), 16 deletions(-) + +diff --git a/THANKS b/THANKS +index b4c5427..e74f71c 100644 +--- a/THANKS ++++ b/THANKS +@@ -175,6 +175,7 @@ Fabio d'Alessi cars@civ.bio.unipd.it + Frank Heckenbach frank@g-n-u.de + Frank Koenen koenfr@lidp.com + Franz-Werner Gergen gergen@edvulx.mpi-stuttgart.mpg.de ++François Ouellet fouell@gmail.com + François Pinard pinard@iro.umontreal.ca + Fritz Elfert fritz@fsun.triltsch.de + George Chyu gschyu@ccgate.dp.beckman.com +diff --git a/src/sparse.c b/src/sparse.c +index 6a97676..53c1868 100644 +--- a/src/sparse.c ++++ b/src/sparse.c +@@ -301,6 +301,7 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i) + { + union block *blk; + off_t bytes_left = file->stat_info->sparse_map[i].numbytes; ++ const char *file_name = file->stat_info->orig_file_name; + + if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset)) + return false; +@@ -314,13 +315,23 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i) + bytes_read = safe_read (file->fd, blk->buffer, bufsize); + if (bytes_read == SAFE_READ_ERROR) + { +- read_diag_details (file->stat_info->orig_file_name, ++ read_diag_details (file_name, + (file->stat_info->sparse_map[i].offset + + file->stat_info->sparse_map[i].numbytes + - bytes_left), + bufsize); + return false; + } ++ if (bytes_read == 0) ++ { ++ char buf[UINTMAX_STRSIZE_BOUND]; ++ FATAL_ERROR ((0, 0, ++ ngettext ("%s: File shrank by %s byte", ++ "%s: File shrank by %s bytes", ++ bytes_left), ++ quotearg_colon (file_name), ++ offtostr (bytes_left, buf))); ++ } + + memset (blk->buffer + bytes_read, 0, BLOCKSIZE - bytes_read); + bytes_left -= bytes_read; +@@ -475,33 +486,37 @@ sparse_skip_file (struct tar_stat_info *st) + static bool + check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end) + { +- if (!lseek_or_error (file, beg)) ++ off_t offset = beg; ++ ++ if (!lseek_or_error (file, offset)) + return false; + +- while (beg < end) ++ while (offset < end) + { + size_t bytes_read; +- size_t rdsize = BLOCKSIZE < end - beg ? BLOCKSIZE : end - beg; ++ size_t rdsize = BLOCKSIZE < end - offset ? BLOCKSIZE : end - offset; + char diff_buffer[BLOCKSIZE]; + + bytes_read = safe_read (file->fd, diff_buffer, rdsize); + if (bytes_read == SAFE_READ_ERROR) + { + read_diag_details (file->stat_info->orig_file_name, +- beg, +- rdsize); +- return false; +- } +- if (!zero_block_p (diff_buffer, bytes_read)) +- { +- char begbuf[INT_BUFSIZE_BOUND (off_t)]; +- report_difference (file->stat_info, +- _("File fragment at %s is not a hole"), +- offtostr (beg, begbuf)); ++ offset, rdsize); + return false; + } + +- beg += bytes_read; ++ if (bytes_read == 0 ++ || !zero_block_p (diff_buffer, bytes_read)) ++ { ++ char begbuf[INT_BUFSIZE_BOUND (off_t)]; ++ const char *msg = bytes_read ? _("File fragment at %s is not a hole") ++ : _("Hole starting at %s is truncated"); ++ ++ report_difference (file->stat_info, msg, offtostr (beg, begbuf)); ++ return false; ++ } ++ ++ offset += bytes_read; + } + return true; + } +@@ -542,7 +557,8 @@ check_data_region (struct tar_sparse_file *file, size_t i) + file->dumped_size += bytes_read; + size_left -= bytes_read; + mv_size_left (file->stat_info->archive_file_size - file->dumped_size); +- if (memcmp (blk->buffer, diff_buffer, rdsize)) ++ if (bytes_read == 0 ++ || memcmp (blk->buffer, diff_buffer, bytes_read)) + { + report_difference (file->stat_info, _("Contents differ")); + return false; +-- +1.9.3 + diff --git a/tar-1.28-vfatTruncate.patch b/tar-1.28-vfatTruncate.patch new file mode 100644 index 0000000..734fbc4 --- /dev/null +++ b/tar-1.28-vfatTruncate.patch @@ -0,0 +1,52 @@ +From 90f446f9b04ab820a99b9408e68c01dc6b57056c Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Jul 2014 08:10:10 +0200 +Subject: [PATCH 2/9] vfat-like FS & sparse (still downstream) + +Fix extracting sparse files to a file system like vfat, when +ftruncate may fail to grow the size of a file. Still downstram, +(do we need this now? ftruncate & vfat works is now OK). + +Resolves: #179507 + +Upstream bugreport: +http://lists.gnu.org/archive/html/bug-tar/2006-02/msg00000.html + +--- + src/system.c | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/src/system.c b/src/system.c +index 9414233..37e9a3e 100644 +--- a/src/system.c ++++ b/src/system.c +@@ -243,8 +243,25 @@ sys_compare_links (struct stat *link_data, struct stat *stat_data) + int + sys_truncate (int fd) + { ++ struct stat st; + off_t pos = lseek (fd, (off_t) 0, SEEK_CUR); +- return pos < 0 ? -1 : ftruncate (fd, pos); ++ ++ if ( pos < 0) ++ return -1; ++ ++ if ( ftruncate(fd, pos) && errno == EPERM ) { ++ /* wrapper around ftruncate: ++ * ftruncate may fail to grow the size of a file with some OS and filesystem ++ * combinations. Linux and vfat/fat is one example. If this is the case do ++ * a write to grow the file to the desired length. ++ */ ++ if( (fstat( fd, &st ) == -1) || ++ (st.st_size >= pos) || ++ (lseek( fd, pos - 1, SEEK_SET) == (off_t)-1) || ++ (write( fd, "\0", 1) == -1) ) ++ return -1; ++ } ++ return 0; + } + + /* Return nonzero if NAME is the name of a regular file, or if the file +-- +1.9.3 + diff --git a/tar-1.29-wildcards.patch b/tar-1.29-wildcards.patch new file mode 100644 index 0000000..e239155 --- /dev/null +++ b/tar-1.29-wildcards.patch @@ -0,0 +1,107 @@ +From ae0730a98f7269a7bf7adb6047aa421939b290b7 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Mon, 28 Jul 2014 08:12:14 +0200 +Subject: [PATCH] wildcard defaults (downstram; compatibility) + +Change inclusion defaults of tar to "wildcards --anchored +--wildcards-match-slash" for compatibility reasons. + +Resolves: #206841 +--- + doc/tar.texi | 5 ++++- + src/names.c | 15 +++++---------- + tests/exclude01.at | 1 + + 3 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/doc/tar.texi b/doc/tar.texi +index a8969e0..0185157 100644 +--- a/doc/tar.texi ++++ b/doc/tar.texi +@@ -8439,7 +8439,7 @@ The following table summarizes pattern-matching default values: + + @multitable @columnfractions .3 .7 + @headitem Members @tab Default settings +-@item Inclusion @tab @option{--no-wildcards --anchored --no-wildcards-match-slash} ++@item Inclusion @tab @option{--wildcards --anchored --wildcards-match-slash} + @item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash} + @end multitable + +@@ -12915,6 +12915,9 @@ version of this document is available at + @table @asis + @item Use of globbing patterns when listing and extracting. + ++Note: Following is true for original unpatched GNU tar. ++For compatibility reasons, the old behavior was preserved. ++ + Previous versions of GNU tar assumed shell-style globbing when + extracting from or listing an archive. For example: + +diff --git a/src/names.c b/src/names.c +index 037b869..d96ad71 100644 +--- a/src/names.c ++++ b/src/names.c +@@ -137,7 +137,7 @@ static struct argp_option names_options[] = { + {"no-ignore-case", NO_IGNORE_CASE_OPTION, 0, 0, + N_("case sensitive matching (default)"), GRID+1 }, + {"wildcards", WILDCARDS_OPTION, 0, 0, +- N_("use wildcards (default for exclusion)"), GRID+1 }, ++ N_("use wildcards (default)"), GRID+1 }, + {"no-wildcards", NO_WILDCARDS_OPTION, 0, 0, + N_("verbatim string matching"), GRID+1 }, + {"wildcards-match-slash", WILDCARDS_MATCH_SLASH_OPTION, 0, 0, +@@ -195,8 +195,7 @@ names_parse_opt (int key, char *arg, struct argp_state *state) + /* Wildcard matching settings */ + enum wildcards + { +- default_wildcards, /* For exclusion == enable_wildcards, +- for inclusion == disable_wildcards */ ++ default_wildcards, /* enable_wildcards */ + disable_wildcards, + enable_wildcards + }; +@@ -214,7 +213,7 @@ static int include_anchored = EXCLUDE_ANCHORED; + | recursion_option) + + #define INCLUDE_OPTIONS \ +- (((wildcards == enable_wildcards) ? EXCLUDE_WILDCARDS : 0) \ ++ (((wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \ + | include_anchored \ + | matching_flags \ + | recursion_option) +@@ -1234,8 +1233,7 @@ regex_usage_warning (const char *name) + + /* Warn about implicit use of the wildcards in command line arguments. + (Default for tar prior to 1.15.91, but changed afterwards) */ +- if (wildcards == default_wildcards +- && fnmatch_pattern_has_wildcards (name, 0)) ++ if (0 && fnmatch_pattern_has_wildcards (name, 0)) + { + warned_once = 1; + WARN ((0, 0, +@@ -1618,10 +1616,7 @@ collect_and_sort_names (void) + + if (name->found_count || name->directory) + continue; +- if (name->matching_flags & EXCLUDE_WILDCARDS) +- /* NOTE: EXCLUDE_ANCHORED is not relevant here */ +- /* FIXME: just skip regexps for now */ +- continue; ++ + chdir_do (name->change_dir); + + if (name->name[0] == 0) +diff --git a/tests/exclude01.at b/tests/exclude01.at +index c3cd10b..c590047 100644 +--- a/tests/exclude01.at ++++ b/tests/exclude01.at +@@ -61,6 +61,7 @@ testdir/dir2/file2 + testdir/dir3/ + NEXT + testdir/dir1/* ++testdir/dir1/file1 + NEXT + testdir/dir1/* + NEXT +-- +2.5.5 + diff --git a/tar-1.30-tests-difflink.patch b/tar-1.30-tests-difflink.patch new file mode 100644 index 0000000..e4070d7 --- /dev/null +++ b/tar-1.30-tests-difflink.patch @@ -0,0 +1,15 @@ +Per https://www.mail-archive.com/bug-tar@gnu.org/msg05440.html + +diff --git a/tests/difflink.at b/tests/difflink.at +index eadfb08..4e01176 100644 +--- 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/tar-1.30-tests-dirrem.patch b/tar-1.30-tests-dirrem.patch new file mode 100644 index 0000000..6280495 --- /dev/null +++ b/tar-1.30-tests-dirrem.patch @@ -0,0 +1,93 @@ +From 298cfc4743b9cca6cc0c685b9fce5b34827bec1b Mon Sep 17 00:00:00 2001 +From: Pavel Raiskup +Date: Thu, 4 Jan 2018 18:21:27 +0100 +Subject: [PATCH] tests: fix race in dirrem01 and dirrem02 + +Proposal: +https://www.mail-archive.com/bug-tar@gnu.org/msg05451.html + +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. +--- + 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]) +-- +2.14.3 + diff --git a/tar-1.30.tar.xz b/tar-1.30.tar.xz new file mode 100644 index 0000000..1583a84 Binary files /dev/null and b/tar-1.30.tar.xz differ diff --git a/tar-1.30.tar.xz.sig b/tar-1.30.tar.xz.sig new file mode 100644 index 0000000..3069edf --- /dev/null +++ b/tar-1.30.tar.xz.sig @@ -0,0 +1,7 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1.4.15 (GNU/Linux) + +iEYEABECAAYFAlo2WDAACgkQNgKwf1XQxzLIAwCcCkJzqedt2FUq1N5ysPFomhvS +SnIAnj+0Y7vNI1E4w/ektRMB/HTQceeK +=TjVE +-----END PGP SIGNATURE----- diff --git a/tar.spec b/tar.spec new file mode 100644 index 0000000..924a7e2 --- /dev/null +++ b/tar.spec @@ -0,0 +1,104 @@ +Name: tar +Version: 1.30 +Release: 7 +Epoch: 2 +Summary: An organized and systematic method of controlling a large amount of data +License: GPLv3+ +URL: http://www.gnu.org/software/tar/ +Source0: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz +Source1: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz.sig + +BuildRequires: autoconf automake texinfo gettext libacl-devel attr acl policycoreutils +Provides: bundled(gnulib) /bin/tar /bin/gtar + +#patch0001~0008 come from fedora +Patch0001: tar-1.28-loneZeroWarning.patch +Patch0002: tar-1.28-vfatTruncate.patch +Patch0003: tar-1.29-wildcards.patch +Patch0004: tar-1.28-atime-rofs.patch +Patch0005: tar-1.28-document-exclude-mistakes.patch +Patch0006: tar-1.28-sparse-inf-loops.patch +Patch0007: tar-1.30-tests-difflink.patch +Patch0008: tar-1.30-tests-dirrem.patch + +Patch9000: Rewrite-struct-tm-formatting.patch +Patch9001: maint-avoid-warnings-from-upcoming-GCC8.patch +Patch9002: maint-avoid-Wstringop-truncation-warnings-upcoming-G.patch +Patch9003: maint-avoid-Wstringop-truncation-warnings-from-upcom.patch +Patch9004: one-top-level-avoid-a-heap-buffer-overflow.patch +Patch9005: Avoid-some-resource-leaks.patch +Patch9006: Report-race-on-systems-without-O_DIRECTORY.patch +Patch9007: Fix-double-free-introduced-by-577dc345.patch +Patch9008: Fix-improper-memory-access.patch +Patch9009: Fix-buffer-overflow.patch +Patch9010: Reject-pax-options-starting-with-equals-sign.patch +Patch9011: Fix-error-handling-when-reading-incremental-snapshot.patch +Patch9012: Fix-semantics-of-K-used-together-with-explicit-membe.patch +Patch9013: Bugfix.patch +Patch9014: Disallow-modifications-to-the-global-pax-extended-he.patch +Patch9015: Work-over-a-bug-in-gnulib-error.patch +Patch9016: Remove-erroneous-abort-call.patch +Patch9017: Fix-iconv-usage.patch +Patch9018: Fix-compilation-without-iconv.patch +Patch9019: Fix-build-on-AIX.patch +Patch9020: Fix-possible-NULL-dereference-savannah-bug-55369.patch + +%description +GNU Tar provides the ability to create tar archives, as well as various other +kinds of manipulation. For example, you can use Tar on previously created archives +to extract files, to store additional files, or to update or list files which were +already stored. + +%package help +Summary: help document for tar +Requires: %{name} = %{epoch}:%{version}-%{release} +BuildArch: noarch + +%description help +Help document for tar. + +%prep +%autosetup -n tar-%{version} -p1 +autoreconf -v + +%build +%configure --without-selinux --with-lzma="xz --format=lzma" \ + DEFAULT_RMT_DIR=%{_sysconfdir} RSH=/usr/bin/ssh +%make_build + +%install +%make_install + +ln -s tar %{buildroot}%{_bindir}/gtar +ln -s tar.1.gz %{buildroot}%{_mandir}/man1/gtar.1 + +rm -f %{buildroot}%{_infodir}/dir +rm -f %{buildroot}%{_sysconfdir}/rmt +rm -f %{buildroot}%{_mandir}/man8/rmt.8* + +%find_lang tar + + +%check +make check + +%pre + +%preun + +%post + +%postun + +%files -f tar.lang +%doc AUTHORS README THANKS NEWS ChangeLog COPYING +%{_bindir}/*tar + +%files help +%{_mandir}/man1/*tar.1* +%{_infodir}/tar.info* + +%changelog +* Tue Sep 10 2019 Huiming Xie - 2:1.30.7 +- Package init +