Do not report disk error as file shrank

Resolves: #2089316
This commit is contained in:
Ondrej Dubaj 2022-06-27 09:04:28 +00:00 committed by Lukas Javorsky
parent fe38e6bc82
commit 7693e349f3
2 changed files with 53 additions and 0 deletions

View File

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

View File

@ -20,6 +20,7 @@ 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
BuildRequires: make
BuildRequires: gcc
@ -116,6 +117,7 @@ make check || (
%changelog
* 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)
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2:1.34-3
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags