(try_new_volume): Bugfix. Always check
continued_file_name. If it is absent, the volume is out
of sync.
(add_multi_volume_header): Create GNU.volume.filename keyword in
the extended header.
(save_name,save_sizeleft,save_totsize): Remove
globals.
(volume_label,continued_file_name,continued_file_size): New
variables.
(flush_read,flush_write): Pointers to functions
(mv_begin,mv_end,mv_total_size,mv_size_left): New functions
(write_extended): New function.
Rewritten in a more modular fashion to provide
GNU extensions (multi-volume archives and archive labels) in
pax format.
(volume_label,continued_file_name,continued_file_size)
(continued_file_offset): New globals.
(save_name,save_totsize,save_sizeleft): Make static
(mv_begin,mv_end,mv_total_size,mv_size_left): New functions
(open_archive,flush_write,flush_read): Rewritten
Paul Eggert [Tue, 8 Nov 2005 07:20:02 +0000 (07:20 +0000)]
* src/tar.c (NS_PRECISION_FORMAT_MASK): New macro.
(tar_timespec_cmp): New function. Wrapper over
timespec_cmp using the timespec precision provided by the
current archive format.
* src/common.h (tar_timespec_cmp): New declaration.
* src/compare.c (diff_file): Use tar_timespec_cmp.
* src/extract.c (file_newer_p): Likewise.
* src/update.c (update_archive): Likewise.
* tests/truncate.at: Reverted changes
* tests/update.at: Reverted changes
Paul Eggert [Mon, 7 Nov 2005 04:03:29 +0000 (04:03 +0000)]
* tests/truncate.at: Create files whose time stamps must fall on
1-second boundaries. This prevents tests from failing on hosts
like Solaris 8 that have nanosecond-resolution file time stamps.
* tests/update.at: Likewise.
(xheader_keyword_deleted_p): Remove static
qualifier.
(struct xhdr_tab.decoder): Change prototype. POSIX allows string
values to contain embedded nulls, so take an extra argument
specifying the length of the string.
(decx,decg,dummy_decoder,atime_decoder,gid_decoder)
(gname_decoder,linkpath_decoder,ctime_decoder,mtime_decoder)
(path_decoder,size_decoder,uid_decoder,uname_decoder)
(sparse_size_decoder,sparse_numblocks_decoder)
(sparse_offset_decoder,sparse_numbytes_decoder): Likewise.
(decode_record): Pass value length to the handler
(run_override_list): Pass value length to the decoder
(xheader_print_n): New function
(xheader_print): Rewritten using xheader_print_n
(xheader_finish): Do not rely om strlen to compute the length of
the collected string: it can contain embedded nulls
(xheader_string_begin,xheader_string_add,xheader_string_end): New
functions.
(sparse_map_decoder,dumpdir_coder,dumpdir_decoder): New
functions. Handle GNU.sparse.map and GNU.dumpdir variables.
(xhdr_tab): Add new variables.
(sparse_diff_file): Bugfix: set seekable.
(pax_dump_header): Store sparse map in GNU.sparse.map. If this
variable has been explicitely deleted, use GNU.sparse.offset/
GNU.sparse.numbytes variables.
Paul Eggert [Sun, 6 Nov 2005 23:29:30 +0000 (23:29 +0000)]
* tests/truncate.at: Use -H pax to preserve full time stamp resolution.
This prevents tests from failing on hosts like Solaris 8 that have
nanosecond-resolution file time stamps.
* tests/update.at: Likewise.
(struct directory.mtime): New member.
(note_directory): Take additional arguments. All callers updated.
(scan_directory): Updated to use more metadata. In particular,
this allows to correctly detect renamed files.
(read_directory_file,write_directory_file)
(write_directory_file_entry): Support new directory file format.
Fix quoting in help output.
(update_po): Use backward-compatible wget option --cache instead
of deprecated -C to accomodate for wget 1.10.
Changes proposed by Eric Blake
Paul Eggert [Sat, 17 Sep 2005 06:41:55 +0000 (06:41 +0000)]
Don't filter time stamps through the resolution supported
by struct stat; keep them to full nanosecond resolution.
This affects behavior only on older hosts or file systems
that have lower-resolution time stamps.
* src/common.h (OLDER_STAT_TIME): Parenthesize arg.
(OLDER_TAR_STAT_TIME): New macro.
(code_timespec): New function.
(BILLION, LOG10_BILLION, TIMESPEC_STRSIZE_BOUND): New constants.
* src/compare.c (diff_file): Use full time stamp resolution.
* src/create.c (start_header, dump_file0): Likewise.
(start_header, dump_file0): Adjust to new structure layout.
(dump_regular_finish): Simplify by using timespec_cmp.
* src/extract.c (struct delayed_set_stat): Don't store stat info
that we don't need, to save space. All uses changed.
(struct delayed_set_stat, struct delayed_link, file_newer_p):
(create_placeholder_file, extract_link, apply_delayed_links):
Use full time stamp resolution.
(check_time): Use code_timespec rather than rolling our own code.
(set_stat, delay_set_stat): Arg now points to tar_stat_info to
avoid losing time information. All callers changed.
* src/list.c (read_and, decode_header, print_heaeder):
Use full time stamp resolution.
* src/misc.c (code_timespec): New function.
* src/tar.h (struct tar_stat_info): Record atime, mtime, ctime
separately, for benefit of hosts with lower resolution.
* src/update.c (update_archive): Use full time stamp resolution.
* src/xheader.c (code_time): Use new code_timespec function
to simplify code.
(atime_coder, atime_decoder, ctime_coder, ctime_decoder):
(mtime_coder, mtime_decoder): Use full time stamp resolution.
Report time stamps to full resolution in environment.
Report memory allocation failures rather than ignoring them.
* src/system.c (time_to_env): New function.
(oct_to_env, str_to_env, chr_to_env): Report memory allocation failures.
(stat_to_env): Report full resolution in time stamps.
Paul Eggert [Fri, 16 Sep 2005 07:03:44 +0000 (07:03 +0000)]
Merge changes from gnulib for file system sub-second time stamps.
* configure.ac: Remove checks for struct stat.st_spare1, struct
stat.st_atim.tv_nsec, struct stat.st_atimespec.tv_nsec, struct
stat.st_atimensec, as gnulib now does this for us.
Similarly for LIB_CLOCK_GETTIME.
* gnulib.modules: Add stat-time.
* lib/.cvsignore: Add stat-time.h.
* src/common.h: Include stat-time.h.
(timespec_lt): Remove. All callers changed to use timespec_cmp.
(get_stat_atime, get_stat_ctime, get_stat_mtime):
(set_stat_atime, set_stat_ctime, set_stat_mtime):
Remove; now defined by stat-time.h.
Paul Eggert [Mon, 12 Sep 2005 18:45:59 +0000 (18:45 +0000)]
Treat fishy-looking hard links like fishy-looking symlinks.
(struct delayed_set_stat): Rename after_symlinks
member to after_links. All uses changed.
(struct delayed_link): Renamed from struct delayed_symlink.
All uses changed. New member is_symlink.
(delayed_link_head): Renamed from delayed_symlink_head. All uses
changed.
(create_placeholder_file): New function, taken from extract_symlink.
(extract_link): Create placeholders for fishy-looking hard links.
(extract_symlink): Move code into create_placeholder_file.
(apply_delayed_links): Renamed from apply_delayed_symlinks.
All uses changed. Create both hard links and symlinks.
(tar_sparse_init): Fill structure with zeros. Call
sparse_select_optab(). All callers updated.
(sparse_member_p, sparse_fixup_header): Use tar_sparse_init().