Paul Eggert [Mon, 7 Aug 2006 21:29:27 +0000 (21:29 +0000)]
(read_incr_db_01): Check input strings more
carefully. Do not pass arbitrary char values to isspace, as
this has undefined behavior. Likewise for assigning arbitrary
uintmax_t values to other types.
(read_negative_num, read_unsigned_num, read_timespec):
New functions, to check input values a bit more carefuly.
(read_num): Use read_unsigned_num. New arg MAX_VAL;
all callers changed.
(read_incr_db_2): Use these new functions.
Use a consistent diagnostic for unexpected EOF.
(read_directory_file): Do not assign arbitrary uintmax_t value
to int.
(read_timespec, write_directory_file_entry, write_directory_file):
Handle negative time_t values correctly. We don't bother to do
this with pre-2 formats, since presumably the time stamps were
output incorrectly.
(to_chars_subst): Update comment regarding OLDGNU
vs. GNU format differences.
(mode_to_chars): Treat OLDGNU_FORMAT same as GNU_FORMAT. Fixes bug
reported by TAMUKI Shoichi <tamuki@linet.gr.jp>, which caused
equivalent `tar cf ...' and `tar rf ...' commands to produce
different archives.
(chdir_arg): Use x2nrealloc to reallocate wd.
(get_max_open_files,closeopen): New functions
(chdir_do): Do not use save_cwd if it was already used more than
max_open_files-4 times to avoid running off the file
descriptors.
A sample utility to expand sparse files
extracted by third-party tars. It is not meant to be installed nor
to be included in the distribution. It is here, so that it can be
obtained either from CVS or from the tar web site.
(xhdr_tab.decoder): pass keyword as a second
argument. All callers changed.
(decode_record): Check for numeric overflow
(xheader_string_end): Return boolean value. Check for possible
numeric overflow
Implement sparse format versioning. Implement new
version (1.0) of PAX sparse format.
(pax_sparse_member_p): Fix condition
(pax_dump_header): A dispatcher function
(pax_dump_header_0,pax_dump_header_1): New functions.
(pax_optab): Update
(oldgnu_dump_header): Minor fix: make sure
sparse_header.isextended is set before calling
set_next_block_after
Implement new option, --mtime, allowing to set
modification times for all archive members during creation.
(struct tar_args): textual_date_option replaced with a linked list
textual_date. All references updated.
(get_date_or_file,report_textual_dates): New functions.
(pax_dump_header): Store original sparse file name
in GNU.sparse.name variable. The name field in the ustar header
now contains generated name (%d/GNUSparseFile.%p/%f), so that
non-pax-aware tars won't extract the file under the original
filename.
(name_next_elt): Call register_individual_file
(namelist_match): Remove third argument
(name_match): Change return type to bool
(name_scan): Remove second argument
(procdir): Use is_individual_file to check for
files explicitely specified in the command line. Fixes bug
reported by Dat Head on 19 Jun 2006 (descending into mountpoints
with --one-file-system in use)
Define op as codeindex. Use xopindex and opsummary to
populate it
Consequently prefer @dfn{long options} over @dfn{mnemonic
options}.
Document --unquote, --no-unquote
(Short Option Summary): Build a table of cross-references to the
corresponding long options.
(options, parse_opt): Allow for optional argument to
the --totals option, which specifies a signal upon delivery of which
the statistics must be output.
(main): Call print_total_stats if total_option is set.
(total_blocks_deleted): New variable
(set_start_time): Set volume_start_time and last_stat_time as well
(set_volume_start_time): New function
(compute_duration): Do not call set_start_time, update
last_stat_time instead. Use it in calculation instead of
start_time, which is now set only once, upon startup.
(print_total_written): Removed.
(print_total_stats): New function for printing byte/speed statistics.
(_open_archive): Detect attempts to update compressed archives.
(_gnu_flush_write): Always update prev_written.
(open_archive): Call set_volume_start_time.