diff --git a/tar-1.28-atime-rofs.patch b/tar-1.28-atime-rofs.patch new file mode 100644 index 0000000..75fcb04 --- /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 d20178c..b31fbe5 100644 +--- a/src/create.c ++++ b/src/create.c +@@ -1851,7 +1851,8 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p) + } + else if (atime_preserve_option == replace_atime_preserve + && timespec_cmp (st->atime, get_stat_atime (&st2)) != 0 +- && set_file_atime (fd, parentfd, name, st->atime) != 0) ++ && set_file_atime (fd, parentfd, name, st->atime) != 0 ++ && errno != EROFS ) + utime_error (p); + } + +-- +2.41.0 + diff --git a/tar-1.29-wildcards.patch b/tar-1.29-wildcards.patch new file mode 100644 index 0000000..40f9425 --- /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 +@@ -146,7 +146,7 @@ static struct argp_option names_options[] = { + {"no-wildcards", NO_WILDCARDS_OPTION, 0, 0, + N_("verbatim string matching"), GRID_MATCH }, + {"wildcards-match-slash", WILDCARDS_MATCH_SLASH_OPTION, 0, 0, +- N_("wildcards match '/' (default for exclusion)"), GRID_MATCH }, ++ N_("wildcards match '/' (default)"), GRID_MATCH }, + {"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0, + N_("wildcards do not match '/'"), GRID_MATCH }, + +@@ -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.33-fix-capabilities-test.patch b/tar-1.33-fix-capabilities-test.patch new file mode 100644 index 0000000..5835c2d --- /dev/null +++ b/tar-1.33-fix-capabilities-test.patch @@ -0,0 +1,34 @@ +From: Pavel Raiskup +Date: Tue, 16 Feb 2021 08:10:22 +0100 +Subject: [PATCH] Related discussion in the Fedora pull-request: + https://src.fedoraproject.org/rpms/tar/pull-request/8 + +Upstream report: +https://www.mail-archive.com/bug-tar@gnu.org/msg05943.html + +* tests/capabs_raw01.at: Newer systems (currently e.g. Fedora 34) +print getcap output in format CAP=VAL, not CAP+VAL. +--- + tests/capabs_raw01.at | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/capabs_raw01.at b/tests/capabs_raw01.at +index a1d9411..d3da923 100644 +--- a/tests/capabs_raw01.at ++++ b/tests/capabs_raw01.at +@@ -45,10 +45,10 @@ rm -rf dir + tar --xattrs --xattrs-include='*' -xf archive.tar + + # Newer systems print = instead of + here +-getcap dir/file | sed 's/+/=/' ++getcap dir/file | sed -e 's/+/=/' -e 's|dir/file = |dir/file |' + ], + [0], +-[dir/file = cap_chown=ei ++[dir/file cap_chown=ei + ]) + + AT_CLEANUP +-- +2.26.0 + diff --git a/tar-1.35-add-forgotten-tests-from-upstream.patch b/tar-1.35-add-forgotten-tests-from-upstream.patch new file mode 100644 index 0000000..5899901 --- /dev/null +++ b/tar-1.35-add-forgotten-tests-from-upstream.patch @@ -0,0 +1,156 @@ +From 7fac753fb6e6c0459788ee9015b984dba1de5402 Mon Sep 17 00:00:00 2001 +From: Lukas Javorsky +Date: Tue, 18 Jul 2023 14:10:12 +0000 +Subject: [PATCH] Add exclude17 and exclude18 tests which were forgotten by + upstream + +Sources: +*https://git.savannah.gnu.org/cgit/tar.git/tree/tests/exclude17.at +*https://git.savannah.gnu.org/cgit/tar.git/tree/tests/exclude18.at + +Repoted to upstream in ML: +*https://lists.gnu.org/archive/html/bug-tar/2023-07/msg00002.html +--- + tests/exclude17.at | 35 +++++++++++++++++++ + tests/exclude18.at | 87 ++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 122 insertions(+) + create mode 100644 tests/exclude17.at + create mode 100644 tests/exclude18.at + +diff --git a/tests/exclude17.at b/tests/exclude17.at +new file mode 100644 +index 0000000..5539ef3 +--- /dev/null ++++ b/tests/exclude17.at +@@ -0,0 +1,35 @@ ++# Process this file with autom4te to create testsuite. -*- Autotest -*- ++# ++# Test suite for GNU tar. ++# Copyright 2013-2023 Free Software Foundation, Inc. ++ ++# This file is part of GNU tar. ++ ++# GNU tar is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# GNU tar is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++AT_SETUP([--exclude-vcs-ignores memory allocation]) ++AT_KEYWORDS([exclude exclude17]) ++ ++AT_TAR_CHECK([ ++mkdir dir ++cd dir ++echo '*.o' >.cvsignore ++tar -cf - --exclude-vcs-ignores . | tar -tf - ++], ++[0], ++[./ ++./.cvsignore ++]) ++ ++AT_CLEANUP +diff --git a/tests/exclude18.at b/tests/exclude18.at +new file mode 100644 +index 0000000..64aaa52 +--- /dev/null ++++ b/tests/exclude18.at +@@ -0,0 +1,87 @@ ++# Process this file with autom4te to create testsuite. -*- Autotest -*- ++ ++# Test suite for GNU tar. ++# Copyright 2004-2023 Free Software Foundation, Inc. ++ ++# This file is part of GNU tar. ++ ++# GNU tar is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# GNU tar is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++# Test --exclude-vcs option with subcommands: EXTRACT, LIST, DIFF. ++# Check VCS directory with files, and empty. ++# ++# Ref: https://savannah.gnu.org/bugs/?62859 ++# Wed 03 Aug 2022 04:06:28 PM UTC, original submission: Quote ++# Mohamed Akram ++# > The --exclude-vcs flag seems to exclude .gitignore but not .git when ++# extracting. ++ ++AT_SETUP([--exclude-vcs extract list compare]) ++AT_KEYWORDS([exclude-vcs extract list compare exclude18]) ++ ++AT_TAR_CHECK([ ++AT_SORT_PREREQ ++mkdir gitrepo ++cd gitrepo ++ ++# Make an empty VCS directory: ++mkdir .svn ++ ++# Make a VCS directory with a file: ++mkdir .git ++touch .git/_A ++ ++# Make a VCS file: ++touch .gitignore ++ ++# Make non-VCS files: ++touch .git_B ++touch _C ++ ++# Create an archive, include VCS: ++cd .. ++tar -cf gitrepo.tar gitrepo ++rm -r gitrepo ++ ++echo Extract: ++tar -xvf gitrepo.tar --exclude-vcs | sort ++ ++echo ++echo List: ++tar -tf gitrepo.tar --exclude-vcs | sort ++ ++echo ++echo Diff: ++tar -dvf gitrepo.tar --exclude-vcs gitrepo | sort ++ ++], ++[0], ++[Extract: ++gitrepo/ ++gitrepo/.git_B ++gitrepo/_C ++ ++List: ++gitrepo/ ++gitrepo/.git_B ++gitrepo/_C ++ ++Diff: ++gitrepo/ ++gitrepo/.git_B ++gitrepo/_C ++], ++[]) ++ ++AT_CLEANUP +-- +2.41.0 + diff --git a/tar-1.35-revert-fix-savannah-bug-633567.patch b/tar-1.35-revert-fix-savannah-bug-633567.patch new file mode 100644 index 0000000..a00cf48 --- /dev/null +++ b/tar-1.35-revert-fix-savannah-bug-633567.patch @@ -0,0 +1,72 @@ +From d437ecf75de2d6fdeb2aed6f45c4b3b16373389b Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Fri, 11 Aug 2023 21:35:30 +0300 +Subject: [PATCH] Revert "Fix savannah bug #63567" + +Commit e89c7a45eb broke deletion from archives. The reported number +of bytes read is rounded to the nearest record anyway, revert the +commit and document the fact. + +Reported by Ed Santiago. See +https://bugzilla.redhat.com/show_bug.cgi?id=2230127 + +* doc/tar.texi: Document the fact that --totals rounds up the +number of bytes reads to the nearest record. +* src/buffer.c: Revert changes. +* tests/delete06.at: Fix expected status code and stderr. +--- + doc/tar.texi | 5 +++++ + src/buffer.c | 3 +-- + tests/delete06.at | 7 +++++-- + 3 files changed, 11 insertions(+), 4 deletions(-) + +diff --git a/doc/tar.texi b/doc/tar.texi +index d43b39e4..ee631137 100644 +--- a/doc/tar.texi ++++ b/doc/tar.texi +@@ -4215,6 +4215,11 @@ Total bytes read: 7924664320 (7.4GiB, 95MiB/s) + @end group + @end smallexample + ++Notice, that since @command{tar} operates on @dfn{records}, the number ++of bytes reported can be rounded up to the nearest full record. This ++can happen, in particular, when the last record in the archive is ++partial. @xref{Blocking}. ++ + Finally, when deleting from an archive, the @option{--totals} option + displays both numbers plus number of bytes removed from the archive: + +diff --git a/src/buffer.c b/src/buffer.c +index 12a0579f..8a575f9a 100644 +--- a/src/buffer.c ++++ b/src/buffer.c +@@ -987,8 +987,7 @@ short_read (size_t status) + } + + record_end = record_start + (record_size - left) / BLOCKSIZE; +- if (left == 0) +- records_read++; ++ records_read++; + } + + /* Flush the current buffer to/from the archive. */ +diff --git a/tests/delete06.at b/tests/delete06.at +index 9668a28c..c84ba20e 100644 +--- a/tests/delete06.at ++++ b/tests/delete06.at +@@ -36,7 +36,10 @@ esac + dd if=archive.tar of=trunc.tar bs=$size count=1 2>/dev/null + tar --delete 'b/' -f trunc.tar + ], +-[0], +-[],[],[],[],[gnu, pax]) ++[2], ++[], ++[tar: lseek: trunc.tar: Value too large for defined data type ++tar: Exiting with failure status due to previous errors ++],[],[],[gnu, pax]) + + AT_CLEANUP +-- +2.41.0 + diff --git a/tar.spec b/tar.spec index 1c864ed..cda5a76 100644 --- a/tar.spec +++ b/tar.spec @@ -1,6 +1,6 @@ Name: tar Version: 1.35 -Release: 1 +Release: 2 Epoch: 2 Summary: An organized and systematic method of controlling a large amount of data License: GPLv3+ @@ -16,8 +16,14 @@ Patch6000: backport-CVE-2022-48303.patch 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-Add-sw64-architecture.patch +Patch0006: tar-1.33-fix-capabilities-test.patch +Patch0007: tar-1.35-add-forgotten-tests-from-upstream.patch +Patch0008: tar-1.35-revert-fix-savannah-bug-633567.patch + +Patch3000: tar-Add-sw64-architecture.patch %description GNU Tar provides the ability to create tar archives, as well as various other @@ -76,6 +82,9 @@ make check %{_infodir}/tar.info* %changelog +* Thu Aug 24 2023 dillon chen 2: 1.35-2 +- get patches, test and verify + * Wed Jul 19 2023 dillon chen 2: 1.35-1 - update to 1.35-1