diff --git a/add_forgotten-tests.patch b/add_forgotten-tests.patch new file mode 100644 index 0000000..e45c2c0 --- /dev/null +++ b/add_forgotten-tests.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/add_readme-tests.patch b/add_readme-tests.patch index 7df9e77..ca4b1ed 100644 --- a/add_readme-tests.patch +++ b/add_readme-tests.patch @@ -1,15 +1,3 @@ -Index: tar-1.33/Makefile.in -=================================================================== ---- tar-1.33.orig/Makefile.in -+++ tar-1.33/Makefile.in -@@ -348,6 +348,7 @@ am__DIST_COMMON = $(srcdir)/Make.rules $ - $(top_srcdir)/build-aux/install-sh \ - $(top_srcdir)/build-aux/missing ABOUT-NLS AUTHORS COPYING \ - ChangeLog INSTALL NEWS README THANKS TODO build-aux/ar-lib \ -+ README-tests \ - build-aux/compile build-aux/config.guess \ - build-aux/config.rpath build-aux/config.sub build-aux/depcomp \ - build-aux/install-sh build-aux/mdate-sh build-aux/missing \ Index: tar-1.33/README-tests =================================================================== --- /dev/null diff --git a/bsc1200657.patch b/bsc1200657.patch deleted file mode 100644 index 0be003b..0000000 --- a/bsc1200657.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 79d1ac38c19faad64f0e993180bf1ad27f217072 Mon Sep 17 00:00:00 2001 -From: James Abbatiello -Date: Fri, 10 Jun 2022 18:25:13 -0700 -Subject: tar: fix race condition - -Problem reported in: -https://lists.gnu.org/r/bug-tar/2022-03/msg00000.html -* src/extract.c (make_directories): Retry the file creation as -long as the directory exists, regardless of whether tar itself -created the directory. -Copyright-paperwork-exempt: Yes ---- - src/extract.c | 16 ++++++++-------- - 1 file changed, 8 insertions(+), 8 deletions(-) - -diff --git a/src/extract.c b/src/extract.c -index 0753dec..fda4617 100644 ---- a/src/extract.c -+++ b/src/extract.c -@@ -638,10 +638,9 @@ fixup_delayed_set_stat (char const *src, char const *dst) - - /* After a file/link/directory creation has failed due to ENOENT, - create all required directories. Return zero if all the required -- directories were created, nonzero (issuing a diagnostic) otherwise. -- Set *INTERDIR_MADE if at least one directory was created. */ -+ directories were created, nonzero (issuing a diagnostic) otherwise. */ - static int --make_directories (char *file_name, bool *interdir_made) -+make_directories (char *file_name) - { - char *cursor0 = file_name + FILE_SYSTEM_PREFIX_LEN (file_name); - char *cursor; /* points into the file name */ -@@ -685,7 +684,6 @@ make_directories (char *file_name, bool *interdir_made) - desired_mode, AT_SYMLINK_NOFOLLOW); - - print_for_mkdir (file_name, cursor - file_name, desired_mode); -- *interdir_made = true; - parent_end = NULL; - } - else -@@ -841,8 +839,11 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) - - case ENOENT: - /* Attempt creating missing intermediate directories. */ -- if (make_directories (file_name, interdir_made) == 0) -- return RECOVER_OK; -+ if (make_directories (file_name) == 0) -+ { -+ *interdir_made = true; -+ return RECOVER_OK; -+ } - break; - - default: -@@ -1944,12 +1945,11 @@ rename_directory (char *src, char *dst) - else - { - int e = errno; -- bool interdir_made; - - switch (e) - { - case ENOENT: -- if (make_directories (dst, &interdir_made) == 0) -+ if (make_directories (dst) == 0) - { - if (renameat (chdir_fd, src, chdir_fd, dst) == 0) - return true; --- -cgit v1.1 - diff --git a/bsc1202436-1.patch b/bsc1202436-1.patch deleted file mode 100644 index ff99be2..0000000 --- a/bsc1202436-1.patch +++ /dev/null @@ -1,65 +0,0 @@ -From edf38d13a47becec81b2c3a2b74f54771e1cbee4 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 11 Feb 2023 13:03:23 +0200 -Subject: Prevent dead loop in extract_file - -* src/extract.c (maybe_recoverable): If make_directories indicates -success, suppose some intermediate directories have been made, even -if in fact they have not. That's necessary to avoid dead loops when -maybe_recoverable is called with the same arguments again. ---- - src/extract.c | 13 +++++++------ - 1 file changed, 7 insertions(+), 6 deletions(-) - -diff --git a/src/extract.c b/src/extract.c -index 2d43947..aec5de6 100644 ---- a/src/extract.c -+++ b/src/extract.c -@@ -682,7 +682,7 @@ fixup_delayed_set_stat (char const *src, char const *dst) - directories were created, nonzero (issuing a diagnostic) otherwise. - Set *INTERDIR_MADE if at least one directory was created. */ - static int --make_directories (char *file_name, bool *interdir_made) -+make_directories (char *file_name) - { - char *cursor0 = file_name + FILE_SYSTEM_PREFIX_LEN (file_name); - char *cursor; /* points into the file name */ -@@ -726,7 +726,6 @@ make_directories (char *file_name, bool *interdir_made) - desired_mode, AT_SYMLINK_NOFOLLOW); - - print_for_mkdir (file_name, cursor - file_name, desired_mode); -- *interdir_made = true; - parent_end = NULL; - } - else -@@ -882,8 +881,11 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) - - case ENOENT: - /* Attempt creating missing intermediate directories. */ -- if (make_directories (file_name, interdir_made) == 0) -- return RECOVER_OK; -+ if (make_directories (file_name) == 0) -+ { -+ *interdir_made = true; -+ return RECOVER_OK; -+ } - break; - - default: -@@ -1985,12 +1987,11 @@ rename_directory (char *src, char *dst) - else - { - int e = errno; -- bool interdir_made; - - switch (e) - { - case ENOENT: -- if (make_directories (dst, &interdir_made) == 0) -+ if (make_directories (dst) == 0) - { - if (renameat (chdir_fd, src, chdir_fd, dst) == 0) - return true; --- -cgit v1.1 - diff --git a/bsc1202436-2.patch b/bsc1202436-2.patch deleted file mode 100644 index 062de02..0000000 --- a/bsc1202436-2.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 5e8a915b16c5f06d2a16d98cdc2af666199caabb Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 11 Feb 2023 14:21:05 +0200 -Subject: Changes in extended header decoder - -* src/xheader.c (decode_time): Fix error detection. -(raw_path_decoder): Ignore empty paths. ---- - src/xheader.c | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/src/xheader.c b/src/xheader.c -index 7ff216b..a195f3e 100644 ---- a/src/xheader.c -+++ b/src/xheader.c -@@ -1059,6 +1059,12 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword) - keyword, arg)); - return false; - } -+ if (*arg_lim) -+ { -+ ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"), -+ keyword, arg)); -+ return false; -+ } - - *ts = t; - return true; -@@ -1247,9 +1253,12 @@ path_coder (struct tar_stat_info const *st, char const *keyword, - static void - raw_path_decoder (struct tar_stat_info *st, char const *arg) - { -- decode_string (&st->orig_file_name, arg); -- decode_string (&st->file_name, arg); -- st->had_trailing_slash = strip_trailing_slashes (st->file_name); -+ if (*arg) -+ { -+ decode_string (&st->orig_file_name, arg); -+ decode_string (&st->file_name, arg); -+ st->had_trailing_slash = strip_trailing_slashes (st->file_name); -+ } - } - - --- -cgit v1.1 - diff --git a/tar-1.34.tar.xz b/tar-1.34.tar.xz deleted file mode 100644 index 53eb247..0000000 --- a/tar-1.34.tar.xz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28 -size 2226068 diff --git a/tar-1.34.tar.xz.sig b/tar-1.34.tar.xz.sig deleted file mode 100644 index 25daf9e..0000000 --- a/tar-1.34.tar.xz.sig +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1 - -iEYEABECAAYFAmAnuBMACgkQNgKwf1XQxzJIVgCfR5Z7coRkU2+aOW4KNhumGl/1 -jn4AoI9OuQPpyzZN1CIwejDYxbV7u59P -=mfma ------END PGP SIGNATURE----- diff --git a/tar-1.35.tar.xz b/tar-1.35.tar.xz new file mode 100644 index 0000000..f1c7aa7 --- /dev/null +++ b/tar-1.35.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d62ff37342ec7aed748535323930c7cf94acf71c3591882b26a7ea50f3edc16 +size 2317208 diff --git a/tar-1.35.tar.xz.sig b/tar-1.35.tar.xz.sig new file mode 100644 index 0000000..e8b16a3 Binary files /dev/null and b/tar-1.35.tar.xz.sig differ diff --git a/tar-avoid-overflow-in-symlinks-tests.patch b/tar-avoid-overflow-in-symlinks-tests.patch deleted file mode 100644 index ee534a9..0000000 --- a/tar-avoid-overflow-in-symlinks-tests.patch +++ /dev/null @@ -1,76 +0,0 @@ -From d935dc7d1c150b3425dd43dc13a4dd2e2b712c26 Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Mon, 13 Jun 2022 17:02:54 -0700 -Subject: Avoid EOVERFLOW problems in some symlink tests - -* src/extract.c (is_directory_link): New arg ST. Caller changed. -(is_directory_link, open_output_file): -Use readlinkat, not fstatat, to determine whether a string -names a symlink. This avoids EOVERFLOW issues. -(extract_dir): Avoid duplicate calls to fstatat when -keep_directory_symlink_option && fstatat_flags == 0 -and the file is a symlink to an existing file. ---- - src/extract.c | 28 ++++++++++++---------------- - 1 file changed, 12 insertions(+), 16 deletions(-) - -diff --git a/src/extract.c b/src/extract.c -index fda4617..6d2543f 100644 ---- a/src/extract.c -+++ b/src/extract.c -@@ -982,18 +982,12 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links) - - - static bool --is_directory_link (const char *file_name) -+is_directory_link (char const *file_name, struct stat *st) - { -- struct stat st; -- int e = errno; -- int res; -- -- res = (fstatat (chdir_fd, file_name, &st, AT_SYMLINK_NOFOLLOW) == 0 && -- S_ISLNK (st.st_mode) && -- fstatat (chdir_fd, file_name, &st, 0) == 0 && -- S_ISDIR (st.st_mode)); -- errno = e; -- return res; -+ char buf[1]; -+ return (0 <= readlinkat (chdir_fd, file_name, buf, sizeof buf) -+ && fstatat (chdir_fd, file_name, st, 0) == 0 -+ && S_ISDIR (st->st_mode)); - } - - /* Given struct stat of a directory (or directory member) whose ownership -@@ -1066,11 +1060,14 @@ extract_dir (char *file_name, int typeflag) - || old_files_option == OVERWRITE_OLD_FILES)) - { - struct stat st; -+ st.st_mode = 0; - -- if (keep_directory_symlink_option && is_directory_link (file_name)) -+ if (keep_directory_symlink_option -+ && is_directory_link (file_name, &st)) - return 0; - -- if (deref_stat (file_name, &st) == 0) -+ if ((st.st_mode != 0 && fstatat_flags == 0) -+ || deref_stat (file_name, &st) == 0) - { - current_mode = st.st_mode; - current_mode_mask = ALL_MODE_BITS; -@@ -1178,9 +1175,8 @@ open_output_file (char const *file_name, int typeflag, mode_t mode, - if (! HAVE_WORKING_O_NOFOLLOW - && overwriting_old_files && ! dereference_option) - { -- struct stat st; -- if (fstatat (chdir_fd, file_name, &st, AT_SYMLINK_NOFOLLOW) == 0 -- && S_ISLNK (st.st_mode)) -+ char buf[1]; -+ if (0 <= readlinkat (chdir_fd, file_name, buf, sizeof buf)) - { - errno = ELOOP; - return -1; --- -cgit v1.1 - diff --git a/tar-backup-spec-fix-paths.patch b/tar-backup-spec-fix-paths.patch index 59fbfb5..f0a9c20 100644 --- a/tar-backup-spec-fix-paths.patch +++ b/tar-backup-spec-fix-paths.patch @@ -2,7 +2,7 @@ Index: tar-1.29/scripts/backup-specs =================================================================== --- tar-1.29.orig/scripts/backup-specs +++ tar-1.29/scripts/backup-specs -@@ -6,17 +6,17 @@ +@@ -6,7 +6,7 @@ ADMINISTRATOR="root@localhost" # (Optional) Path to tar binary. @@ -11,15 +11,3 @@ Index: tar-1.29/scripts/backup-specs # (Optional) Path to rsh binary or its equivalent. You may wish to # set it to ssh as shown in the example below, to improve security. - # In this case you will have to use public key authentication. --RSH=/usr/local/bin/ssh -+RSH=/usr/bin/ssh - - # (Optional) Path to rsh binary on remote mashines. This will be - # passed via --rsh-command option to the remote invocation of - # tar --RSH_COMMAND=/usr/local/bin/ssh -+RSH_COMMAND=/usr/bin/ssh - - # Name of temporary file to hold volume numbers. This needs to be accessible - # by all the machines which have filesystems to be dumped. diff --git a/tar-fix-extract-unlink.patch b/tar-fix-extract-unlink.patch index 01630b8..3f1cf29 100644 --- a/tar-fix-extract-unlink.patch +++ b/tar-fix-extract-unlink.patch @@ -1,174 +1,79 @@ -From 17debecd7300e94f590b8ce167a8c0735cb6d57d Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 22 Oct 2022 12:06:45 +0300 -Subject: Fix savannah bug #63123 - -The bug was introduced by commit 79d1ac38c1, which didn't take into -account all the consequences of returning RECOVER_OK on EEXIST, in -particular interactions with the delayed_set_stat logic. - -The commit 79d1ac38c1 is reverted (the bug it was intended to fix -was actually fixed by 79a442d7b0). Instead: - -* src/extract.c (maybe_recoverable): Don't call maybe_recoverable -if EEXIST is reported when UNLINK_FIRST_OLD_FILES option is set. ---- - src/extract.c | 108 +++++++++++++++++++++++++++++++--------------------------- - 1 file changed, 58 insertions(+), 50 deletions(-) - diff --git a/src/extract.c b/src/extract.c -index 78de47f..37ab295 100644 +index 0261134f..f913575c 100644 --- a/src/extract.c +++ b/src/extract.c -@@ -679,9 +679,10 @@ fixup_delayed_set_stat (char const *src, char const *dst) - - /* After a file/link/directory creation has failed due to ENOENT, - create all required directories. Return zero if all the required -- directories were created, nonzero (issuing a diagnostic) otherwise. */ -+ directories were created, nonzero (issuing a diagnostic) otherwise. -+ Set *INTERDIR_MADE if at least one directory was created. */ +@@ -711,7 +711,7 @@ fixup_delayed_set_stat (char const *src, char const *dst) + directories were created, nonzero (issuing a diagnostic) otherwise. + Set *INTERDIR_MADE if at least one directory was created. */ static int -make_directories (char *file_name) +make_directories (char *file_name, bool *interdir_made) { char *cursor0 = file_name + FILE_SYSTEM_PREFIX_LEN (file_name); char *cursor; /* points into the file name */ -@@ -725,6 +726,7 @@ make_directories (char *file_name) +@@ -755,6 +755,7 @@ make_directories (char *file_name) desired_mode, AT_SYMLINK_NOFOLLOW); - print_for_mkdir (file_name, cursor - file_name, desired_mode); + print_for_mkdir (file_name, desired_mode); + *interdir_made = true; parent_end = NULL; } else -@@ -879,12 +881,9 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) - FALLTHROUGH; +@@ -910,11 +911,8 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) case ENOENT: -- /* Attempt creating missing intermediate directories. */ + /* Attempt creating missing intermediate directories. */ - if (make_directories (file_name) == 0) - { - *interdir_made = true; -- return RECOVER_OK; -- } -+ /* Attempt creating missing intermediate directories. */ + if (make_directories (file_name, interdir_made) == 0) -+ return RECOVER_OK; + return RECOVER_OK; +- } break; default: -@@ -1072,61 +1071,69 @@ extract_dir (char *file_name, int typeflag) - break; - } - -- if (errno == EEXIST -- && (interdir_made -+ if (errno == EEXIST) -+ { -+ if (interdir_made - || keep_directory_symlink_option +@@ -1109,7 +1107,7 @@ extract_dir (char *file_name, int typeflag) || old_files_option == NO_OVERWRITE_DIR_OLD_FILES || old_files_option == DEFAULT_OLD_FILES -- || old_files_option == OVERWRITE_OLD_FILES)) -- { -- struct stat st; -- st.st_mode = 0; -- -- if (keep_directory_symlink_option -- && is_directory_link (file_name, &st)) -- return 0; -- -- if ((st.st_mode != 0 && fstatat_flags == 0) -- || deref_stat (file_name, &st) == 0) -+ || old_files_option == OVERWRITE_OLD_FILES) - { -- current_mode = st.st_mode; -- current_mode_mask = ALL_MODE_BITS; -+ struct stat st; -+ st.st_mode = 0; -+ -+ if (keep_directory_symlink_option -+ && is_directory_link (file_name, &st)) -+ return 0; + || old_files_option == OVERWRITE_OLD_FILES) +- { ++ { + struct stat st; + st.st_mode = 0; -- if (S_ISDIR (current_mode)) -+ if ((st.st_mode != 0 && fstatat_flags == 0) -+ || deref_stat (file_name, &st) == 0) - { -- if (interdir_made) +@@ -1117,21 +1115,21 @@ extract_dir (char *file_name, int typeflag) + && is_directory_link (file_name, &st)) + return 0; + +- if ((st.st_mode != 0 && fstatat_flags == 0) +- || deref_stat (file_name, &st) == 0) +- { ++ if ((st.st_mode != 0 && fstatat_flags == 0) ++ || deref_stat (file_name, &st) == 0) ++ { + current_mode = st.st_mode; + current_mode_mask = ALL_MODE_BITS; + + if (S_ISDIR (current_mode)) - { -- repair_delayed_set_stat (file_name, &st); -- return 0; -- } -- else if (old_files_option == NO_OVERWRITE_DIR_OLD_FILES) -+ current_mode = st.st_mode; -+ current_mode_mask = ALL_MODE_BITS; -+ -+ if (S_ISDIR (current_mode)) - { -- /* Temporarily change the directory mode to a safe -- value, to be able to create files in it, should -- the need be. -- */ -- mode = safe_dir_mode (&st); -- status = fd_chmod(-1, file_name, mode, -- AT_SYMLINK_NOFOLLOW, DIRTYPE); -- if (status == 0) +- if (interdir_made) +- { +- repair_delayed_set_stat (file_name, &st); +- return 0; +- } +- else if (old_files_option == NO_OVERWRITE_DIR_OLD_FILES) + { + if (interdir_made) - { -- /* Store the actual directory mode, to be restored -- later. -- */ -- current_stat_info.stat = st; -- current_mode = mode & ~ current_umask; -- current_mode_mask = MODE_RWX; -- atflag = AT_SYMLINK_NOFOLLOW; -- break; -+ repair_delayed_set_stat (file_name, &st); -+ return 0; - } -- else -+ else if (old_files_option == NO_OVERWRITE_DIR_OLD_FILES) - { -- chmod_error_details (file_name, mode); -+ /* Temporarily change the directory mode to a safe -+ value, to be able to create files in it, should -+ the need be. -+ */ -+ mode = safe_dir_mode (&st); -+ status = fd_chmod (-1, file_name, mode, -+ AT_SYMLINK_NOFOLLOW, DIRTYPE); -+ if (status == 0) + { -+ /* Store the actual directory mode, to be restored -+ later. -+ */ -+ current_stat_info.stat = st; -+ current_mode = mode & ~ current_umask; -+ current_mode_mask = MODE_RWX; -+ atflag = AT_SYMLINK_NOFOLLOW; -+ break; ++ repair_delayed_set_stat (file_name, &st); ++ return 0; + } -+ else ++ else if (old_files_option == NO_OVERWRITE_DIR_OLD_FILES) + { -+ chmod_error_details (file_name, mode); -+ } - } -+ break; - } -- break; - } - } -+ else if (old_files_option == UNLINK_FIRST_OLD_FILES) -+ { -+ status = 0; -+ break; -+ } -+ - errno = EEXIST; - } - -@@ -1978,11 +1985,12 @@ rename_directory (char *src, char *dst) + /* Temporarily change the directory mode to a safe + value, to be able to create files in it, should + the need be. +@@ -2007,11 +2005,12 @@ rename_directory (char *src, char *dst) else { int e = errno; @@ -182,6 +87,3 @@ index 78de47f..37ab295 100644 { if (renameat (chdir_fd, src, chdir_fd, dst) == 0) return true; --- -cgit v1.1 - diff --git a/tar-fix-race-condition.patch b/tar-fix-race-condition.patch deleted file mode 100644 index 28c5120..0000000 --- a/tar-fix-race-condition.patch +++ /dev/null @@ -1,117 +0,0 @@ -From 79a442d7b0e92622794bfa41dee18a28e450a0dc Mon Sep 17 00:00:00 2001 -From: Paul Eggert -Date: Thu, 9 Jun 2022 22:09:34 -0700 -Subject: tar: fix race condition - -Problem reported by James Abbatiello in: -https://lists.gnu.org/r/bug-tar/2022-03/msg00000.html -* src/extract.c (make_directories): Do not assume that when -mkdirat fails with errno == EEXIST that there is an existing file -that can be statted. It could be a dangling symlink. Instead, -wait until the end and stat it. ---- - src/extract.c | 61 ++++++++++++++++++++++++++++++++++++++--------------------- - 2 files changed, 43 insertions(+), 23 deletions(-) - -diff --git a/src/extract.c b/src/extract.c -index e7be463..0753dec 100644 ---- a/src/extract.c -+++ b/src/extract.c -@@ -636,8 +636,7 @@ fixup_delayed_set_stat (char const *src, char const *dst) - } - } - --/* After a file/link/directory creation has failed, see if -- it's because some required directory was not present, and if so, -+/* After a file/link/directory creation has failed due to ENOENT, - create all required directories. Return zero if all the required - directories were created, nonzero (issuing a diagnostic) otherwise. - Set *INTERDIR_MADE if at least one directory was created. */ -@@ -646,6 +645,8 @@ make_directories (char *file_name, bool *interdir_made) - { - char *cursor0 = file_name + FILE_SYSTEM_PREFIX_LEN (file_name); - char *cursor; /* points into the file name */ -+ char *parent_end = NULL; -+ int parent_errno; - - for (cursor = cursor0; *cursor; cursor++) - { -@@ -685,31 +686,47 @@ make_directories (char *file_name, bool *interdir_made) - - print_for_mkdir (file_name, cursor - file_name, desired_mode); - *interdir_made = true; -+ parent_end = NULL; - } -- else if (errno == EEXIST) -- status = 0; - else -- { -- /* Check whether the desired file exists. Even when the -- file exists, mkdir can fail with some errno value E other -- than EEXIST, so long as E describes an error condition -- that also applies. */ -- int e = errno; -- struct stat st; -- status = fstatat (chdir_fd, file_name, &st, 0); -- if (status) -- { -- errno = e; -- mkdir_error (file_name); -- } -- } -+ switch (errno) -+ { -+ case ELOOP: case ENAMETOOLONG: case ENOENT: case ENOTDIR: -+ /* FILE_NAME doesn't exist and couldn't be created; fail now. */ -+ mkdir_error (file_name); -+ *cursor = '/'; -+ return status; -+ -+ default: -+ /* FILE_NAME may be an existing directory so do not fail now. -+ Instead, arrange to check at loop exit, assuming this is -+ the last loop iteration. */ -+ parent_end = cursor; -+ parent_errno = errno; -+ break; -+ } - - *cursor = '/'; -- if (status) -- return status; - } - -- return 0; -+ if (!parent_end) -+ return 0; -+ -+ /* Although we did not create the parent directory, some other -+ process may have created it, so check whether it exists now. */ -+ *parent_end = '\0'; -+ struct stat st; -+ int stat_status = fstatat (chdir_fd, file_name, &st, 0); -+ if (!stat_status && !S_ISDIR (st.st_mode)) -+ stat_status = -1; -+ if (stat_status) -+ { -+ errno = parent_errno; -+ mkdir_error (file_name); -+ } -+ *parent_end = '/'; -+ -+ return stat_status; - } - - /* Return true if FILE_NAME (with status *STP, if STP) is not a -@@ -824,7 +841,7 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) - - case ENOENT: - /* Attempt creating missing intermediate directories. */ -- if (make_directories (file_name, interdir_made) == 0 && *interdir_made) -+ if (make_directories (file_name, interdir_made) == 0) - return RECOVER_OK; - break; - --- -cgit v1.1 - diff --git a/tar.changes b/tar.changes index e057c92..bd909c2 100644 --- a/tar.changes +++ b/tar.changes @@ -1,3 +1,56 @@ +------------------------------------------------------------------- +Wed Dec 6 16:04:39 UTC 2023 - Joshua Smith + +- GNU tar 1.34: + * Fail when building GNU tar if the platform supports 64-bit + time_t but the build only uses 32-bit time_t. + * Leave the devmajor and devminor fields empty (rather than + zero) for non-special files, as this is more compatible with + traditional tar. + Fixes: + * Fix interaction of --update with --wildcards. + * When extracting archives into an empty directory, do not create + hard links to files outside that directory. + * Handle partial reads from regular files. + * Warn file changed as we read it less often. Formerly, tar + warned if the file's size or ctime changed. However, this + generated a false positive if tar read a file while another + process hard-linked to it, changing its ctime. Now, tar warns + if the file's size, mtime, user ID, group ID, or mode changes. + Although neither heuristic is perfect, the new one should work + better in practice. + * Fix --ignore-failed-read to ignore file-changed read errors + as far as exit status is concerned. You can now suppress + file-changed issues entirely with --ignore-failed-read + --warning=no-file-changed. + * Fix --remove-files to not remove a file that changed while we + read it. + * Fix --atime-preserve=replace to not fail if there was no need + to replace, either because we did not read the file, or the + atime did not change. + * Fix race when creating a parent directory while another process + is also doing so. + * Fix handling of prefix keywords not followed by "." in pax + headers. + * Fix handling of out-of-range sparse entries in pax headers. + * Fix handling of --transform='s/s/@/2'. + * Fix treatment of options ending in slash in files-from list. + * Fix crash on tar --checkpoint-action exec=\". + * Fix low-memory crash when reading incremental dumps. + * Fix --exclude-vcs-ignores memory allocation misuse. +- Update patch: + * tar-backup-spec-fix-paths.patch: upstream fixed 2/3rd of paths + * tar-fix-extract-unlink.patch + some of this is overwritten by bsc1202436-1 and some was fixed + upstream + * add_readme-tests.patch as Makefile.in no longer exists +- Removed: + * tar-fix-race-condition.patch + * tar-avoid-overflow-in-symlinks-tests.patch + * bsc1200657.patch + * bsc1202436-2.patch + * bsc1202436-1.patch + ------------------------------------------------------------------- Tue Jul 25 13:54:28 UTC 2023 - Andreas Schwab diff --git a/tar.spec b/tar.spec index 24b0581..985d44d 100644 --- a/tar.spec +++ b/tar.spec @@ -19,7 +19,7 @@ # For correct subpackages docs installation into tar doc directory %global _docdir_fmt %{name} Name: tar -Version: 1.34 +Version: 1.35 Release: 0 Summary: GNU implementation of ((t)ape (ar)chiver) License: GPL-3.0-or-later @@ -40,24 +40,16 @@ Patch3: %{name}-ignore_lone_zero_blocks.patch Patch5: add_readme-tests.patch Patch6: tar-PIE.patch Patch7: tests-skip-time01-on-32bit-time_t.patch -# PATCH-FIX-UPSTREAM danilo.spinella@suse.com bsc#1200657 -# fix race condition while creating intermediate subdirectories -Patch8: tar-fix-race-condition.patch -# PATCH-FIX-UPSTREAM danilo.spinella@suse.com bsc#1203600 -# Unexpected inconsistency when making directory -Patch9: tar-avoid-overflow-in-symlinks-tests.patch -Patch10: bsc1200657.patch Patch11: tar-fix-extract-unlink.patch # PATCH-FIX-SUSE danilo.spinella@suse.com bsc#1202436 Patch12: go-testsuite-test-hang.patch # PATCH-FIX-UPSTREAM danilo.spinella@suse.com bsc#1202436 Patch13: bsc1202436.patch -Patch14: bsc1202436-1.patch -Patch15: bsc1202436-2.patch # PATCH-FIX-UPSTREAM danilo.spinella@suse.com bsc#1207753 # tar has a one-byte out-of-bounds read that results in use of # uninitialized memory for a conditional jump Patch16: fix-CVE-2022-48303.patch +Patch17: add_forgotten-tests.patch BuildRequires: automake >= 1.15 BuildRequires: libacl-devel BuildRequires: libselinux-devel @@ -120,24 +112,7 @@ it may as well access remote devices or files. %lang_package %prep -# TODO: Use autosetup -%setup -q -%patch0 -p1 -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 -%patch14 -p1 -%patch15 -p1 -%patch16 -p1 +%autosetup -p1 cp %{S:3} tests %build