Commit Graph

414 Commits

Author SHA1 Message Date
Paul Eggert
7f1bf2e09f just ignore them silently. 2001-09-26 20:53:42 +00:00
Paul Eggert
dd83d5dd9d (read_header): Don't keep around extended name and link info
indefinitely; keep it only for the next file.  This fixes a bug
introduced in 1.13.24, and remove the need for some static variables.
Set recent_long_name and recent_long_link to zero if there were no
long links; this avoids a violation of ANSI C rules for pointers in
delete.c.
2001-09-26 20:15:52 +00:00
Paul Eggert
02a275c6ac (maybe_recoverable): Treat OVERWRITE_OLD_DIRS like DEFAULT_OLD_FILES. 2001-09-24 18:58:52 +00:00
Paul Eggert
e6e72bf7ed Allocate one more byte than the size would indicate, since we're
null-terminating.
2001-09-23 06:18:20 +00:00
Paul Eggert
9a15fcf491 (write_archive_buffer, close_archive): If an archive is a socket,
treat it like a FIFO.
2001-09-23 05:03:42 +00:00
Paul Eggert
e2b5f1e918 Put copyright notice into documentation. 2001-09-22 00:47:09 +00:00
Paul Eggert
63db9071d2 Include print-copyr.h, not copysym.h.
(main): Use print_copyright, not copyright_symbol.
2001-09-22 00:47:09 +00:00
Paul Eggert
5a5f4d06e7 Include print-copyr.h, not copysym.h.
(decode_options): Use print_copyright, not copyright_symbol.
(OVERWRITE_DIR_OPTION): New constant.
(long_options, usage, decode_options): Add --overwrite-dir.
2001-09-22 00:47:09 +00:00
Paul Eggert
ec63030958 (update_archive): Pass 0 to read_header. 2001-09-22 00:47:09 +00:00
Paul Eggert
0e041a7bfe (records_read, records_written): New vars.
(write_archive_to_stdout): Now bool, not int.
(open_archive, flush_write, flush_read): Keep records_read and
records_written up to date.
2001-09-22 00:47:09 +00:00
Paul Eggert
85f651c8c6 (recent_long_name, recent_long_link, recent_long_name_blocks,
recent_long_link_blocks): New vars.
(read_and): Pass 0 to read_header.
(read_header): New arg RAW_EXTENDED_HEADERS.  Store away extended headers
into new vars.  Null-terminate incoming symbolic links.
2001-09-22 00:47:09 +00:00
Paul Eggert
6c9e824ce5 (extract_archive): When marking a directory to be updated after
symlinks, stat all directories after it in the delayed-set-stat
list too, since they will be checked after symlinks.
Add support for --overwrite-dir.
2001-09-22 00:47:09 +00:00
Paul Eggert
8267e6ed02 Fix bug: statement before decl. 2001-09-14 02:05:00 +00:00
Paul Eggert
135a24714f Include copysym.h.
(main): Use copyright_symbol to translate copyright notice,
instead of gettext.
2001-09-14 00:27:39 +00:00
Paul Eggert
8571998faa Include copysym.h.
(decode_options): Use copyright_symbol to translate copyright notice,
instead of gettext.
2001-09-14 00:27:39 +00:00
Paul Eggert
95dda72cc6 (struct delayed_set_stat): New member 'after_symlinks'.
(delay_set_stat): Initialize it to 0.
(set_mode): New arg current_stat_info.  Use it (if nonnull) to avoid
taking an extra stat ourselves.  All callers changed.
(set_stat): Likewise.
(apply_nonancestor_delayed_set_stat): New arg 'after_symlinks'.
If false, stop when encountering a struct whose 'after_symlinks' member is
true.  Otherwise, go through all structures but check them more carefully.
All callers changed.
(extract_archive): When extracting a deferred symlink, if its parent
directory's status needs fixing, then mark the directory as needing
to be fixed after symlinks.
(extract_finish): Fix status of ordinary directories, then apply delayed
symlinks, then fix the status of directories that are ancestors
of delayed symlinks.
2001-09-12 06:46:23 +00:00
Paul Eggert
172dc3e72b Remove rexec declaration; it ran afoul of prototypes on Crays. 2001-09-12 06:37:02 +00:00
Paul Eggert
421568c002 (name_gather, addname): Use offsetof when computing sizes for
struct hack; this avoids wasted space in some cases.
(name_gather): Use strcpy, not memcpy.
for consistency with other code that does similar things.
(read_name_from_file, name_next, name_gather, add_hierarchy_to_namelist):
Avoid quadratic behavior when reallocating buffers.
Check for buffer size overflow.
(addname): Avoid unnecessary clearing of memory.
2001-08-29 21:37:27 +00:00
Paul Eggert
eb5c8f4b8b (dump_file): Relativize link names before dumping.
This fixes a bug reported by Jose Pedro Oliveira.
(dump_file): Use offsetof when computing sizes for
struct hack; this avoids wasted space in some cases.
2001-08-29 21:37:27 +00:00
Paul Eggert
4bb7c67e04 (delay_set_stat): Fix off-by-one error in file
name size allocation that caused core dumps.
From Jan.Djarv@mbox200.swipnet.se.
(extract_archive): Use strcpy, not memcpy,
for consistency with other code that does similar things.
2001-08-29 21:37:27 +00:00
Paul Eggert
68867c0103 (main): Use "Copyright %d" to simplify the translator's job in the future.
Advise translator about circle-C.
2001-08-29 06:55:23 +00:00
Paul Eggert
8f207b89cf (decode_options):
Use "Copyright %d" to simplify the translator's job in the future.
Advise translator about circle-C.
2001-08-29 06:55:23 +00:00
Paul Eggert
17afd0438f (ANCHORED_OPTION, IGNORE_CASE_OPTION, NO_ANCHORED_OPTION,
NO_IGNORE_CASE_OPTION, NO_WILDCARDS_OPTION, NO_WILDCARDS_MATCH_SLASH_OPTION,
WILDCARDS_OPTION, WILDCARDS_MATCH_SLASH_OPTION): New enum values.

