Compare commits
No commits in common. "c9-beta" and "c8" have entirely different histories.
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
SOURCES/tar-1.34.tar.xz
|
||||
SOURCES/tar-1.30.tar.xz
|
||||
|
@ -1 +1 @@
|
||||
bb9d853e10d0753fe9063914401a7e164d51a0f0 SOURCES/tar-1.34.tar.xz
|
||||
0d442c4565f8131745a5dff1cd08f7eaa797f679 SOURCES/tar-1.30.tar.xz
|
||||
|
129
SOURCES/tar-1.28-sparse-inf-loops.patch
Normal file
129
SOURCES/tar-1.28-sparse-inf-loops.patch
Normal file
@ -0,0 +1,129 @@
|
||||
From b451bfd224da44e93cf842f23455d755e48421dd Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Raiskup <praiskup@redhat.com>
|
||||
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
|
||||
|
@ -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
|
||||
@@ -146,7 +146,7 @@ static struct argp_option names_options[] = {
|
||||
@@ -137,7 +137,7 @@ static struct argp_option names_options[] = {
|
||||
{"no-ignore-case", NO_IGNORE_CASE_OPTION, 0, 0,
|
||||
N_("case sensitive matching (default)"), GRID+1 },
|
||||
{"wildcards", WILDCARDS_OPTION, 0, 0,
|
||||
- N_("use wildcards (default for exclusion)"), GRID+1 },
|
||||
+ N_("use wildcards (default)"), GRID+1 },
|
||||
{"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
|
||||
N_("verbatim string matching"), GRID_MATCH },
|
||||
N_("verbatim string matching"), GRID+1 },
|
||||
{"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
|
||||
|
297
SOURCES/tar-1.30-Fix-the-no-overwrite-dir-option
Normal file
297
SOURCES/tar-1.30-Fix-the-no-overwrite-dir-option
Normal file
@ -0,0 +1,297 @@
|
||||
From 14d8fc718f0c872274b90991ee634b0cd8e1a6f0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org>
|
||||
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 <http://www.gnu.org/licenses/>.
|
||||
+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 <mail@michael-kaufmann.ch>
|
||||
+# 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
|
||||
|
@ -15,22 +15,24 @@ index 181f7d9..7be10a9 100644
|
||||
{
|
||||
char buf[UINTMAX_STRSIZE_BOUND];
|
||||
memset (blk->buffer + count, 0, bufsize - count);
|
||||
diff -rup tar-1.34/tests/Makefile.am.old tar-1.34/tests/Makefile.am
|
||||
--- tar-1.34/tests/Makefile.am.old 2022-06-27 09:21:40.881574517 +0000
|
||||
+++ tar-1.34/tests/Makefile.am 2022-06-27 09:23:31.444574517 +0000
|
||||
@@ -247,7 +247,6 @@ TESTSUITE_AT = \
|
||||
sptrdiff01.at\
|
||||
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 -rup tar-1.34/tests/Makefile.in.old tar-1.34/tests/Makefile.in
|
||||
--- tar-1.34/tests/Makefile.in.old 2022-06-27 09:21:48.626574517 +0000
|
||||
+++ tar-1.34/tests/Makefile.in 2022-06-27 09:22:03.127574517 +0000
|
||||
@@ -1622,7 +1622,6 @@ TESTSUITE_AT = \
|
||||
sptrdiff01.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\
|
||||
|
@ -143,10 +143,11 @@ index eccf6f9..28c6f44 100644
|
||||
}
|
||||
|
||||
void
|
||||
diff -rup tar-1.34/src/sparse.c.old tar-1.34/src/sparse.c
|
||||
--- tar-1.34/src/sparse.c.old 2022-06-27 09:15:48.580574517 +0000
|
||||
+++ tar-1.34/src/sparse.c 2022-06-27 09:18:28.500574517 +0000
|
||||
@@ -424,7 +424,7 @@ sparse_dump_region (struct tar_sparse_fi
|
||||
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),
|
||||
@ -154,17 +155,17 @@ diff -rup tar-1.34/src/sparse.c.old tar-1.34/src/sparse.c
|
||||
+ bufsize, false);
|
||||
return false;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
@@ -619,7 +619,7 @@ check_sparse_region (struct tar_sparse_f
|
||||
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,
|
||||
beg,
|
||||
- rdsize);
|
||||
+ rdsize, false);
|
||||
- offset, rdsize);
|
||||
+ offset, rdsize, false);
|
||||
return false;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
@@ -674,7 +674,7 @@ check_data_region (struct tar_sparse_fil
|
||||
|
||||
@@ -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),
|
||||
@ -172,4 +173,7 @@ diff -rup tar-1.34/src/sparse.c.old tar-1.34/src/sparse.c
|
||||
+ rdsize, false);
|
||||
return false;
|
||||
}
|
||||
else if (bytes_read == 0)
|
||||
file->dumped_size += bytes_read;
|
||||
--
|
||||
2.30.2
|
||||
|
||||
|
82
SOURCES/tar-1.30-remove-capabs-test.patch
Normal file
82
SOURCES/tar-1.30-remove-capabs-test.patch
Normal file
@ -0,0 +1,82 @@
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
-#
|
||||
-# 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
|
15
SOURCES/tar-1.30-tests-difflink.patch
Normal file
15
SOURCES/tar-1.30-tests-difflink.patch
Normal file
@ -0,0 +1,15 @@
|
||||
Per https://www.mail-archive.com/bug-tar@gnu.org/msg05440.html
|
||||
|
||||
diff --git a/tests/difflink.at b/tests/difflink.at
|
||||
index eadfb08..4e01176 100644
|
||||
--- a/tests/difflink.at
|
||||
+++ b/tests/difflink.at
|
||||
@@ -21,7 +21,7 @@ mkdir a
|
||||
genfile -f a/x
|
||||
ln -s x a/y
|
||||
ln a/y a/z
|
||||
-tar cf a.tar a
|
||||
+tar cf a.tar a/x a/y a/z
|
||||
rm a/z
|
||||
ln -s x a/z
|
||||
tar df a.tar
|
93
SOURCES/tar-1.30-tests-dirrem.patch
Normal file
93
SOURCES/tar-1.30-tests-dirrem.patch
Normal file
@ -0,0 +1,93 @@
|
||||
From 298cfc4743b9cca6cc0c685b9fce5b34827bec1b Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Raiskup <praiskup@redhat.com>
|
||||
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
|
||||
|
50
SOURCES/tar-1.30-xgetcwd-null-return-check.patch
Normal file
50
SOURCES/tar-1.30-xgetcwd-null-return-check.patch
Normal file
@ -0,0 +1,50 @@
|
||||
From 60acf5a7407ef263aaf7d3751da08167b1990eb0 Mon Sep 17 00:00:00 2001
|
||||
From: Sergey Poznyakoff <gray@gnu.org>
|
||||
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
|
||||
|
7
SOURCES/tar-1.30.tar.xz.sig
Normal file
7
SOURCES/tar-1.30.tar.xz.sig
Normal file
@ -0,0 +1,7 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1.4.15 (GNU/Linux)
|
||||
|
||||
iEYEABECAAYFAlo2WDAACgkQNgKwf1XQxzLIAwCcCkJzqedt2FUq1N5ysPFomhvS
|
||||
SnIAnj+0Y7vNI1E4w/ektRMB/HTQceeK
|
||||
=TjVE
|
||||
-----END PGP SIGNATURE-----
|
@ -1,34 +0,0 @@
|
||||
From: Pavel Raiskup <praiskup@redhat.com>
|
||||
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
|
||||
|
@ -1,164 +0,0 @@
|
||||
From 7819e9ce26a6331f7a347c59cebfd5c6a8902ea3 Mon Sep 17 00:00:00 2001
|
||||
From: Lukas Nykryn <lnykryn@redhat.com>
|
||||
Date: Thu, 15 Aug 2024 14:19:58 +0200
|
||||
Subject: [PATCH] =?UTF-8?q?Warn=20=E2=80=9Cfile=20changed=20as=20we=20read?=
|
||||
=?UTF-8?q?=20it=E2=80=9D=20less=20often?=
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* src/create.c (dump_file0): Remove an fstatat call that is
|
||||
unnecessary because the file wasn’t read so we can treat the first
|
||||
fstatat as atomic. Warn “file changed” when the file’s size,
|
||||
mtime, user ID, group ID, or mode changes, instead of when the
|
||||
file’s size or ctime changes. Also, when such a change happens,
|
||||
do not change exit status if --ignore-failed-read. Finally, don’t
|
||||
attempt to change atime back if it didn’t change.
|
||||
---
|
||||
doc/tar.texi | 10 ++++++----
|
||||
src/create.c | 54 ++++++++++++++++++++++++++++++++++++----------------
|
||||
2 files changed, 44 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/doc/tar.texi b/doc/tar.texi
|
||||
index b66b163..dd5a272 100644
|
||||
--- a/doc/tar.texi
|
||||
+++ b/doc/tar.texi
|
||||
@@ -2854,7 +2854,7 @@ Ignore exit codes of subprocesses. @xref{Writing to an External Program}.
|
||||
@opsummary{ignore-failed-read}
|
||||
@item --ignore-failed-read
|
||||
|
||||
-Do not exit unsuccessfully merely because an unreadable file was encountered.
|
||||
+Do not exit unsuccessfully merely because reading failed.
|
||||
@xref{Ignore Failed Read}.
|
||||
|
||||
@opsummary{ignore-zeros}
|
||||
@@ -4638,7 +4638,8 @@ Disable all warning messages.
|
||||
@item file-changed
|
||||
@samp{%s: file changed as we read it}
|
||||
@item failed-read
|
||||
-Suppresses warnings about unreadable files or directories. This
|
||||
+Suppresses warnings about read failures, which can occur if files
|
||||
+or directories are unreadable, or if they change while being read. This
|
||||
keyword applies only if used together with the @option{--ignore-failed-read}
|
||||
option. @xref{Ignore Failed Read}.
|
||||
@end table
|
||||
@@ -5761,11 +5762,12 @@ Disable SELinux context support.
|
||||
@table @option
|
||||
@item --ignore-failed-read
|
||||
@opindex ignore-failed-read
|
||||
-Do not exit with nonzero on unreadable files or directories.
|
||||
+Do not exit with nonzero if there are mild problems while reading.
|
||||
@end table
|
||||
|
||||
This option has effect only during creation. It instructs tar to
|
||||
-treat as mild conditions any missing or unreadable files (directories).
|
||||
+treat as mild conditions any missing or unreadable files (directories),
|
||||
+or files that change while reading.
|
||||
Such failures don't affect the program exit code, and the
|
||||
corresponding diagnostic messages are marked as warnings, not errors.
|
||||
These warnings can be suppressed using the
|
||||
diff --git a/src/create.c b/src/create.c
|
||||
index e2816fc..2b3001d 100644
|
||||
--- a/src/create.c
|
||||
+++ b/src/create.c
|
||||
@@ -1650,8 +1650,6 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
||||
{
|
||||
union block *header;
|
||||
char type;
|
||||
- off_t original_size;
|
||||
- struct timespec original_ctime;
|
||||
off_t block_ordinal = -1;
|
||||
int fd = 0;
|
||||
bool is_dir;
|
||||
@@ -1694,10 +1692,11 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
||||
return;
|
||||
}
|
||||
|
||||
- st->archive_file_size = original_size = st->stat.st_size;
|
||||
+ struct stat st1 = st->stat;
|
||||
+ st->archive_file_size = st->stat.st_size;
|
||||
st->atime = get_stat_atime (&st->stat);
|
||||
st->mtime = get_stat_mtime (&st->stat);
|
||||
- st->ctime = original_ctime = get_stat_ctime (&st->stat);
|
||||
+ st->ctime = get_stat_ctime (&st->stat);
|
||||
|
||||
#ifdef S_ISHIDDEN
|
||||
if (S_ISHIDDEN (st->stat.st_mode))
|
||||
@@ -1747,7 +1746,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
||||
if (is_dir || S_ISREG (st->stat.st_mode) || S_ISCTG (st->stat.st_mode))
|
||||
{
|
||||
bool ok;
|
||||
- struct stat final_stat;
|
||||
+ struct stat st2;
|
||||
|
||||
xattrs_acls_get (parentfd, name, st, 0, !is_dir);
|
||||
xattrs_selinux_get (parentfd, name, st, fd);
|
||||
@@ -1815,31 +1814,54 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
||||
errno = - parentfd;
|
||||
ok = false;
|
||||
}
|
||||
- else
|
||||
- ok = fstatat (parentfd, name, &final_stat, fstatat_flags) == 0;
|
||||
}
|
||||
else
|
||||
- ok = fstat (fd, &final_stat) == 0;
|
||||
+ ok = fstat (fd, &st2) == 0;
|
||||
|
||||
if (! ok)
|
||||
file_removed_diag (p, top_level, stat_diag);
|
||||
}
|
||||
|
||||
- if (ok)
|
||||
+ if (ok && fd)
|
||||
{
|
||||
- if ((timespec_cmp (get_stat_ctime (&final_stat), original_ctime) != 0
|
||||
- /* Original ctime will change if the file is a directory and
|
||||
- --remove-files is given */
|
||||
- && !(remove_files_option && is_dir))
|
||||
- || original_size < final_stat.st_size)
|
||||
+ /* Heuristically check whether the file is the same in all
|
||||
+ attributes that tar cares about and can easily check.
|
||||
+ Although the check is not perfect since it does not
|
||||
+ consult file contents, it is typically good enough.
|
||||
+ Do not check atime which is saved only to replace it later.
|
||||
+ Do not check ctime where changes might be benign (e.g.,
|
||||
+ another process creates a hard link to the file). */
|
||||
+
|
||||
+ /* If the file's user ID, group ID or mode changed, tar may
|
||||
+ have output the wrong info for the file. */
|
||||
+ ok &= st1.st_uid == st2.st_uid;
|
||||
+ ok &= st1.st_gid == st2.st_gid;
|
||||
+ ok &= st1.st_mode == st2.st_mode;
|
||||
+
|
||||
+ /* Likewise for the file's mtime, but skip this check if it
|
||||
+ is a directory possibly updated by --remove-files. */
|
||||
+ if (! (is_dir && remove_files_option))
|
||||
+ ok &= ! timespec_cmp (get_stat_mtime (&st1),
|
||||
+ get_stat_mtime (&st2));
|
||||
+
|
||||
+ /* Likewise for the file's size, but skip this check if it
|
||||
+ is a directory as tar does not output directory sizes.
|
||||
+ Although dump_regular_file caught regular file shrinkage,
|
||||
+ it shouldn't hurt to check for shrinkage again now;
|
||||
+ plus, the file may have grown. */
|
||||
+ if (!is_dir)
|
||||
+ ok &= st1.st_size == st2.st_size;
|
||||
+
|
||||
+ if (!ok)
|
||||
{
|
||||
WARNOPT (WARN_FILE_CHANGED,
|
||||
(0, 0, _("%s: file changed as we read it"),
|
||||
quotearg_colon (p)));
|
||||
- set_exit_status (TAREXIT_DIFFERS);
|
||||
+ if (! ignore_failed_read_option)
|
||||
+ set_exit_status (TAREXIT_DIFFERS);
|
||||
}
|
||||
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
|
||||
&& errno != EROFS )
|
||||
utime_error (p);
|
||||
--
|
||||
2.45.2
|
||||
|
@ -1,7 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v1
|
||||
|
||||
iEYEABECAAYFAmAnuBMACgkQNgKwf1XQxzJIVgCfR5Z7coRkU2+aOW4KNhumGl/1
|
||||
jn4AoI9OuQPpyzZN1CIwejDYxbV7u59P
|
||||
=mfma
|
||||
-----END PGP SIGNATURE-----
|
149
SPECS/tar.spec
149
SPECS/tar.spec
@ -1,16 +1,18 @@
|
||||
%bcond_without selinux
|
||||
%bcond_without check
|
||||
%if %{?WITH_SELINUX:0}%{!?WITH_SELINUX:1}
|
||||
%global WITH_SELINUX 1
|
||||
%endif
|
||||
|
||||
Summary: GNU file archiving program
|
||||
Summary: A GNU file archiving program
|
||||
Name: tar
|
||||
Epoch: 2
|
||||
Version: 1.34
|
||||
Release: 7%{?dist}
|
||||
Version: 1.30
|
||||
Release: 9%{?dist}
|
||||
License: GPLv3+
|
||||
URL: https://www.gnu.org/software/tar/
|
||||
Group: Applications/Archiving
|
||||
URL: http://www.gnu.org/software/tar/
|
||||
|
||||
Source0: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz
|
||||
Source1: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz.sig
|
||||
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
|
||||
|
||||
# Note that all patches are documented in patch files (git format-patch format)
|
||||
Patch1: tar-1.28-loneZeroWarning.patch
|
||||
@ -18,14 +20,21 @@ 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
|
||||
Patch10: tar-1.33-fix-capabilities-test.patch
|
||||
Patch11: tar-1.30-padding-zeros.patch
|
||||
Patch12: tar-1.30-disk-read-error.patch
|
||||
Patch13: tar-1.34-CVE-2022-48303.patch
|
||||
Patch14: tar-1.34-Warn-file-changed-as-we-read-it-less-often.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
|
||||
|
||||
# run "make check" by default
|
||||
%bcond_without check
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gcc
|
||||
BuildRequires: autoconf automake texinfo gettext libacl-devel
|
||||
|
||||
%if %{with check}
|
||||
@ -33,13 +42,14 @@ BuildRequires: autoconf automake texinfo gettext libacl-devel
|
||||
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
|
||||
@ -53,7 +63,6 @@ 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
|
||||
@ -65,17 +74,18 @@ awk 'stop = false; /^2014-07-27/ { stop = true; exit }; { print }' \
|
||||
|
||||
|
||||
%build
|
||||
%configure \
|
||||
%{!?with_selinux:--without-selinux} \
|
||||
%if ! %{WITH_SELINUX}
|
||||
%global CONFIGURE_SELINUX --without-selinux
|
||||
%endif
|
||||
|
||||
%configure %{?CONFIGURE_SELINUX} \
|
||||
--with-lzma="xz --format=lzma" \
|
||||
DEFAULT_RMT_DIR=%{_sysconfdir} \
|
||||
RSH=/usr/bin/ssh
|
||||
|
||||
%make_build
|
||||
|
||||
make %{?_smp_mflags}
|
||||
|
||||
%install
|
||||
%make_install
|
||||
make DESTDIR=$RPM_BUILD_ROOT install
|
||||
|
||||
ln -s tar $RPM_BUILD_ROOT%{_bindir}/gtar
|
||||
rm -f $RPM_BUILD_ROOT/%{_infodir}/dir
|
||||
@ -86,13 +96,12 @@ 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
|
||||
|
||||
%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
|
||||
@ -105,8 +114,20 @@ 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
|
||||
@ -115,79 +136,23 @@ make check || (
|
||||
%{_mandir}/man1/gtar.1*
|
||||
%{_infodir}/tar.info*
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Aug 15 2024 Lukas Nykryn <lnykryn@redhat.com> - 2:1.34-7
|
||||
- Warn “file changed as we read it” less often
|
||||
|
||||
* Thu Feb 09 2023 Matej Mužila <mmuzila@redhat.com> - 2:1.34-6
|
||||
* Thu Feb 09 2023 Matej Mužila <mmuzila@redhat.com> - 1.30-9
|
||||
- Fix CVE-2022-48303
|
||||
- Resolves: CVE-2022-48303
|
||||
|
||||
* Fri Jul 01 2022 Lukas Javorsky <ljavorsk@redhat.com> - 2:1.34-5
|
||||
- Release bump
|
||||
* Mon Dec 05 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.30-8
|
||||
- Remove the capabs_raw01 test from testsuite (#2066320)
|
||||
|
||||
* Mon Jun 27 2022 Lukas Javorsky <ljavorsk@redhat.com> - 2:1.34-4
|
||||
- added "padding with zeros" info message (#2089298)
|
||||
- do not report disk error as file shrank (#2089316)
|
||||
* Fri Nov 25 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.30-7
|
||||
- Fix the --no-overwrite-dir option
|
||||
|
||||
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2:1.34-3
|
||||
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
|
||||
Related: rhbz#1991688
|
||||
* Wed May 12 2021 Ondrej Dubaj <odubaj@redhat.com> - 1.30-6
|
||||
- added "padding with zeros" info message (#1913566)
|
||||
- do not report disk error as file shrank (#1913569)
|
||||
|
||||
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2:1.34-2
|
||||
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
|
||||
|
||||
* Sat Feb 13 2021 Ondrej Dubaj <odubaj@redhat.com> - 1.34-1
|
||||
- Rebase to version 1.34
|
||||
|
||||
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.33-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
||||
|
||||
* Mon Jan 25 2021 Ondrej Dubaj <odubaj@redhat.com> - 1.33-2
|
||||
- Fixed memory leak in read_header() in list.c (#1917631)
|
||||
|
||||
* Thu Jan 07 2021 Pavel Raiskup <praiskup@redhat.com> - 1.33-1
|
||||
- new upstream release (see the packaged NEWS file)
|
||||
|
||||
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.32-6
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
||||
|
||||
* Mon Jul 13 2020 Ondrej Dubaj <odubaj@redhat.com> - 2:1.32-5
|
||||
- Bugfix of --sparse option in --diff mode
|
||||
|
||||
* Wed Feb 05 2020 Than Ngo <than@redhat.com> - 2:1.32-4
|
||||
- Skip the test if genfile is unable to create
|
||||
|
||||
* Fri Jan 31 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.32-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
||||
|
||||
* Sat Jul 27 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.32-2
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
||||
|
||||
* Mon Feb 25 2019 Pavel Raiskup <praiskup@redhat.com> - 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 <praiskup@redhat.com> - 1.31-4
|
||||
- fix racy compress: gzip test
|
||||
|
||||
* Sun Feb 03 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.31-3
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
||||
|
||||
* Thu Jan 17 2019 Pavel Raiskup <praiskup@redhat.com> - 1.31-2
|
||||
- backport fix for dirrem tests, and reenable them again
|
||||
|
||||
* Thu Jan 10 2019 Pavel Raiskup <praiskup@redhat.com> - 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 <praiskup@redhat.com> - 1.30-6
|
||||
- use %%bcond_* for selinux, use %%make_* macros
|
||||
|
||||
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.30-5
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
||||
* Wed May 20 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.30-5
|
||||
- fixed NULL return value from xgetcwd (#1837871)
|
||||
|
||||
* Wed May 23 2018 Pavel Raiskup <praiskup@redhat.com> - 1.30-4
|
||||
- drop BuildRequires: rsh, we anyways use ./configure RSH=%%_bindir/ssh
|
||||
|
Loading…
Reference in New Issue
Block a user