bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] Possible tar bug... or just clueless?


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] Possible tar bug... or just clueless?
Date: Fri, 24 Aug 2007 14:49:30 +0300

Ian <address@hidden> ha escrit:

> I have found that sometimes tar will exit with a 0 status for files
> that are not tarfiles.

To be precise, it will silently ignore any files smaller than 512 bytes,
whatever their contents. Thanks for reporting. Enclosed is the fix.

Regards,
Sergey

Index: src/buffer.c
===================================================================
RCS file: /cvsroot/tar/tar/src/buffer.c,v
retrieving revision 1.110
diff -p -u -r1.110 buffer.c
--- src/buffer.c        27 Jun 2007 13:30:14 -0000      1.110
+++ src/buffer.c        24 Aug 2007 11:29:58 -0000
@@ -235,14 +235,16 @@ check_compressed_archive ()
 {
   struct zip_magic const *p;
   bool sfr;
-
+  bool short_file = false;
+  
   /* Prepare global data needed for find_next_block: */
   record_end = record_start; /* set up for 1st record = # 0 */
   sfr = read_full_records;
   read_full_records = true; /* Suppress fatal error on reading a partial
                               record */
-  find_next_block ();
-
+  if (find_next_block () == 0)
+    short_file = true;
+  
   /* Restore global values */
   read_full_records = sfr;
 
@@ -254,6 +256,9 @@ check_compressed_archive ()
     if (memcmp (record_start->buffer, p->magic, p->length) == 0)
       return p->type;
 
+  if (short_file)
+    ERROR ((0, 0, _("This does not look like a tar archive")));
+
   return ct_none;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]