Report record size only if the archive refers to a device(#487760)

This commit is contained in:
Ondrej Vasik 2009-06-25 20:04:41 +00:00
parent b5434c3876
commit 6d2f2e3091
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,59 @@
diff -urNp tar-1.22-orig/src/buffer.c tar-1.22/src/buffer.c
--- tar-1.22-orig/src/buffer.c 2009-03-05 08:04:13.000000000 +0100
+++ tar-1.22/src/buffer.c 2009-06-25 21:42:34.000000000 +0200
@@ -679,6 +679,19 @@ archive_read_error (void)
return;
}
+static bool
+archive_is_dev ()
+{
+ struct stat st;
+
+ if (fstat (archive, &st))
+ {
+ stat_diag (*archive_name_cursor);
+ return false;
+ }
+ return S_ISBLK (st.st_mode) || S_ISCHR (st.st_mode);
+}
+
static void
short_read (size_t status)
{
@@ -690,7 +703,8 @@ short_read (size_t status)
if (left && left % BLOCKSIZE == 0
&& verbose_option
- && record_start_block == 0 && status != 0)
+ && record_start_block == 0 && status != 0
+ && archive_is_dev ())
{
unsigned long rsize = status / BLOCKSIZE;
WARN ((0, 0,
diff -urNp tar-1.22-orig/tests/sparsemvp.at tar-1.22/tests/sparsemvp.at
--- tar-1.22-orig/tests/sparsemvp.at 2008-10-19 23:56:00.000000000 +0200
+++ tar-1.22/tests/sparsemvp.at 2009-06-25 21:55:43.000000000 +0200
@@ -56,7 +56,5 @@ Test archive
sparsefile
Compare archive
],
-[tar: Record size = 12 blocks
-tar: Record size = 12 blocks
-],[],[],[pax])])
+[],[],[],[pax])])
diff -urNp tar-1.22-orig/tests/volsize.at tar-1.22/tests/volsize.at
--- tar-1.22-orig/tests/volsize.at 2008-10-19 23:54:53.000000000 +0200
+++ tar-1.22/tests/volsize.at 2009-06-25 21:56:08.000000000 +0200
@@ -52,9 +52,7 @@ Extracted directory
abc
abc/CCC
],
-[tar: Record size = 5 blocks
-tar: Record size = 5 blocks
-])
+[])
AT_CLEANUP

View File

@ -2,7 +2,7 @@ Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.22
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -15,6 +15,7 @@ Patch3: tar-1.19-xattrs.patch
Patch4: tar-1.19-xattrs-conf.patch
Patch5: tar-1.17-wildcards.patch
Patch6: tar-1.22-atime-rofs.patch
Patch7: tar-1.22-shortreadbuffer.patch
Prereq: info
BuildRequires: autoconf automake gzip texinfo gettext libacl-devel libselinux-devel gawk rsh
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -41,6 +42,7 @@ the rmt package.
%patch4 -p1 -b .xattrs-conf
%patch5 -p1 -b .wildcards
%patch6 -p1 -b .rofs
%patch7 -p1 -b .shortread
%build
%configure --bindir=/bin --libexecdir=/sbin
@ -91,6 +93,10 @@ fi
%{_infodir}/tar.info*
%changelog
* Thu Jun 25 2009 Ondrej Vasik <ovasik@redhat.com> 2:1.22-4
- Report record size only if the archive refers to a device
(#487760)
* Fri May 15 2009 Ondrej Vasik <ovasik@redhat.com> 2:1.22-3
- ignore errors from setting utime() for source file
on read-only filesystem (#500742)