diff --git a/.gitignore b/.gitignore index 1ed8384..f573bbb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -SOURCES/tar-1.30.tar.xz +tar-1.35.tar.xz +tar-1.35.tar.xz.sig diff --git a/.tar.metadata b/.tar.metadata deleted file mode 100644 index 6be1a21..0000000 --- a/.tar.metadata +++ /dev/null @@ -1 +0,0 @@ -0d442c4565f8131745a5dff1cd08f7eaa797f679 SOURCES/tar-1.30.tar.xz diff --git a/SOURCES/tar-1.28-sparse-inf-loops.patch b/SOURCES/tar-1.28-sparse-inf-loops.patch deleted file mode 100644 index 94d2bb5..0000000 --- a/SOURCES/tar-1.28-sparse-inf-loops.patch +++ /dev/null @@ -1,129 +0,0 @@ -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/SOURCES/tar-1.30-CVE-2022-48303.patch b/SOURCES/tar-1.30-CVE-2022-48303.patch deleted file mode 100644 index 1b6c8db..0000000 --- a/SOURCES/tar-1.30-CVE-2022-48303.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 3da78400eafcccb97e2f2fd4b227ea40d794ede8 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 11 Feb 2023 11:57:39 +0200 -Subject: [PATCH] Fix boundary checking in base-256 decoder - -* src/list.c (from_header): Base-256 encoding is at least 2 bytes -long. ---- - src/list.c | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) - -diff --git a/src/list.c b/src/list.c -index 9fafc425..86bcfdd1 100644 ---- a/src/list.c -+++ b/src/list.c -@@ -881,8 +881,9 @@ from_header (char const *where0, size_t digs, char const *type, - where++; - } - } -- else if (*where == '\200' /* positive base-256 */ -- || *where == '\377' /* negative base-256 */) -+ else if (where <= lim - 2 -+ && (*where == '\200' /* positive base-256 */ -+ || *where == '\377' /* negative base-256 */)) - { - /* Parse base-256 output. A nonnegative number N is - represented as (256**DIGS)/2 + N; a negative number -N is --- -2.38.1 - diff --git a/SOURCES/tar-1.30-Fix-the-no-overwrite-dir-option b/SOURCES/tar-1.30-Fix-the-no-overwrite-dir-option deleted file mode 100644 index 589fce0..0000000 --- a/SOURCES/tar-1.30-Fix-the-no-overwrite-dir-option +++ /dev/null @@ -1,297 +0,0 @@ -From 14d8fc718f0c872274b90991ee634b0cd8e1a6f0 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Sat, 8 Feb 2020 13:01:47 +0200 -Subject: [PATCH] Fix the --no-overwrite-dir option - -Given this option, tar failed to preserve permissions of empty directories -and to create files under directories owned by the current user that did -not have the S_IWUSR bit set. - -* src/extract.c (fd_chmod): Rename to fd_i_chmod. -(fd_chmod): New function. -(safe_dir_mode): New function. -(extract_dir): Special handling for existing directories in ---no-overwrite-dir mode. -* tests/extrac23.at: New file. -* tests/Makefile.am: Add new test case. -* tests/testsuite.at: Likewise. ---- - src/extract.c | 128 ++++++++++++++++++++++++++++++--------------- - tests/Makefile.am | 1 + - tests/extrac23.at | 58 ++++++++++++++++++++ - tests/testsuite.at | 1 + - 4 files changed, 146 insertions(+), 42 deletions(-) - create mode 100644 tests/extrac23.at - -diff --git a/src/extract.c b/src/extract.c -index a4a35a57..5a38ba70 100644 ---- a/src/extract.c -+++ b/src/extract.c -@@ -194,7 +194,7 @@ extr_init (void) - - /* Use fchmod if possible, fchmodat otherwise. */ - static int --fd_chmod (int fd, char const *file, mode_t mode, int atflag) -+fd_i_chmod (int fd, char const *file, mode_t mode, int atflag) - { - if (0 <= fd) - { -@@ -205,6 +205,42 @@ fd_chmod (int fd, char const *file, mode_t mode, int atflag) - return fchmodat (chdir_fd, file, mode, atflag); - } - -+/* A version of fd_i_chmod which gracefully handles several common error -+ conditions. Additional argument TYPEFLAG is the type of file in tar -+ notation. -+ */ -+static int -+fd_chmod(int fd, char const *file_name, int mode, int atflag, int typeflag) -+{ -+ int chmod_errno = fd_i_chmod (fd, file_name, mode, atflag) == 0 ? 0 : errno; -+ -+ /* On Solaris, chmod may fail if we don't have PRIV_ALL, because -+ setuid-root files would otherwise be a backdoor. See -+ http://opensolaris.org/jive/thread.jspa?threadID=95826 -+ (2009-09-03). */ -+ if (chmod_errno == EPERM && (mode & S_ISUID) -+ && priv_set_restore_linkdir () == 0) -+ { -+ chmod_errno = fd_i_chmod (fd, file_name, mode, atflag) == 0 ? 0 : errno; -+ priv_set_remove_linkdir (); -+ } -+ -+ /* Linux fchmodat does not support AT_SYMLINK_NOFOLLOW, and -+ returns ENOTSUP even when operating on non-symlinks, try -+ again with the flag disabled if it does not appear to be -+ supported and if the file is not a symlink. This -+ introduces a race, alas. */ -+ if (atflag && typeflag != SYMTYPE && ! implemented (chmod_errno)) -+ chmod_errno = fd_i_chmod (fd, file_name, mode, 0) == 0 ? 0 : errno; -+ -+ if (chmod_errno && (typeflag != SYMTYPE || implemented (chmod_errno))) -+ { -+ errno = chmod_errno; -+ return -1; -+ } -+ return 0; -+} -+ - /* Use fchown if possible, fchownat otherwise. */ - static int - fd_chown (int fd, char const *file, uid_t uid, gid_t gid, int atflag) -@@ -259,35 +295,8 @@ set_mode (char const *file_name, - - if (current_mode != mode) - { -- int chmod_errno = -- fd_chmod (fd, file_name, mode, atflag) == 0 ? 0 : errno; -- -- /* On Solaris, chmod may fail if we don't have PRIV_ALL, because -- setuid-root files would otherwise be a backdoor. See -- http://opensolaris.org/jive/thread.jspa?threadID=95826 -- (2009-09-03). */ -- if (chmod_errno == EPERM && (mode & S_ISUID) -- && priv_set_restore_linkdir () == 0) -- { -- chmod_errno = -- fd_chmod (fd, file_name, mode, atflag) == 0 ? 0 : errno; -- priv_set_remove_linkdir (); -- } -- -- /* Linux fchmodat does not support AT_SYMLINK_NOFOLLOW, and -- returns ENOTSUP even when operating on non-symlinks, try -- again with the flag disabled if it does not appear to be -- supported and if the file is not a symlink. This -- introduces a race, alas. */ -- if (atflag && typeflag != SYMTYPE && ! implemented (chmod_errno)) -- chmod_errno = fd_chmod (fd, file_name, mode, 0) == 0 ? 0 : errno; -- -- if (chmod_errno -- && (typeflag != SYMTYPE || implemented (chmod_errno))) -- { -- errno = chmod_errno; -- chmod_error_details (file_name, mode); -- } -+ if (fd_chmod (fd, file_name, mode, atflag, typeflag)) -+ chmod_error_details (file_name, mode); - } - } - } -@@ -975,6 +984,26 @@ is_directory_link (const char *file_name) - return res; - } - -+/* Given struct stat of a directory (or directory member) whose ownership -+ or permissions of will be restored later, return the temporary permissions -+ for that directory, sufficiently restrictive so that in the meantime -+ processes owned by other users do not inadvertently create files under this -+ directory that inherit the wrong owner, group, or permissions from the -+ directory. -+ -+ If not root, though, make the directory writeable and searchable at first, -+ so that files can be created under it. -+*/ -+static inline int -+safe_dir_mode (struct stat const *st) -+{ -+ return ((st->st_mode -+ & (0 < same_owner_option || 0 < same_permissions_option -+ ? S_IRWXU -+ : MODE_RWX)) -+ | (we_are_root ? 0 : MODE_WXUSR)); -+} -+ - /* Extractor functions for various member types */ - - static int -@@ -1004,18 +1033,7 @@ extract_dir (char *file_name, int typeflag) - else if (typeflag == GNUTYPE_DUMPDIR) - skip_member (); - -- /* If ownership or permissions will be restored later, create the -- directory with restrictive permissions at first, so that in the -- meantime processes owned by other users do not inadvertently -- create files under this directory that inherit the wrong owner, -- group, or permissions from the directory. If not root, though, -- make the directory writeable and searchable at first, so that -- files can be created under it. */ -- mode = ((current_stat_info.stat.st_mode -- & (0 < same_owner_option || 0 < same_permissions_option -- ? S_IRWXU -- : MODE_RWX)) -- | (we_are_root ? 0 : MODE_WXUSR)); -+ mode = safe_dir_mode (¤t_stat_info.stat); - - for (;;) - { -@@ -1031,6 +1049,7 @@ extract_dir (char *file_name, int typeflag) - if (errno == EEXIST - && (interdir_made - || keep_directory_symlink_option -+ || old_files_option == NO_OVERWRITE_DIR_OLD_FILES - || old_files_option == DEFAULT_OLD_FILES - || old_files_option == OVERWRITE_OLD_FILES)) - { -@@ -1051,6 +1070,31 @@ extract_dir (char *file_name, int typeflag) - repair_delayed_set_stat (file_name, &st); - return 0; - } -+ else if (old_files_option == NO_OVERWRITE_DIR_OLD_FILES) -+ { -+ /* 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; -+ } -+ else -+ { -+ chmod_error_details (file_name, mode); -+ } -+ } - break; - } - } -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 0369a950..31ae3460 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -121,6 +121,7 @@ TESTSUITE_AT = \ - extrac19.at\ - extrac20.at\ - extrac21.at\ -+ extrac23.at\ - filerem01.at\ - filerem02.at\ - dirrem01.at\ -diff --git a/tests/extrac23.at b/tests/extrac23.at -new file mode 100644 -index 00000000..669d18b6 ---- /dev/null -+++ b/tests/extrac23.at -@@ -0,0 +1,58 @@ -+# Test suite for GNU tar. -*- Autotest -*- -+# Copyright 2020 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([--no-overwrite-dir]) -+AT_KEYWORDS([extract extrac23 no-overwrite-dir]) -+ -+# Description: Implementation of the --no-overwrite-dir option was flawed in -+# tar versions up to 1.32.90. This option is intended to preserve metadata -+# of existing directories. In fact it worked only for non-empty directories. -+# Moreover, if the actual directory was owned by the user tar runs as and the -+# S_IWUSR bit was not set in its actual permissions, tar failed to create files -+# in it. -+# -+# Reported by: Michael Kaufmann -+# References: <20200207112934.Horde.anXzYhAj2CHiwUrw5CuT0G-@webmail.michael-kaufmann.ch>, -+# https://lists.gnu.org/archive/html/bug-tar/2020-02/msg00003.html -+ -+AT_TAR_CHECK([ -+# Test if the directory permissions are restored properly. -+mkdir dir -+chmod 755 dir -+tar cf a.tar dir -+chmod 777 dir -+tar -xf a.tar --no-overwrite-dir -+genfile --stat=mode.777 dir -+ -+# Test if temprorary permissions are set correctly to allow the owner -+# to write to the directory. -+genfile --file dir/file -+tar cf a.tar dir -+rm dir/file -+chmod 400 dir -+tar -xf a.tar --no-overwrite-dir -+genfile --stat=mode.777 dir -+chmod 700 dir -+find dir -+], -+[0], -+[777 -+400 -+dir -+dir/file -+]) -+AT_CLEANUP -diff --git a/tests/testsuite.at b/tests/testsuite.at -index 2cc43a19..0620a3c7 100644 ---- a/tests/testsuite.at -+++ b/tests/testsuite.at -@@ -343,6 +343,7 @@ m4_include([extrac19.at]) - m4_include([extrac19.at]) - m4_include([extrac20.at]) - m4_include([extrac21.at]) -+m4_include([extrac23.at]) - - m4_include([backup01.at]) - --- -2.37.3 - diff --git a/SOURCES/tar-1.30-disk-read-error.patch b/SOURCES/tar-1.30-disk-read-error.patch deleted file mode 100644 index fbf596f..0000000 --- a/SOURCES/tar-1.30-disk-read-error.patch +++ /dev/null @@ -1,53 +0,0 @@ -From: Ondrej Dubaj -Date: Tue, 13 Apr 2021 11:47:32 +0200 -Subject: [PATCH] do not report read disk error as file shrank - -diff --git a/src/create.c b/src/create.c -index 181f7d9..7be10a9 100644 ---- a/src/create.c -+++ b/src/create.c -@@ -1097,7 +1097,7 @@ dump_regular_file (int fd, struct tar_stat_info *st) - size_left -= count; - set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE); - -- if (count != bufsize) -+ if (count == 0) - { - char buf[UINTMAX_STRSIZE_BOUND]; - memset (blk->buffer + count, 0, bufsize - count); -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 2d7939d..89fbf9a 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -230,7 +230,6 @@ TESTSUITE_AT = \ - spmvp10.at\ - time01.at\ - time02.at\ -- truncate.at\ - update.at\ - update01.at\ - update02.at\ -diff --git a/tests/Makefile.in b/tests/Makefile.in -index db14044..238b210 100644 ---- a/tests/Makefile.in -+++ b/tests/Makefile.in -@@ -1457,7 +1457,6 @@ TESTSUITE_AT = \ - spmvp10.at\ - time01.at\ - time02.at\ -- truncate.at\ - update.at\ - update01.at\ - update02.at\ -diff --git a/tests/testsuite.at b/tests/testsuite.at -index 2a83757..52f73a6 100644 ---- a/tests/testsuite.at -+++ b/tests/testsuite.at -@@ -424,7 +424,6 @@ m4_include([comprec.at]) - m4_include([shortfile.at]) - m4_include([shortupd.at]) - --m4_include([truncate.at]) - m4_include([grow.at]) - m4_include([sigpipe.at]) - m4_include([comperr.at]) diff --git a/SOURCES/tar-1.30-padding-zeros.patch b/SOURCES/tar-1.30-padding-zeros.patch deleted file mode 100644 index a773b6c..0000000 --- a/SOURCES/tar-1.30-padding-zeros.patch +++ /dev/null @@ -1,179 +0,0 @@ -From 910d9ff829bbdfaf1455cdb2b1813507bcb855ec Mon Sep 17 00:00:00 2001 -From: Ondrej Dubaj -Date: Tue, 13 Apr 2021 11:47:32 +0200 -Subject: [PATCH] add padding message, when read error occurs and tar is - padding with zeros - ---- - lib/paxerror.c | 44 ++++++++++++++++++++++++++++++-------------- - lib/paxlib.h | 4 ++-- - src/common.h | 2 +- - src/create.c | 2 +- - src/misc.c | 6 +++--- - src/sparse.c | 6 +++--- - 6 files changed, 40 insertions(+), 24 deletions(-) - -diff --git a/lib/paxerror.c b/lib/paxerror.c -index 134cef3..929a741 100644 ---- a/lib/paxerror.c -+++ b/lib/paxerror.c -@@ -173,29 +173,45 @@ read_error (char const *name) - } - - void --read_error_details (char const *name, off_t offset, size_t size) -+read_error_details (char const *name, off_t offset, size_t size, bool padding) - { - char buf[UINTMAX_STRSIZE_BOUND]; - int e = errno; -- ERROR ((0, e, -- ngettext ("%s: Read error at byte %s, while reading %lu byte", -- "%s: Read error at byte %s, while reading %lu bytes", -- size), -- quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -- (unsigned long) size)); -+ if (padding) -+ ERROR ((0, e, -+ ngettext ("%s: Read error at byte %s, while reading %lu byte; padding with zeros", -+ "%s: Read error at byte %s, while reading %lu bytes; padding with zeros", -+ size), -+ quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -+ (unsigned long) size)); -+ else -+ ERROR ((0, e, -+ ngettext ("%s: Read error at byte %s, while reading %lu byte", -+ "%s: Read error at byte %s, while reading %lu bytes", -+ size), -+ quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -+ (unsigned long) size)); - } - - void --read_warn_details (char const *name, off_t offset, size_t size) -+read_warn_details (char const *name, off_t offset, size_t size, bool padding) - { - char buf[UINTMAX_STRSIZE_BOUND]; - int e = errno; -- WARN ((0, e, -- ngettext ("%s: Warning: Read error at byte %s, while reading %lu byte", -- "%s: Warning: Read error at byte %s, while reading %lu bytes", -- size), -- quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -- (unsigned long) size)); -+ if (padding) -+ WARN ((0, e, -+ ngettext ("%s: Warning: Read error at byte %s, while reading %lu byte; padding with zeros", -+ "%s: Warning: Read error at byte %s, while reading %lu bytes; padding with zeros", -+ size), -+ quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -+ (unsigned long) size)); -+ else -+ WARN ((0, e, -+ ngettext ("%s: Warning: Read error at byte %s, while reading %lu byte", -+ "%s: Warning: Read error at byte %s, while reading %lu bytes", -+ size), -+ quotearg_colon (name), STRINGIFY_BIGINT (offset, buf), -+ (unsigned long) size)); - } - - void -diff --git a/lib/paxlib.h b/lib/paxlib.h -index d4251d1..ccf826b 100644 ---- a/lib/paxlib.h -+++ b/lib/paxlib.h -@@ -94,10 +94,10 @@ void open_error (char const *); - void open_fatal (char const *) __attribute__ ((noreturn)); - void open_warn (char const *); - void read_error (char const *); --void read_error_details (char const *, off_t, size_t); -+void read_error_details (char const *, off_t, size_t, bool); - void read_fatal (char const *) __attribute__ ((noreturn)); - void read_fatal_details (char const *, off_t, size_t) __attribute__ ((noreturn)); --void read_warn_details (char const *, off_t, size_t); -+void read_warn_details (char const *, off_t, size_t, bool); - void readlink_error (char const *); - void readlink_warn (char const *); - void rmdir_error (char const *); -diff --git a/src/common.h b/src/common.h -index bbe167e..34a30ec 100644 ---- a/src/common.h -+++ b/src/common.h -@@ -713,7 +713,7 @@ int chdir_count (void); - - void close_diag (char const *name); - void open_diag (char const *name); --void read_diag_details (char const *name, off_t offset, size_t size); -+void read_diag_details (char const *name, off_t offset, size_t size, bool padding); - void readlink_diag (char const *name); - void savedir_diag (char const *name); - void seek_diag_details (char const *name, off_t offset); -diff --git a/src/create.c b/src/create.c -index 712ee18..181f7d9 100644 ---- a/src/create.c -+++ b/src/create.c -@@ -1090,7 +1090,7 @@ dump_regular_file (int fd, struct tar_stat_info *st) - if (count == SAFE_READ_ERROR) - { - read_diag_details (st->orig_file_name, -- st->stat.st_size - size_left, bufsize); -+ st->stat.st_size - size_left, bufsize, true); - pad_archive (size_left); - return dump_status_short; - } -diff --git a/src/misc.c b/src/misc.c -index eccf6f9..28c6f44 100644 ---- a/src/misc.c -+++ b/src/misc.c -@@ -1069,15 +1069,15 @@ open_diag (char const *name) - } - - void --read_diag_details (char const *name, off_t offset, size_t size) -+read_diag_details (char const *name, off_t offset, size_t size, bool padding) - { - if (ignore_failed_read_option) - { - if (WARNING_ENABLED(WARN_FAILED_READ)) -- read_warn_details (name, offset, size); -+ read_warn_details (name, offset, size, padding); - } - else -- read_error_details (name, offset, size); -+ read_error_details (name, offset, size, padding); - } - - void -diff --git a/src/sparse.c b/src/sparse.c -index 55c874f..1f9f0af 100644 ---- a/src/sparse.c -+++ b/src/sparse.c -@@ -425,7 +425,7 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i) - (file->stat_info->sparse_map[i].offset - + file->stat_info->sparse_map[i].numbytes - - bytes_left), -- bufsize); -+ bufsize, false); - return false; - } - if (bytes_read == 0) -@@ -607,7 +607,7 @@ check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end) - if (bytes_read == SAFE_READ_ERROR) - { - read_diag_details (file->stat_info->orig_file_name, -- offset, rdsize); -+ offset, rdsize, false); - return false; - } - -@@ -657,7 +657,7 @@ check_data_region (struct tar_sparse_file *file, size_t i) - (file->stat_info->sparse_map[i].offset - + file->stat_info->sparse_map[i].numbytes - - size_left), -- rdsize); -+ rdsize, false); - return false; - } - file->dumped_size += bytes_read; --- -2.30.2 - diff --git a/SOURCES/tar-1.30-remove-capabs-test.patch b/SOURCES/tar-1.30-remove-capabs-test.patch deleted file mode 100644 index 2b1c1c7..0000000 --- a/SOURCES/tar-1.30-remove-capabs-test.patch +++ /dev/null @@ -1,82 +0,0 @@ -# This test is failing due to BZ#2066320 and BZ#1926332 -# So we decided to remove it from testsuite - ---- tar-1.30/tests/Makefile.am.old 2022-12-05 10:18:29.093200490 +0000 -+++ tar-1.30/tests/Makefile.am 2022-12-05 10:18:47.058200490 +0000 -@@ -261,8 +261,7 @@ TESTSUITE_AT = \ - acls02.at\ - acls03.at\ - selnx01.at\ -- selacl01.at\ -- capabs_raw01.at -+ selacl01.at - - distclean-local: - -rm -rf download ---- tar-1.30/tests/testsuite.at.old 2022-12-05 10:19:51.023200490 +0000 -+++ tar-1.30/tests/testsuite.at 2022-12-05 10:20:19.418200490 +0000 -@@ -469,8 +469,6 @@ m4_include([acls03.at]) - m4_include([selnx01.at]) - m4_include([selacl01.at]) - --m4_include([capabs_raw01.at]) -- - AT_BANNER([One top level]) - m4_include([onetop01.at]) - m4_include([onetop02.at]) ---- tar-1.30-test/tests/capabs_raw01.at 2017-01-02 12:43:50.000000000 +0000 -+++ tar-1.30/tests/capabs_raw01.at 1970-01-01 00:00:00.000000000 +0000 -@@ -1,53 +0,0 @@ --# Process this file with autom4te to create testsuite. -*- Autotest -*- --# --# Test suite for GNU tar. --# Copyright 2012-2014, 2016-2017 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 description: Test if file capabilities are archived/restored correctly --# using just the default xattr support (capabilities are stored/restored in --# binary format -> system dependant). -- --AT_SETUP([capabilities: binary store/restore]) --AT_KEYWORDS([xattrs capabilities capabs_raw01]) -- --AT_TAR_CHECK([ --AT_PRIVILEGED_PREREQ --AT_XATTRS_PREREQ --AT_CAPABILITIES_UTILS_PREREQ -- --mkdir dir --genfile --file dir/file -- --setcap "= cap_chown=ei" dir/file -- --# archive whole directory including binary xattrs --tar --xattrs -cf archive.tar dir -- --# clear the directory --rm -rf dir -- --# restore _all_ xattrs (not just the user.* domain) --tar --xattrs --xattrs-include='*' -xf archive.tar -- --getcap dir/file --], --[0], --[dir/file = cap_chown+ei --]) -- --AT_CLEANUP diff --git a/SOURCES/tar-1.30-tests-difflink.patch b/SOURCES/tar-1.30-tests-difflink.patch deleted file mode 100644 index e4070d7..0000000 --- a/SOURCES/tar-1.30-tests-difflink.patch +++ /dev/null @@ -1,15 +0,0 @@ -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/SOURCES/tar-1.30-tests-dirrem.patch b/SOURCES/tar-1.30-tests-dirrem.patch deleted file mode 100644 index 6280495..0000000 --- a/SOURCES/tar-1.30-tests-dirrem.patch +++ /dev/null @@ -1,93 +0,0 @@ -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/SOURCES/tar-1.30-xgetcwd-null-return-check.patch b/SOURCES/tar-1.30-xgetcwd-null-return-check.patch deleted file mode 100644 index 1359e06..0000000 --- a/SOURCES/tar-1.30-xgetcwd-null-return-check.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 60acf5a7407ef263aaf7d3751da08167b1990eb0 Mon Sep 17 00:00:00 2001 -From: Sergey Poznyakoff -Date: Wed, 20 May 2020 13:35:28 +0200 -Subject: [PATCH] Check return value from xgetcwd - -* src/misc.c (chdir_arg,tar_getcdpath): Check for non-NULL -return from xgetcwd. The function returns NULL for any -error originating from getcwd. ---- - src/misc.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/src/misc.c b/src/misc.c -index cd07f53..eccf6f9 100644 ---- a/src/misc.c -+++ b/src/misc.c -@@ -301,8 +301,6 @@ normalize_filename (int cdidx, const char *name) - size_t copylen; - bool need_separator; - -- if (!cdpath) -- call_arg_fatal ("getcwd", "."); - copylen = strlen (cdpath); - need_separator = ! (DOUBLE_SLASH_IS_DISTINCT_ROOT - && copylen == 2 && ISSLASH (cdpath[1])); -@@ -909,6 +907,8 @@ chdir_arg (char const *dir) - { - wd[wd_count].name = "."; - wd[wd_count].abspath = xgetcwd (); -+ if (!wd[wd_count].abspath) -+ call_arg_fatal ("getcwd", "."); - wd[wd_count].fd = AT_FDCWD; - wd_count++; - } -@@ -1034,7 +1034,11 @@ tar_getcdpath (int idx) - { - static char *cwd; - if (!cwd) -- cwd = xgetcwd (); -+ { -+ cwd = xgetcwd (); -+ if (!cwd) -+ call_arg_fatal ("getcwd", "."); -+ } - return cwd; - } - return wd[idx].abspath; --- -2.24.1 - diff --git a/SOURCES/tar-1.30.tar.xz.sig b/SOURCES/tar-1.30.tar.xz.sig deleted file mode 100644 index 3069edf..0000000 --- a/SOURCES/tar-1.30.tar.xz.sig +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1.4.15 (GNU/Linux) - -iEYEABECAAYFAlo2WDAACgkQNgKwf1XQxzLIAwCcCkJzqedt2FUq1N5ysPFomhvS -SnIAnj+0Y7vNI1E4w/ektRMB/HTQceeK -=TjVE ------END PGP SIGNATURE----- diff --git a/sources b/sources new file mode 100644 index 0000000..7e91fce --- /dev/null +++ b/sources @@ -0,0 +1,2 @@ +SHA512 (tar-1.35.tar.xz) = 8b84ed661e6c878fa33eb5c1808d20351e6f40551ac63f96014fb0d0b9c72d5d94d8865d39e36bcb184fd250f84778a3b271bbd8bd2ceb69eece0c3568577510 +SHA512 (tar-1.35.tar.xz.sig) = 00e5c95bf8015f75f59556a82ed7f50bddefe89754c7ff3c19411aee2f37626a5d65c33e18b87f7f8f96388d3f175fd095917419a3ad1c0fc9d6188088bac944 diff --git a/SOURCES/tar-1.28-atime-rofs.patch b/tar-1.28-atime-rofs.patch similarity index 69% rename from SOURCES/tar-1.28-atime-rofs.patch rename to tar-1.28-atime-rofs.patch index f32114a..9b8a93d 100644 --- a/SOURCES/tar-1.28-atime-rofs.patch +++ b/tar-1.28-atime-rofs.patch @@ -1,6 +1,6 @@ -From 71769b9ea3c12b7fbb39fee2e9f4a4c1c36c0d0b Mon Sep 17 00:00:00 2001 -From: rpm-build -Date: Mon, 28 Jul 2014 08:13:31 +0200 +From c4d06365aef1539853e1dd41c539173809760cd0 Mon Sep 17 00:00:00 2001 +From: Lukas Javorsky +Date: Tue, 18 Jul 2023 12:27:38 +0000 Subject: [PATCH 4/9] utime & read-only FS Ignore errors from setting utime() for source file on read-only @@ -16,13 +16,13 @@ http://lists.gnu.org/archive/html/bug-tar/2009-06/msg00016.html 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/create.c b/src/create.c -index e2f4ede..f644f23 100644 +index d20178c..b31fbe5 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) +@@ -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 - && fd && (is_dir || original_size != 0) + && 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 ) @@ -30,5 +30,5 @@ index e2f4ede..f644f23 100644 } -- -1.9.3 +2.41.0 diff --git a/SOURCES/tar-1.28-document-exclude-mistakes.patch b/tar-1.28-document-exclude-mistakes.patch similarity index 100% rename from SOURCES/tar-1.28-document-exclude-mistakes.patch rename to tar-1.28-document-exclude-mistakes.patch diff --git a/SOURCES/tar-1.28-loneZeroWarning.patch b/tar-1.28-loneZeroWarning.patch similarity index 100% rename from SOURCES/tar-1.28-loneZeroWarning.patch rename to tar-1.28-loneZeroWarning.patch diff --git a/SOURCES/tar-1.28-vfatTruncate.patch b/tar-1.28-vfatTruncate.patch similarity index 100% rename from SOURCES/tar-1.28-vfatTruncate.patch rename to tar-1.28-vfatTruncate.patch diff --git a/SOURCES/tar-1.29-wildcards.patch b/tar-1.29-wildcards.patch similarity index 90% rename from SOURCES/tar-1.29-wildcards.patch rename to tar-1.29-wildcards.patch index e239155..40f9425 100644 --- a/SOURCES/tar-1.29-wildcards.patch +++ b/tar-1.29-wildcards.patch @@ -40,15 +40,15 @@ 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 }, +@@ -146,7 +146,7 @@ static struct argp_option names_options[] = { {"no-wildcards", NO_WILDCARDS_OPTION, 0, 0, - N_("verbatim string matching"), GRID+1 }, + 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 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-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer-files.patch b/tar-1.35-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer-files.patch new file mode 100644 index 0000000..5d97f88 --- /dev/null +++ b/tar-1.35-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer-files.patch @@ -0,0 +1,162 @@ +From 1e6ce98e3a4ef5c807458a35973af7e3503c678c Mon Sep 17 00:00:00 2001 +From: Sergey Poznyakoff +Date: Wed, 5 Jun 2024 18:19:10 +0300 +Subject: [PATCH] Fix spurious diagnostic during extraction of . with + --keep-newer-files + +Bug reported in https://savannah.gnu.org/bugs/?65838. + +Bug introduced by 79d1ac38c1. + +* src/extract.c (make_directories): Restore second argument. This +reverts the change made in 79d1ac38c1. +(maybe_recoverable, rename_directory): Update calls to make_directories. +* tests/extrac27.at: New file. +* tests/Makefile.am: Add new test. +* tests/testsuite.at: Likewise. +--- + src/extract.c | 19 ++++++++++--------- + tests/Makefile.am | 1 + + tests/extrac27.at | 46 ++++++++++++++++++++++++++++++++++++++++++++++ + tests/testsuite.at | 1 + + 4 files changed, 58 insertions(+), 9 deletions(-) + create mode 100644 tests/extrac27.at + +diff --git a/src/extract.c b/src/extract.c +index 0fef0562..41f8418f 100644 +--- a/src/extract.c ++++ b/src/extract.c +@@ -709,9 +709,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. */ ++ Set *INTERDIR_MADE (unless NULL) 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 */ +@@ -753,7 +753,8 @@ make_directories (char *file_name) + delay_set_stat (file_name, + 0, mode & ~ current_umask, MODE_RWX, + desired_mode, AT_SYMLINK_NOFOLLOW); +- ++ if (interdir_made) ++ *interdir_made = true; + print_for_mkdir (file_name, desired_mode); + parent_end = NULL; + } +@@ -793,6 +794,9 @@ make_directories (char *file_name) + errno = parent_errno; + mkdir_error (file_name); + } ++ else if (interdir_made) ++ *interdir_made = true; ++ + *parent_end = '/'; + + return stat_status; +@@ -910,11 +914,8 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made) + + case ENOENT: + /* Attempt creating missing intermediate directories. */ +- if (make_directories (file_name) == 0) +- { +- *interdir_made = true; +- return RECOVER_OK; +- } ++ if (make_directories (file_name, interdir_made) == 0 && *interdir_made) ++ return RECOVER_OK; + break; + + default: +@@ -2011,7 +2012,7 @@ rename_directory (char *src, char *dst) + switch (e) + { + case ENOENT: +- if (make_directories (dst) == 0) ++ if (make_directories (dst, NULL) == 0) + { + if (renameat (chdir_fd, src, chdir_fd, dst) == 0) + return true; +diff --git a/tests/Makefile.am b/tests/Makefile.am +index 5745f69c..5b890b7c 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -136,6 +136,7 @@ TESTSUITE_AT = \ + extrac23.at\ + extrac24.at\ + extrac25.at\ ++ extrac27.at\ + filerem01.at\ + filerem02.at\ + dirrem01.at\ +diff --git a/tests/extrac27.at b/tests/extrac27.at +new file mode 100644 +index 00000000..1992d1bb +--- /dev/null ++++ b/tests/extrac27.at +@@ -0,0 +1,46 @@ ++# Test suite for GNU tar. -*- autotest -*- ++# Copyright 2024 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 . ++ ++# Description: When called with --keep-newer-files, tar 1.35 issued ++# spurious diagnostic message: ++# ++# Unexpected inconsistency when making directory. ++# ++# during extraction of ".". ++# ++# References: https://savannah.gnu.org/bugs/?65838 ++ ++AT_SETUP([extract current dir with --keep-newer-files]) ++AT_KEYWORDS([extract extrac27]) ++AT_TAR_CHECK([ ++mkdir dir ++touch dir/file ++tar cf a.tar -C dir . ++ ++mkdir ext ++tar xv --keep-newer-files -f a.tar -C ext ++], ++[0], ++[./ ++./file ++]) ++AT_CLEANUP ++ ++ ++ ++ +diff --git a/tests/testsuite.at b/tests/testsuite.at +index 8a0d39c3..33227ef4 100644 +--- a/tests/testsuite.at ++++ b/tests/testsuite.at +@@ -353,6 +353,7 @@ m4_include([extrac23.at]) + m4_include([extrac23.at]) + m4_include([extrac24.at]) + m4_include([extrac25.at]) ++m4_include([extrac27.at]) + + m4_include([backup01.at]) + +-- +2.45.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/SPECS/tar.spec b/tar.spec similarity index 85% rename from SPECS/tar.spec rename to tar.spec index 476825d..62fcfd7 100644 --- a/SPECS/tar.spec +++ b/tar.spec @@ -1,18 +1,21 @@ -%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1} -%global WITH_SELINUX 1 +%bcond_without selinux +# Don't run check on 32-bit arches, seems to be issues with some tests +%ifarch %{ix86} %{arm} +%bcond_with check +%else +%bcond_without check %endif -Summary: A GNU file archiving program +Summary: GNU file archiving program Name: tar Epoch: 2 -Version: 1.30 -Release: 9%{?dist} -License: GPLv3+ -Group: Applications/Archiving -URL: http://www.gnu.org/software/tar/ +Version: 1.35 +Release: 7%{?dist} +License: GPL-3.0-or-later +URL: https://www.gnu.org/software/tar/ -Source0: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.xz -Source1: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.xz.sig +Source0: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz +Source1: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz.sig # Note that all patches are documented in patch files (git format-patch format) Patch1: tar-1.28-loneZeroWarning.patch @@ -20,36 +23,31 @@ Patch2: tar-1.28-vfatTruncate.patch Patch3: tar-1.29-wildcards.patch Patch4: tar-1.28-atime-rofs.patch Patch9: tar-1.28-document-exclude-mistakes.patch -Patch11: tar-1.28-sparse-inf-loops.patch -Patch12: tar-1.30-tests-difflink.patch -Patch13: tar-1.30-tests-dirrem.patch -Patch14: tar-1.30-xgetcwd-null-return-check.patch -Patch15: tar-1.30-padding-zeros.patch -Patch16: tar-1.30-disk-read-error.patch -# Source: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=14d8fc718f0c872274b90991ee634b0cd8e1a6f0 -Patch17: tar-1.30-Fix-the-no-overwrite-dir-option -# Remove the capabilities test, due to fails (BZ#2066320 and BZ#1926332) -Patch18: tar-1.30-remove-capabs-test.patch -Patch19: tar-1.30-CVE-2022-48303.patch +Patch10: tar-1.33-fix-capabilities-test.patch +Patch11: tar-1.35-add-forgotten-tests-from-upstream.patch +Patch12: tar-1.35-revert-fix-savannah-bug-633567.patch +Patch13: tar-1.35-fix-spurious-diagnostic-during-extraction-of-.-with-keep-newer-files.patch -# run "make check" by default -%bcond_without check - -BuildRequires: autoconf automake texinfo gettext libacl-devel +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: gcc +BuildRequires: gettext +BuildRequires: libacl-devel +BuildRequires: make +BuildRequires: texinfo %if %{with check} # cover needs of tar's testsuite BuildRequires: attr acl policycoreutils %endif -%if %{WITH_SELINUX} +%if %{with selinux} BuildRequires: libselinux-devel %endif Provides: bundled(gnulib) +Provides: bundled(paxutils) Provides: /bin/tar Provides: /bin/gtar -Requires(post): /sbin/install-info -Requires(preun): /sbin/install-info %description The GNU tar program saves many files together in one archive and can @@ -63,6 +61,7 @@ backups. If you want to use tar for remote backups, you also need to install the rmt package on the remote box. + %prep %autosetup -p1 autoreconf -v @@ -74,18 +73,17 @@ awk 'stop = false; /^2014-07-27/ { stop = true; exit }; { print }' \ %build -%if ! %{WITH_SELINUX} -%global CONFIGURE_SELINUX --without-selinux -%endif - -%configure %{?CONFIGURE_SELINUX} \ +%configure \ + %{!?with_selinux:--without-selinux} \ --with-lzma="xz --format=lzma" \ DEFAULT_RMT_DIR=%{_sysconfdir} \ RSH=/usr/bin/ssh -make %{?_smp_mflags} + +%make_build + %install -make DESTDIR=$RPM_BUILD_ROOT install +%make_install ln -s tar $RPM_BUILD_ROOT%{_bindir}/gtar rm -f $RPM_BUILD_ROOT/%{_infodir}/dir @@ -96,12 +94,13 @@ ln -s tar.1.gz $RPM_BUILD_ROOT%{_mandir}/man1/gtar.1 rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rmt rm -f $RPM_BUILD_ROOT%{_mandir}/man8/rmt.8* - %find_lang %name + %check %if %{with check} rm -f $RPM_BUILD_ROOT/test/testsuite +# make check TESTSUITEFLAGS='-k \!dirrem01,\!dirrem02' || ( make check || ( # get the error log set +x @@ -114,20 +113,8 @@ make check || ( ) %endif -%post -if [ -f %{_infodir}/tar.info.gz ]; then - /sbin/install-info %{_infodir}/tar.info.gz %{_infodir}/dir || : -fi - -%preun -if [ $1 = 0 ]; then - if [ -f %{_infodir}/tar.info.gz ]; then - /sbin/install-info --delete %{_infodir}/tar.info.gz %{_infodir}/dir || : - fi -fi %files -f %{name}.lang -%{!?_licensedir:%global license %%doc} %license COPYING %doc AUTHORS README THANKS NEWS ChangeLog %{_bindir}/tar @@ -136,23 +123,101 @@ fi %{_mandir}/man1/gtar.1* %{_infodir}/tar.info* + %changelog -* Thu Feb 09 2023 Matej Mužila - 1.30-9 -- Fix CVE-2022-48303 -- Resolves: CVE-2022-48303 +* Tue Feb 4 2025 Pavel Cahyna - 2:1.35-7 +- Backport upstream fix for savannah bug 65838, upstream commit 1e6ce98e -* Mon Dec 05 2022 Lukas Javorsky - 1.30-8 -- Remove the capabs_raw01 test from testsuite (#2066320) +* Tue Oct 29 2024 Troy Dawson - 2:1.35-5 +- Bump release for October 2024 mass rebuild: + Resolves: RHEL-64018 -* Fri Nov 25 2022 Lukas Javorsky - 1.30-7 -- Fix the --no-overwrite-dir option +* Mon Jun 24 2024 Troy Dawson - 2:1.35-4 +- Bump release for June 2024 mass rebuild -* Wed May 12 2021 Ondrej Dubaj - 1.30-6 -- added "padding with zeros" info message (#1913566) -- do not report disk error as file shrank (#1913569) +* Sat Jan 27 2024 Fedora Release Engineering - 2:1.35-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild -* Wed May 20 2020 Ondrej Dubaj - 1.30-5 -- fixed NULL return value from xgetcwd (#1837871) +* Tue Aug 15 2023 Pavel Raiskup - 1.35-2 +- fix duplicated entries bug with --delete, rhbz#2230127 + +* Tue Jul 25 2023 Lukas Javorsky - 2:1.35-1 +- Rebase to version 1.35 + +* Sat Jul 22 2023 Fedora Release Engineering - 2:1.34-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + +* Wed Mar 01 2023 Lukas Javorsky - 2:1.34-8 +- Resolve CVE-2022-48303 + +* Thu Feb 02 2023 Arjun Shankar - 2:1.34-7 +- Port configure script to C99 + +* Sat Jan 21 2023 Fedora Release Engineering - 2:1.34-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild + +* Thu Nov 03 2022 Peter Robinson - 2:1.34-5 +- Disable check on 32 bit arches as tests have issues + +* Sat Jul 23 2022 Fedora Release Engineering - 2:1.34-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild + +* Sat Jan 22 2022 Fedora Release Engineering - 2:1.34-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild + +* Fri Jul 23 2021 Fedora Release Engineering - 2:1.34-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Sat Feb 13 2021 Ondrej Dubaj - 1.34-1 +- Rebase to version 1.34 + +* Wed Jan 27 2021 Fedora Release Engineering - 2:1.33-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Mon Jan 25 2021 Ondrej Dubaj - 1.33-2 +- Fixed memory leak in read_header() in list.c (#1917631) + +* Thu Jan 07 2021 Pavel Raiskup - 1.33-1 +- new upstream release (see the packaged NEWS file) + +* Wed Jul 29 2020 Fedora Release Engineering - 2:1.32-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 13 2020 Ondrej Dubaj - 2:1.32-5 +- Bugfix of --sparse option in --diff mode + +* Wed Feb 05 2020 Than Ngo - 2:1.32-4 +- Skip the test if genfile is unable to create + +* Fri Jan 31 2020 Fedora Release Engineering - 2:1.32-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sat Jul 27 2019 Fedora Release Engineering - 2:1.32-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Mon Feb 25 2019 Pavel Raiskup - 1.32-1 +- the latest upstream release, per release notes + http://lists.gnu.org/archive/html/info-gnu/2019-02/msg00010.html +- admit that we bundle paxutils project + +* Mon Feb 04 2019 Pavel Raiskup - 1.31-4 +- fix racy compress: gzip test + +* Sun Feb 03 2019 Fedora Release Engineering - 2:1.31-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Thu Jan 17 2019 Pavel Raiskup - 1.31-2 +- backport fix for dirrem tests, and reenable them again + +* Thu Jan 10 2019 Pavel Raiskup - 1.31-1 +- the latest upstream release, per release notes + http://lists.gnu.org/archive/html/info-gnu/2019-01/msg00001.html + +* Tue Aug 07 2018 Pavel Raiskup - 1.30-6 +- use %%bcond_* for selinux, use %%make_* macros + +* Sat Jul 14 2018 Fedora Release Engineering - 2:1.30-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild * Wed May 23 2018 Pavel Raiskup - 1.30-4 - drop BuildRequires: rsh, we anyways use ./configure RSH=%%_bindir/ssh