(long_options, usage, decode_options): Add support for --anchored,
--ignore-case, --no-anchored, --no-ignore-case, --no-wildcards,
--no-wildcards-match-slash, --recursion, --wildcards,
--wildcards-match-slash.

(decode_options): Implement the new way of interpreting exclude patterns.

(usage): --newer-mtime takes a DATE operand.  DATE may be a file name.

(OPTION_STRING, decode_options): Add -I, -y.  Currently these options
just print error messages suggesting alternatives.

(add_filtered_exclude): Remove.
2001-08-27 14:41:56 +00:00
Paul Eggert
998ecf08c0 (base_name): Remove decl, as system.h now declares it. 2001-08-27 14:35:06 +00:00
Paul Eggert
4f07b06506 (collect_and_sort_names): If ignore_failed_read_option, only warn about
stat errors.

(excluded_name): Now returns bool.  Simplify, as the fancy features are
now all in excluded_filename.
2001-08-27 14:34:24 +00:00
Paul Eggert
a52396de9b (from_header): Do not issue a diagnostic if TYPE is zero.
However, check for error even for '-' or '+' case.

(print_header): Try parsing uids and gids as unsigned integers first,
and as a uid_t or gid_t only if that fails.  This adds support for
listing positive uids and gids that are greater than UID_MAX and
GID_MAX.
2001-08-27 14:32:51 +00:00
Paul Eggert
a7cd57a91d (struct delayed_symlinks, extract_archive, apply_delayed_symlinks):
Support hard links to symbolic links.

(struct delayed_symlink): Remove 'names' member, replacing it with
'sources' and 'target' member.  All uses changed.

(struct string_list): New type.

(delayed_set_stat, extract_archive): Use offsetof when computing sizes
for struct hack; this avoids wasted space in some cases.

(extract_archive): Fix test for absolute pathnames and/or "..".
Use link_error to report errors for links.
Remove redundant trailing '/' at "really_dir", for all uses, not
just before invoking mkdir.
If overwriting old files, do not worry so much about existing directories.
Fix mode computation in the case where the directory exists.

