Compare commits

...

No commits in common. 'c9' and 'cs10' have entirely different histories.
c9 ... cs10

3
.gitignore vendored

@ -1 +1,2 @@
SOURCES/tar-1.34.tar.xz
SOURCES/tar-1.35.tar.xz
SOURCES/tar-1.35.tar.xz.sig

@ -1 +1,2 @@
bb9d853e10d0753fe9063914401a7e164d51a0f0 SOURCES/tar-1.34.tar.xz
6b9824c92deddbd7021801515270211f5252fbd8 SOURCES/tar-1.35.tar.xz
6740b6306f671129d0295e05aa003bfc184c8f6e SOURCES/tar-1.35.tar.xz.sig

@ -1,6 +1,6 @@
From 71769b9ea3c12b7fbb39fee2e9f4a4c1c36c0d0b Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Mon, 28 Jul 2014 08:13:31 +0200
From c4d06365aef1539853e1dd41c539173809760cd0 Mon Sep 17 00:00:00 2001
From: Lukas Javorsky <ljavorsk@redhat.com>
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

@ -1,51 +0,0 @@
From: Ondrej Dubaj <odubaj@redhat.com>
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 -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\
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\
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])

@ -1,175 +0,0 @@
From 910d9ff829bbdfaf1455cdb2b1813507bcb855ec Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
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 -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
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- bytes_left),
- bufsize);
+ bufsize, false);
return false;
}
else if (bytes_read == 0)
@@ -619,7 +619,7 @@ check_sparse_region (struct tar_sparse_f
{
read_diag_details (file->stat_info->orig_file_name,
beg,
- rdsize);
+ rdsize, false);
return false;
}
else if (bytes_read == 0)
@@ -674,7 +674,7 @@ check_data_region (struct tar_sparse_fil
(file->stat_info->sparse_map[i].offset
+ file->stat_info->sparse_map[i].numbytes
- size_left),
- rdsize);
+ rdsize, false);
return false;
}
else if (bytes_read == 0)

@ -1,30 +0,0 @@
From 3da78400eafcccb97e2f2fd4b227ea40d794ede8 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
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

@ -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 wasnt read so we can treat the first
fstatat as atomic. Warn “file changed” when the files size,
mtime, user ID, group ID, or mode changes, instead of when the
files size or ctime changes. Also, when such a change happens,
do not change exit status if --ignore-failed-read. Finally, dont
attempt to change atime back if it didnt 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-----

@ -0,0 +1,156 @@
From 7fac753fb6e6c0459788ee9015b984dba1de5402 Mon Sep 17 00:00:00 2001
From: Lukas Javorsky <ljavorsk@redhat.com>
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 <http://www.gnu.org/licenses/>.
+
+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 <http://www.gnu.org/licenses/>.
+
+# 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 <mohdakram>
+# > 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

@ -0,0 +1,72 @@
From d437ecf75de2d6fdeb2aed6f45c4b3b16373389b Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org>
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

@ -1,12 +1,17 @@
%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: GNU file archiving program
Name: tar
Epoch: 2
Version: 1.34
Release: 6%{?dist}.1
License: GPLv3+
Version: 1.35
Release: 5%{?dist}
License: GPL-3.0-or-later
URL: https://www.gnu.org/software/tar/
Source0: https://ftp.gnu.org/gnu/tar/tar-%{version}.tar.xz
@ -19,14 +24,16 @@ 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.35-add-forgotten-tests-from-upstream.patch
Patch12: tar-1.35-revert-fix-savannah-bug-633567.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: gettext
BuildRequires: libacl-devel
BuildRequires: make
BuildRequires: gcc
BuildRequires: autoconf automake texinfo gettext libacl-devel
BuildRequires: texinfo
%if %{with check}
# cover needs of tar's testsuite
@ -117,26 +124,45 @@ make check || (
%changelog
* Fri Aug 16 2024 Lukas Nykryn <lnykryn@redhat.com> - 2:1.34-6.1
- Warn “file changed as we read it” less often
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 2:1.35-5
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 2:1.35-4
- Bump release for June 2024 mass rebuild
* Sat Jan 27 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.35-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Tue Aug 15 2023 Pavel Raiskup <praiskup@redhat.com> - 1.35-2
- fix duplicated entries bug with --delete, rhbz#2230127
* Tue Jul 25 2023 Lukas Javorsky <ljavorsk@redhat.com> - 2:1.35-1
- Rebase to version 1.35
* Sat Jul 22 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.34-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Wed Mar 01 2023 Lukas Javorsky <ljavorsk@redhat.com> - 2:1.34-8
- Resolve CVE-2022-48303
* Thu Feb 02 2023 Arjun Shankar <arjun@redhat.com> - 2:1.34-7
- Port configure script to C99
* Thu Feb 09 2023 Matej Mužila <mmuzila@redhat.com> - 2:1.34-6
- Fix CVE-2022-48303
- Resolves: CVE-2022-48303
* Sat Jan 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.34-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Jul 01 2022 Lukas Javorsky <ljavorsk@redhat.com> - 2:1.34-5
- Release bump
* Thu Nov 03 2022 Peter Robinson <pbrobinson@fedoraproject.org> - 2:1.34-5
- Disable check on 32 bit arches as tests have issues
* 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)
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.34-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* 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
* Sat Jan 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.34-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* 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
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2:1.34-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Sat Feb 13 2021 Ondrej Dubaj <odubaj@redhat.com> - 1.34-1
- Rebase to version 1.34

Loading…
Cancel
Save