[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] Format when appending
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] Format when appending |
Date: |
Wed, 19 May 2004 14:41:33 +0300 |
Hi Gunnar,
> when one appends ('r') files to an archive, GNU tar 1.14 does not
> recognize the type of the original archive but appends GNU tar format
Thanks for reporting. Please find attached a patch that fixes the bug.
Regards,
Sergey
Index: src/update.c
===================================================================
RCS file: /cvsroot/tar/tar/src/update.c,v
retrieving revision 1.29
diff -p -u -r1.29 update.c
--- src/update.c 16 May 2004 20:50:56 -0000 1.29
+++ src/update.c 19 May 2004 11:26:38 -0000
@@ -107,11 +107,15 @@ update_archive (void)
{
enum read_header previous_status = HEADER_STILL_UNREAD;
int found_end = 0;
+ struct xheader save_xh;
name_gather ();
open_archive (ACCESS_UPDATE);
xheader_write_global ();
+ save_xh = extended_header;
+ memset (&extended_header, 0, sizeof extended_header);
+
while (!found_end)
{
enum read_header status = read_header (false);
@@ -126,19 +130,22 @@ update_archive (void)
{
struct name *name;
+ decode_header (current_header, ¤t_stat_info,
+ ¤t_format, 0);
+ archive_format = current_format;
+
if (subcommand_option == UPDATE_SUBCOMMAND
&& (name = name_scan (current_stat_info.file_name)) != NULL)
{
struct stat s;
- enum archive_format unused;
- decode_header (current_header, ¤t_stat_info, &unused, 0);
chdir_do (name->change_dir);
if (deref_stat (dereference_option,
current_stat_info.file_name, &s) == 0
&& s.st_mtime <= current_stat_info.stat.st_mtime)
add_avoided_name (current_stat_info.file_name);
}
+
skip_member ();
break;
}
@@ -175,10 +182,13 @@ update_archive (void)
break;
}
+ tar_stat_destroy (¤t_stat_info);
+ xheader_destroy (&extended_header);
previous_status = status;
}
reset_eof ();
+ extended_header = save_xh;
time_to_start_writing = true;
output_start = current_block->buffer;