Paul Eggert [Tue, 29 Nov 2005 19:14:21 +0000 (19:14 +0000)]
* NEWS: New option --atime-preserve=system, which uses O_NOATIME.
* configure.ac: Prefer AC_CHECK_HEADERS_ONCE to AC_CHECK_HEADERS.
Check for stropts.h and sys/filio.h too, for _FIOSATIME.
* doc/tar.texi: Change "modification time" to "data modification
time", "change time" to "status change time", and "filesystem" to
"file system", so that we use terminology consistent with POSIX.
Use American spacing rather than French for sentence ends.
"non-dependable" -> "undependable".
(Option Summary, Attributes): Explain better the pitfalls of the
--atime-preserve option, and suggest read-only mounts,loopback
mounts, and noatime mounts for older systems.
* doc/value.texi (op-atime-preserve-system): Renamed from
op-atime-preserver-system to fix a misspelling.
* src/common.h (enum atime_preserve): Use lower case for enum values.
* src/compare.c: Don't include utimens.h; no longer needed.
(diff_file): Use set_file_atime rather than utimens; avoid closing
diff_handle until after this, so that we can set the file time stamp
via the file descriptor rather than via its name.
* src/create.c: Don't include utimens.h; no longer needed.
(dump_regular_finish): Remove. All callers now do its work inline.
(dump_dir): New arg FD. All callers changed.
Use fdsavedir rather than savedir.
(unknown_file_error): Arg is a const pointer now.
(dump_file0): 2nd arg is a const pointer now.
Treat directories more like files, with respect to --atime-preserve.
For example, also warn if a directory changes while we are dumping it.
Prefer file descriptors to file names when retrieving/setting file
attributes; this saves path-resolution time and allows us to avoid
changing mtime/ctime on Solaris when restoring atime as root.
Use O_DIRECTORY when opening directories, to avoid some race conditions.
Do not reset atime if mtime has changed. Report an error if
we cannot reset atime.
First cut at adding support for --atime-preserve=system.
* doc/tar.texi (Option Summary): First cut at documenting it.
All other uses of --atime-preserve changed to --atime-preserve=replace.
* doc/value.texi (op-atime-preserve-replace, op-atime-preserver-system):
New.
(op-atime-preserve): Mention METHOD.
* src/common.h (atime_preserve): New enum.
(atime_preserve_option): Now of the enum type rather than bool.
All uses changed.
* src/compare.c (diff_file): Read with O_NOATIME if asked for.
* src/create.c (dump_file0): Read regular and CTG files with O_NOATIME
if asked for.
* src/tar.c (usage): Mention new usage.
(parse_opt): Parse new usage.
(xheader_format_name): Remove static
qualifier. Change last argument.
Correct buffer size calculation (allocated too much space).
(xheader_write): Increase global_header_count here ...
(xheader_write_global): ... instead of here
(flush_write,flush_read): Change data type.
(flush_archive): Compute actual buffer fill level before calling
low level function.
(close_archive): Call flush_archive again if the first call
resulted in partially filled buffer.
(try_new_volume): Rewritten handling of initial headers.
(add_chunk_header): New function. Write an additional header
before the continuation chunk. The purpose of the header is to
allow third-party tars to extract the member.
(simple_flush_write): Take an argument.
(_gnu_flush_write): Correctly handle partially filled buffers.
(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.