Paul Eggert [Tue, 24 Oct 2000 06:18:37 +0000 (06:18 +0000)]
(_GNU_SOURCE): Remove; autoconf now does this.
(child_open_for_compress, child_open_for_uncompress, close_archive):
Propagate any failure of the compression process back to "tar".
(open_archive, flush_write, flush_read, close_archive):
Do not allocate an array of size PATH_MAX, as PATH_MAX might be (size_t) -1.
Instead, allocate an array with the size that's needed.
(open_archive): Don't bother checking S_ISCHR of /dev/null.
(backspace_output): Don't try to backspace past start of archive.
(close_archive): Remove special case for DELETE_SUBCOMMAND.
Paul Eggert [Tue, 24 Oct 2000 06:18:37 +0000 (06:18 +0000)]
(_GNU_SOURCE): Remove; autoconf now does this.
Include <hash.h>.
(getpwuid, getgrgid): Declare only if system headers don't.
(gid_to_gname): Don't invoke setgrent.
(namelist): Now static, not global.
(nametail): New var. All uses of namelast changed to use nametail,
with one extra level of indirection.
(name_gather): Use memcpy instead of strncpy + assignment of NUL.
(name_match): Set nametail too, when setting namelist to null.
(add_hierarchy_to_namelist): Change type of dir arg from char * to
struct name *, so that we don't have to look up the name again here.
Get change_dir from dir rather than as a separate arg. Add dirsize arg,
and pass it along to get_directory_contents. Remove unnecessary check
of directory type.
(new_name): Do not append a slash if PATH already ends in one.
(avoided_names, struct avoided_name): Remove.
(avoided_name_table): New var, replacing avoided_names.
(hash_avoided_name, compare_avoided_names): New function.
(add_avoided_name, is_avoided_name): Use hash table rather than linked list.
Paul Eggert [Tue, 11 Jul 2000 03:55:28 +0000 (03:55 +0000)]
(AC_MBSTATE_T): Renamed from AC_MBSTATE_T_OBJECT. All uses changed.
Change from a two-part test, which defines both HAVE_MBSTATE_T_OBJECT
and mbstate_t, to a single-part test that simply defines mbstate_t.
Paul Eggert [Mon, 26 Jun 2000 23:25:37 +0000 (23:25 +0000)]
(<unistd.h>): Do not include; there's no need.
(NAMLEN): Remove macro.
(malloc, realloc): Remove decls.
(stpcpy): Likewise.
("xalloc.h"): Include.
(NAME_SIZE_DEFAULT): New macro.
(savedir): Use xmalloc / xrealloc to allocate memory.
Use NAME_SIZE_DEFAULT if name_size is negative or overflows to zero.
Skip "" directory entries.
Use strlen to calculate directory entry length, since the old method
is rarely used these days and isn't worth supporting.
Check for integer overflow when calculating allocation size.
Use memcpy to copy entries, instead of stpcpy.
Set errno properly when returning NULL.
Check for readdir error.
Paul Eggert [Sat, 19 Feb 2000 00:25:54 +0000 (00:25 +0000)]
Handle two-digit years with leading zeros correctly.
(textint): New typedef.
(parser_control): Changed from struct parser_control to typedef (for
consistency). Member year changed from int to textint. All uses changed.
(YYSTYPE): Removed; replaced by %union with int and textint members.
(tID): Removed; not used.
(tDAY, tDAY_UNIT, tDAYZONE, tHOUR_UNIT, tID, tLOCAL_ZONE, tMERIDIAN,
tMINUTE_UNIT, tMONTH, tMONTH_UNIT tSEC_UNIT, tSNUMBER, tUNUMBER,
tYEAR_UNIT, tZONE, o_merid): Now of type <intval>.
(tSNUMBER, tUNUMBER): Now of type <textintval>.
(date, number, to_year): Use width of number in digits, not its value,
to determine whether it's a 2-digit year, or a 2-digit time.
(yylex): Store number of digits of numeric tokens.
Return '?' for unknown identifiers, rather than (unused) tID.
Paul Eggert [Fri, 7 Jan 2000 19:25:23 +0000 (19:25 +0000)]
(read_and): Invoke apply_nonancestor_delayed_set_stat on file names
after handling them.
(list_archive): Use consistent message for unexpected EOF.
Use error message functions to report errors consistently.
(read_header): Use xalloc_die to report memory exhaustion.
Use consistent message for unexpected EOF.
(decode_mode): Remove; moved to misc.c.
(skip_file): Use consistent message for unexpected EOF.
(skip_extended_headers): Likewise.
Paul Eggert [Fri, 7 Jan 2000 19:25:23 +0000 (19:25 +0000)]
(find_new_file_size): Return size instead of storing through pointer.
All callers changed.
(deal_with_sparse): Don't keep reading after read errors.
(finish_sparse_file): Just abort if there is an internal error.
Use error message functions to report errors consistently.
(dump_file): Fix typo: stat_warn and stat_error were interchanged.
Quote file names with colons if possible.
Don't restore access times on directories during incremental dumps
until after dealing with the directory.
If ignoring failed reads, count closedir errors as warnings, not errors.
Fix buffer overrun problem when dumping sparse files.
If ignoring failed reads, count read errors as warnings, not errors.
Use error message functions to report errors consistently.
If ignoring failed reads, count unknown files as warnings, not errors.
Paul Eggert [Fri, 7 Jan 2000 19:25:23 +0000 (19:25 +0000)]
(extr_init): If we run out of memory, invoke apply_delayed_set_stat.
(set_mode): Use Use error message functions to report errors consistently.
(set_stat): Likewise.
(repair_delayed_set_stat): Quote file names with colons if possible.
(prepare_to_extract): Don't complain if we can't remove ".".
(extract_sparse_file): Use consistent message for unexpected EOF.
Use error message functions to report errors consistently.
(extract_archive): Use consistent message for unexpected EOF.
Use error message functions to report errors consistently.
Quote file names with colons if possible.
(apply_delayed_set_stat): New function.
(apply_nonancestor_delayed_set_stat): Renamed from apply_delayed_set_stat.
Don't remove head if it doesn't apply.
(fatal_exit): Invoke apply_delayed_set_stat with no args.
Paul Eggert [Fri, 7 Jan 2000 19:25:23 +0000 (19:25 +0000)]
(archive_write_error): Add noreturn attribute to decl.
(xclose): Use close_error.
(xdup2): Regularize messages with rest of tar.
(archive_write_error): Use write_fatal_details.
(flush_read): Don't read past EOF.
(flush_archive, close_archive, new_volume): Use close_warn.
Paul Eggert [Thu, 6 Jan 2000 18:07:38 +0000 (18:07 +0000)]
Sync tm_diff with the GNU C Library.
(TM_YEAR_BASE): Renamed from TM_YEAR_ORIGIN. All uses changed.
(tm_diff): Renamed from difftm. All uses changed.
Replace body with that taken from GNU C Library 2.1.3pre1.
(get_date): Prefer tm_gmtoff to tm_diff if available.
Paul Eggert [Mon, 13 Dec 1999 05:11:05 +0000 (05:11 +0000)]
("quotearg.h"): New include.
(usage): Now has __attribute__ ((noreturn)).
(confirm): Report errno if we can't open tty.
(confirm, decode_options):
Quote arbitrary strings in diagnostics.
(OVERWRITE_OPTION): New constant.
(long_options, usage, decode_options): New --overwrite option.
(decode_options): --keep-old-files, --overwrite, and --unlink-first
are now mutually exclusive.
Don't assume that gettext preserves errno.
(main): Set default quoting style to escape_quoting_style.
Paul Eggert [Mon, 13 Dec 1999 04:52:26 +0000 (04:52 +0000)]
(read_and, list_archive):
Quote arbitrary strings in diagnostics.
(from_header): Use locale_quoting_style to quote diagnostics.
(print_header, print_for_mkdir): Quote with quotearg, not quote_copy_string.
Paul Eggert [Mon, 13 Dec 1999 04:52:26 +0000 (04:52 +0000)]
(<quotearg.h>): New include.
(name_init, name_next, name_close, names_notfound, collect_and_sort_names):
Don't assume that gettext preserves errno.
Quote arbitrary strings in diagnostics.
(excluded_name): Fix typo that caused empty patterns to be mishandled.
Paul Eggert [Mon, 13 Dec 1999 03:26:04 +0000 (03:26 +0000)]
(<quotearg.h>): New include.
(enum permstatus): New enum.
(struct delayed_set_stat): file_name is now at end of buffer, to avoid
two mallocs. New members file_name_len, invert_permissions, permstatus.
(extr_init): Remove hack that silently adjusted newdir_umask.
(set_mode, set_stat): New args invert_permissions, permstatus, typeflag.
Use these args to decide whether and how to set modes.
(set_mode, set_stat, prepare_to_extract, extract_sparse_file, extract_archive):
Don't assume that gettext preserves errno.
(set_stat): Remove arg symlink_flag; subsumed by typeflag.
(delay_set_stat, repair_delayed_set_stat): New functions.
(make_directories): Avoid mkdir where last part of path is "..".
Create a struct delayed_set_stat for each directory made.
(prepare_to_extract): Renamed from unlink_destination, and
return 0 immediately if to_stdout_option; all callers changed.
(maybe_recoverable): New parameter interdir_made.
Add support for --overwrite.
(extract_sparse_file, extract_archive):
Quote arbitrary strings in diagnostics.
(extract_archive): By default, warn about ".." in member names, and skip them.
Don't open files with O_NONBLOCK or O_APPEND.
Open with O_TRUNC only if --overwrite; otherwise, use O_EXCL to avoid
overwriting them. Pass only rwxrwxrwx permissions to `open' and `mkdir',
minus the current umask. Keep track of intermediate directories made,
to avoid looping when making x/../x when x doesn't exist; the
earlier code solved this in a different way that didn't fit well
into the new scheme. Don't extract permissions onto existing
directories unless --overwrite is given. Do not add -wx------
permissions to new directories permanently; just do it temporarily.
Remove no-longer-needed hack with MSDOS and directory time stamps.
(apply_delayed_set_stat): New argument specifies which directories to
fix statuses of. Do not wait until the end of extraction to fix
statuses; instead, fix a directory's status once we exit that directory.
This requires less memory and does the right thing in some cases
where the old method didn't.
(fatal_exit): New function.
Paul Eggert [Mon, 13 Dec 1999 03:07:14 +0000 (03:07 +0000)]
(<quotearg.h>): New include.
(start_header): Use `member names' to refer to archive member names, not
`archive names'. Warn about `..' in member names.
(finish_sparse_file, dump_file):
Quote arbitrary strings in diagnostics.
(finish_sparse_file, dump_file):
Don't assume that gettext preserves errno.
(dump_file): Don't use `access' to determine whether a directory is readable;
this isn't reliable if tar is setuid. Use `opendir' instead.
Check for readdir and closedir failures.
Don't dump sockets as if they were fifos; just warn and skip.
(xdup2): Don't report errno if dup returns an unexpected nonnegative value.
(open_archive): Reject multivolume verify attempts a bit earlier.
Rename local variable `access', in case it's defined by system header.
(open_archive, backspace_output): Use `Cannot' uniformly, instead of
`Could not' sometimes and `Cannot' others.
(open_archive, flush_read, flush_archive, close_archive, new_volume):
Quote arbitrary strings in diagnostics.
(read_error): Set archive to STDOUT_FILENO temporarily when writing
archive buffer.
(init_volume_number): Check for input and output errors in volno_file.
(new_volume): Use new fatal_exit function to exit, and new xfork
function to fork.
Paul Eggert [Fri, 3 Dec 1999 13:04:17 +0000 (13:04 +0000)]
(dump_file): Do not diagnose a file that the parent directory
said should be there, but is absent. It was
probably removed between then and now.
Do not pass meaningless errno to ERROR when reporting that the
file changed as we read it.
Paul Eggert [Mon, 11 Oct 1999 06:56:17 +0000 (06:56 +0000)]
Remove --with-dmalloc.
Add --disable-largefile.
Remove old NeXT dirent problems, or AIX valloc problems.
Remove old union wait advice, and old %lld advice.
Remove advice about FreeBSD 2.1.7, ISC 4.1mu, Ultrix `make'.
Paul Eggert [Fri, 24 Sep 1999 23:44:52 +0000 (23:44 +0000)]
(update_archive): Remove call to name_expand; had no effect.
Use chdir_do to change into directory.
Use deref_stat instead of stat.
Use add_avoided_name to mark names to be avoided; the old method of
setting a bit with the name caused all descendants of that name to
be avoided, in some circumstances.
Paul Eggert [Fri, 24 Sep 1999 23:44:52 +0000 (23:44 +0000)]
(<time.h>): Include.
(time): Declare if not defined.
(confirm): Don't read past EOF.
(long_options, usage): Add --no-same-owner, --no-same-permissions.
(main): Use clock_gettime if available.