]> Dogcows Code - chaz/tar/commitdiff
Report record size only if the archive refers to a device.
authorSergey Poznyakoff <gray@gnu.org.ua>
Mon, 25 May 2009 07:18:36 +0000 (10:18 +0300)
committerSergey Poznyakoff <gray@gnu.org.ua>
Mon, 25 May 2009 07:18:59 +0000 (10:18 +0300)
* 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

NEWS
configure.ac
src/Makefile.am
src/buffer.c
tests/pipe.at
tests/shortrec.at
tests/sparsemvp.at
tests/volsize.at

diff --git a/NEWS b/NEWS
index 2a6fee24c4fd7142c4c380fd19b9691cf96e2a9d..e9a31ca34a80123b5b3dfc14e2026e3e9083647a 100644 (file)
--- 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 <bug-tar@gnu.org>
 
+\f
+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).
+
 \f
 version 1.22 - Sergey Poznyakoff, 2009-03-05
 
index 4a5237ef558c5b99eb8068014ba957c3c30eee53..1b1831afcea9d4ab890fda4a3fa4b40c436a345e 100644 (file)
@@ -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])
index 77774056bca11e5081c879d5b49b95d0e82da514..fdb7d68fd7132019e2cdffe82f5b7f7716882a41 100644 (file)
@@ -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)
 
index 8edc257fe63ba27510eae8a4153ee2b02c48bf0b..a01af374c3b4a00d77992d057e739f4274757c75 100644 (file)
@@ -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,
index be992126288bb6ae8a9f2a8dc67b201719e4e96b..833e1342992811cd852985596fc2ed1bdfd88e6d 100644 (file)
@@ -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
index 179f36564cfe9a976624bbfd8a26c485ccfdadd0..69dec89981053ef078b4bbe6d7f806ee7d28698a 100644 (file)
@@ -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
 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
index 2edd823320002bfb9b907a8f4cd7cb871ecf8edc..1ab8bf19cc26116a4f631c48bcc6c378a6289e3a 100644 (file)
@@ -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])])
 
index b8624a047213e8560f33b93507e3b7238a2ecfc9..74ba28bacab8d5c197c1d2c85d218595ef58ea25 100644 (file)
@@ -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
 
This page took 0.030934 seconds and 4 git commands to generate.