From: Sergey Poznyakoff Date: Mon, 25 May 2009 07:18:36 +0000 (+0300) Subject: Report record size only if the archive refers to a device. X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Ftar;a=commitdiff_plain;h=be34933b638b75a40513ea2b724c756b1f8e3b85 Report record size only if the archive refers to a device. * Makefile.am (INCLUDES): Add ../lib, for rmt-command.h * src/buffer.c (short_read): Report the actual record size only if the archive descriptor refers to a device. * tests/pipe.at, tests/shortrec.at, tests/sparsemvp.at: Reflect the above change. * NEWS, configure.ac: Version 1.22.90 --- diff --git a/NEWS b/NEWS index 2a6fee2..e9a31ca 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,15 @@ -GNU tar NEWS - User visible changes. 2009-03-05 +GNU tar NEWS - User visible changes. 2009-05-25 Please send GNU tar bug reports to + +version 1.22.90 (Git) + +* Record size autodetection + +When listing or extracting archives, the actual record size is +reported only if the archive is read from a device (as opposed +to regular files and pipes). + version 1.22 - Sergey Poznyakoff, 2009-03-05 diff --git a/configure.ac b/configure.ac index 4a5237e..1b1831a 100644 --- a/configure.ac +++ b/configure.ac @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. -AC_INIT([GNU tar], [1.22], [bug-tar@gnu.org]) +AC_INIT([GNU tar], [1.22.90], [bug-tar@gnu.org]) AC_CONFIG_SRCDIR([src/tar.c]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) diff --git a/src/Makefile.am b/src/Makefile.am index 7777405..fdb7d68 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,7 +41,7 @@ tar_SOURCES = \ update.c\ utf8.c -INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib +INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV) diff --git a/src/buffer.c b/src/buffer.c index 8edc257..a01af37 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -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 --git a/tests/pipe.at b/tests/pipe.at index be99212..833e134 100644 --- a/tests/pipe.at +++ b/tests/pipe.at @@ -1,7 +1,8 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2006, 2007, 2008, +# 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,16 +31,15 @@ AT_SETUP([decompressing from stdin]) AT_KEYWORDS([pipe]) -AT_TAR_WITH_HOOK([TAR_IGNREC_HOOK], -[AT_TAR_CHECK([ +AT_TAR_CHECK([ AT_SORT_PREREQ mkdir directory genfile --length 10240 --pattern zeros --file directory/file1 genfile --length 13 --file directory/file2 -tar cf archive directory|sort +tar cf archive directory mv directory orig -cat archive | tar xfv - | sort +cat archive | tar xfv - | sort echo "separator" cmp orig/file1 directory/file1 echo "separator" @@ -50,7 +50,6 @@ directory/file1 directory/file2 separator separator -], -[stderr])]) +]) AT_CLEANUP diff --git a/tests/shortrec.at b/tests/shortrec.at index 179f365..69dec89 100644 --- a/tests/shortrec.at +++ b/tests/shortrec.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2005, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,20 +25,15 @@ AT_SETUP([short records]) AT_KEYWORDS([shortrec]) -AT_TAR_WITH_HOOK([TAR_IGNREC_HOOK], -[AT_TAR_CHECK([ +AT_TAR_CHECK([ mkdir directory (cd directory && touch a b c d e f g h i j k l m n o p q r) -tar -c -b 1 -f - directory | tar -t -f - +tar -c -b 1 -f - directory | tar -t -f - > /dev/null tar -c -b 1 -f archive directory -tar -t -f archive -tar -t -f - < archive +tar -t -f archive > /dev/null +tar -t -f - < archive > /dev/null rm -r directory -], -[0], -[ignore], -[stderr]) ]) AT_CLEANUP diff --git a/tests/sparsemvp.at b/tests/sparsemvp.at index 2edd823..1ab8bf1 100644 --- a/tests/sparsemvp.at +++ b/tests/sparsemvp.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -56,7 +56,5 @@ Test archive sparsefile Compare archive ], -[tar: Record size = 12 blocks -tar: Record size = 12 blocks -],[],[],[pax])]) +[],[],[],[pax])]) diff --git a/tests/volsize.at b/tests/volsize.at index b8624a0..74ba28b 100644 --- a/tests/volsize.at +++ b/tests/volsize.at @@ -1,7 +1,7 @@ # Process this file with autom4te to create testsuite. -*- Autotest -*- # Test suite for GNU tar. -# Copyright (C) 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -52,9 +52,7 @@ Extracted directory abc abc/CCC ], -[tar: Record size = 5 blocks -tar: Record size = 5 blocks -]) +[]) AT_CLEANUP