Browse Source

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
Sergey Poznyakoff 16 years ago
parent
commit
be34933b63
8 changed files with 42 additions and 29 deletions
  1. 10 1
      NEWS
  2. 1 1
      configure.ac
  3. 1 1
      src/Makefile.am
  4. 15 1
      src/buffer.c
  5. 6 7
      tests/pipe.at
  6. 5 10
      tests/shortrec.at
  7. 2 4
      tests/sparsemvp.at
  8. 2 4
      tests/volsize.at

+ 10 - 1
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 <[email protected]>
 
+
+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
 

+ 1 - 1
configure.ac

@@ -18,7 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 # 02110-1301, USA.
 
-AC_INIT([GNU tar], [1.22], [[email protected]])
+AC_INIT([GNU tar], [1.22.90], [[email protected]])
 AC_CONFIG_SRCDIR([src/tar.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_HEADERS([config.h])

+ 1 - 1
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)
 

+ 15 - 1
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,

+ 6 - 7
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

+ 5 - 10
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

+ 2 - 4
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])])
 

+ 2 - 4
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