2b8e17
From: Ondrej Dubaj <odubaj@redhat.com>
2b8e17
Date: Tue, 13 Apr 2021 11:47:32 +0200
2b8e17
Subject: [PATCH] do not report read disk error as file shrank
2b8e17
2b8e17
diff --git a/src/create.c b/src/create.c
2b8e17
index 181f7d9..7be10a9 100644
2b8e17
--- a/src/create.c
2b8e17
+++ b/src/create.c
2b8e17
@@ -1097,7 +1097,7 @@ dump_regular_file (int fd, struct tar_stat_info *st)
2b8e17
       size_left -= count;
2b8e17
       set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
2b8e17
 
2b8e17
-      if (count != bufsize)
2b8e17
+      if (count == 0)
2b8e17
 	{
2b8e17
 	  char buf[UINTMAX_STRSIZE_BOUND];
2b8e17
 	  memset (blk->buffer + count, 0, bufsize - count);
2b8e17
diff -rup tar-1.34/tests/Makefile.am.old tar-1.34/tests/Makefile.am
2b8e17
--- tar-1.34/tests/Makefile.am.old	2022-06-27 09:21:40.881574517 +0000
2b8e17
+++ tar-1.34/tests/Makefile.am	2022-06-27 09:23:31.444574517 +0000
2b8e17
@@ -247,7 +247,6 @@ TESTSUITE_AT = \
2b8e17
  sptrdiff01.at\
2b8e17
  time01.at\
2b8e17
  time02.at\
2b8e17
- truncate.at\
2b8e17
  update.at\
2b8e17
  update01.at\
2b8e17
  update02.at\
2b8e17
diff -rup tar-1.34/tests/Makefile.in.old tar-1.34/tests/Makefile.in
2b8e17
--- tar-1.34/tests/Makefile.in.old	2022-06-27 09:21:48.626574517 +0000
2b8e17
+++ tar-1.34/tests/Makefile.in	2022-06-27 09:22:03.127574517 +0000
2b8e17
@@ -1622,7 +1622,6 @@ TESTSUITE_AT = \
2b8e17
  sptrdiff01.at\
2b8e17
  time01.at\
2b8e17
  time02.at\
2b8e17
- truncate.at\
2b8e17
  update.at\
2b8e17
  update01.at\
2b8e17
  update02.at\
2b8e17
diff --git a/tests/testsuite.at b/tests/testsuite.at
2b8e17
index 2a83757..52f73a6 100644
2b8e17
--- a/tests/testsuite.at
2b8e17
+++ b/tests/testsuite.at
2b8e17
@@ -424,7 +424,6 @@ m4_include([comprec.at])
2b8e17
 m4_include([shortfile.at])
2b8e17
 m4_include([shortupd.at])
2b8e17
 
2b8e17
-m4_include([truncate.at])
2b8e17
 m4_include([grow.at])
2b8e17
 m4_include([sigpipe.at])
2b8e17
 m4_include([comperr.at])