(apply_delayed_symlinks): If we can't make a hard link to a symbolic
link, make a copy of the symbolic link.
2001-08-27 14:27:54 +00:00
Paul Eggert
58e97f92d3 (new_volume): Stop if the script exits with an error. 2001-08-27 14:14:17 +00:00
Paul Eggert
8bfa7852ec system.h now does time.h stuff. 2001-01-13 05:59:29 +00:00
Paul Eggert
649897fb75 Include full-write.h.
(main): Update copyright.
2001-01-13 05:59:29 +00:00
Paul Eggert
56147d0b43 Include full-write.h. 2001-01-13 05:59:29 +00:00
Paul Eggert
d32dfe5d5e (time): Do not declare.
(usage): Remove -I as an alias for -T>
(OPTION_STRING): Remove -I.
(decode_options): Dates that look like an absolute path name,
or that start with '.', are presumed to be file names whose
dates are taken.
Remove 'I' as an aliase for 'T'.
Update copyright.
2001-01-13 05:59:29 +00:00
Paul Eggert
a6d27a4aa4 (relativize): New function.
> (relativize): New function, with much of old start_header's guts.
Handle filesystem prefixes.
(start_header): Use this new function.
(init_sparsearray): Don't bother to zero out the new array; it's not needed.
(deal_with_sparse): Fix array allocation bug.
(create_archive): Don't assume '/' is the only separator.
(dump_file): Likewise.
Don't worry about leading / in symlink targets.
2001-01-13 05:59:29 +00:00
Paul Eggert
9b71c10982 (name_next): Don't assume '/' is the only directory separator.
(namelist_match): Likewise.
(add_hierarchy_to_namelist): Remove dirsize arg.
Do not assume '/' is the only directory separator.
(new_name): Likewise.
2001-01-13 05:59:29 +00:00
Paul Eggert
a19097f3e6 (_remdev): Look for / anywhere in Path. 2001-01-13 05:59:29 +00:00
Paul Eggert
3b6f724b92 (<time.h>): Do not include; system.h now does this.
(time): Remove decl; likewise.
(child_open_for_uncompress): Use new full_write semantics.
(flush_write): Use ISSLASH instead of testing for '/'.
(flush_read): Likewise.
2001-01-13 05:59:29 +00:00
Paul Eggert
eca497ef34 (<time.h>): Do not include; system.h now does this.
(make_directories): Skip filesystem prefixes.
Don't assume '/' is the only separator.
(extract_sparse_file): Use new full_write semantics.
On write error, return instead of invoking skip_file.
Do not free sparsearray; caller does this now.
(apply_nonancestor_delayed_set_stat): Do not assume '/' is the only
separator.
(extract_archive): Don't assume file name lengths fit in int.
Report what got stripped from member name; it might be more than '/'.
Use new full_write semantics.
Do not pass redundant trailing "/" to mkdir, as POSIX does not allow
mkdir to ignore it.
Do not report mkdir error if old_files_option == KEEP_OLD_FILES.
2001-01-13 05:59:29 +00:00
Paul Eggert
04182eb50c Include fnmatch.h. 2000-10-29 22:37:07 +00:00
Paul Eggert
fb93b996c8 (namelist_match, excluded_name): Do not match subfiles of a directory
if --no-recursion is specified.
2000-10-29 05:30:02 +00:00
Paul Eggert
345eb9f767 (dump_file): no_recurse_option -> ! recursion_option 2000-10-29 05:30:02 +00:00
Paul Eggert
f7767dbad2 (NO_RECURSE_OPTION): Remove.
(long_options): Have getopt set the --no-recursion flag.
(decode_options): Initialize recursion_option to FNM_LEADING_DIR.
Remove case for NO_RECURSE_OPTION.
2000-10-29 05:30:02 +00:00
Paul Eggert
8d37615dc4 (namelist_match): New function.
(name_match, name_scan): Use it, to eliminate duplicate code.
(names_notfound): Remove special case for Amiga.
2000-10-28 12:42:45 +00:00
Paul Eggert
7abb9b854d (flush_read): If read_full_records_option, try to fill the input buffer,
as --delete -f - needs this.
2000-10-28 05:54:42 +00:00
Paul Eggert
d2f18d9ecb (decode_options): Check that volume label is not too long to overflow
name in tar header block.
2000-10-25 05:21:06 +00:00
Paul Eggert
29c1020f91 (check_label_pattern): Make sure header name is a string before
passing it to fnmatch.
(init_volume_number): Check for global_volno overflow.
(new_volume): Check for global_volno overflow.
2000-10-25 05:21:06 +00:00
Paul Eggert
22596ef599 Include <time.h>, since we invoke "time". 2000-10-24 06:37:55 +00:00
Paul Eggert
f326d78fda Include localedir.h.
(main): Update copyright date to 2000.
2000-10-24 06:18:37 +00:00
Paul Eggert
caf6047e1e Include localedir.h, prepargs.h.
(long_options): Now static.
(long_options, usage, decode_options): -j is now short for --bzip2,
and -I is now an alias for -T.
(decode_options, main): argv is not const pointer now.
(decode_options): Invoke prepend_default_options to support TAR_OPTIONS.
In diagnostic, mention the string that was the invalid blocking factor,
tape length, group, owner, or record size.
--delete is no longer incompatible with -f -, undoing 2000-01-07 change.
(main): Invoke extract_finish at end of extraction.
2000-10-24 06:18:37 +00:00
Paul Eggert
8111f9d34d Include hash.h.
(gnu_list_name): Remove decl.
(struct link): Remove "next" member.
(linklist): Remove.
(start_header): Say "leading `FOO'" rather than "`FOO' prefix" for consistency
with other diagnostics.
(deal_with_sparse): Check for I/O error when closing the file.
(create_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.
(hash_link, compare_links): New functions.
(dump_file): Do not exhaust open file descriptors when descending deeply
into a directory, by using savedir rather than opendir/readdir.
Do not zero-fill the name buffer unnecessarily.
Hash the set of links already created, instead of using a linked list.
Fix some bugs in outputting sparse files which caused the sparse tables
to be incorrect.
When a file unexpectedly shrinks, output zeros rather than garbage.
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.
2000-10-24 06:18:37 +00:00
Paul Eggert
e0fe240d7c Fix comments. 2000-10-24 06:18:37 +00:00