bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] --index-file with --file=- problem


From: Sergey Poznyakoff
Subject: Re: [Bug-tar] --index-file with --file=- problem
Date: Thu, 06 Jul 2006 23:02:36 +0300

Marcin Gryszkalis <address@hidden> wrote:

> There's obvious bug when tar uses both
> --index-file=tar.log
> and
> --file=-

Yes, indeed. Thanks for reporting. I have installed the following
patch:

Index: src/buffer.c
===================================================================
RCS file: /cvsroot/tar/tar/src/buffer.c,v
retrieving revision 1.105
diff -p -u -r1.105 buffer.c
--- src/buffer.c        24 Jun 2006 16:47:29 -0000      1.105
+++ src/buffer.c        6 Jul 2006 19:30:54 -0000
@@ -436,16 +436,6 @@ _open_archive (enum access_mode wanted_a
 {
   int backed_up_flag = 0;
 
-  if (index_file_name)
-    {
-      stdlis = freopen (index_file_name, "w", stdout);
-      if (! stdlis)
-       open_error (index_file_name);
-      close_stdout_set_file_name (index_file_name);
-    }
-  else
-    stdlis = to_stdout_option ? stderr : stdout;
-
   if (record_size == 0)
     FATAL_ERROR ((0, 0, _("Invalid value for record_size")));
 
@@ -484,10 +474,6 @@ _open_archive (enum access_mode wanted_a
          abort (); /* Should not happen */
          break;
        }
-
-      if (wanted_access == ACCESS_WRITE
-         && strcmp (archive_name_array[0], "-") == 0)
-       stdlis = stderr;
     }
   else if (strcmp (archive_name_array[0], "-") == 0)
     {
@@ -513,12 +499,10 @@ _open_archive (enum access_mode wanted_a
 
        case ACCESS_WRITE:
          archive = STDOUT_FILENO;
-         stdlis = stderr;
          break;
 
        case ACCESS_UPDATE:
          archive = STDIN_FILENO;
-         stdlis = stderr;
          write_archive_to_stdout = true;
          record_end = record_start; /* set up for 1st record = # 0 */
          break;
Index: src/tar.c
===================================================================
RCS file: /cvsroot/tar/tar/src/tar.c,v
retrieving revision 1.152
diff -p -u -r1.152 tar.c
--- src/tar.c   25 Jun 2006 12:46:12 -0000      1.152
+++ src/tar.c   6 Jul 2006 19:30:59 -0000
@@ -2198,6 +2198,16 @@ decode_options (int argc, char **argv)
       break;
     }
 
+  /* Initialize stdlis */
+  if (index_file_name)
+    {
+      stdlis = fopen (index_file_name, "w");
+      if (! stdlis)
+       open_error (index_file_name);
+    }
+  else
+    stdlis = to_stdout_option ? stderr : stdout;
+
   archive_name_cursor = archive_name_array;
 
   /* Prepare for generating backup names.  */


Regards,
Sergey   




reply via email to

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