import tar-1.30-6.el8

This commit is contained in:
CentOS Sources 2022-11-08 02:04:21 -05:00 committed by Stepan Oksanichenko
parent 2b7202b1e3
commit 80f8a672b8
3 changed files with 239 additions and 1 deletions

View File

@ -0,0 +1,53 @@
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 --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])

View File

@ -0,0 +1,179 @@
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 --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

View File

@ -6,7 +6,7 @@ Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.30
Release: 5%{?dist}
Release: 6%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -24,6 +24,8 @@ 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
# run "make check" by default
%bcond_without check
@ -129,6 +131,10 @@ fi
%{_infodir}/tar.info*
%changelog
* 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)
* Wed May 20 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.30-5
- fixed NULL return value from xgetcwd (#1837871)