Commit Graph

85 Commits

Author SHA1 Message Date
Sergey Poznyakoff
af244aeef3 Produce an error, not warning, if the filename is too long. 2004-04-26 09:19:07 +00:00
Paul Eggert
2bda83b48d Merge recent gnulib changes, and remove some lint. 2004-04-05 02:29:18 +00:00
Sergey Poznyakoff
22c2e2ab8a Removed unused variables 2004-04-04 09:25:48 +00:00
Sergey Poznyakoff
d8981440bb (write_long_name): Do not allow more than
NAME_FIELD_SIZE-1 characters in a file name for V7 format
archives.
2004-03-26 19:39:40 +00:00
Sergey Poznyakoff
e5882c8220 (start_header): Check for GNU_FORMAT if incremental_option is set. 2004-03-22 09:16:49 +00:00
Sergey Poznyakoff
b1f33c8362 (write_header_name) In pax format, use "path" keyword if the file name is not ASCII 2004-02-22 20:53:27 +00:00
Sergey Poznyakoff
b960c38c4b (dump_file0): The conditional at line
1296 prevented incremental backups on individual files
from working, as reported by Andreas Schuldei
<andreas@schuldei.org>.

This is due to the condition

  (0 < top_level || !incremental_option)

Removing it makes incremental backups work for individual
files as well as for directories. On the other hand, it does
not affect other functionality, as shown by the reasoning below:

To begin with, the two parts of this condition are mutually
superfluous, because

  1) when top_level < 0, incremental_option == 1
  so the condition yields false
  2) when top_level >= 0, incremental_option == 0
  so the condition yields true.

In other words, it is completely equivalent to

      (!incremental_option)

Now, let's consider the effect of its removal. There are two cases:

1) when incremental_option==1
This means incremental backup in progress. In this case dump_file
is invoked only for directories or for files marked with 'Y' by
get_directory_contents. The latter are those that did not meet the
condition in incremen.c:242, which is exactly the same condition
as this at create.c:1296. So, for these files the check
(!incremental_option) is useless, since the rest of the
conditional will yield false anyway. On the other hand, if
dump_file is invoked on a directory, the conditional will yield
false due to !S_ISDIR assertion, so these will be processed as usual.

Thus, for this case the extra condition (!incremental_option) is
irrelevant, and its removal won't alter the behavior of tar,
*except* that it will enable incremental backups on individual
files, which is the wanted effect.

2) when incremental_option==0
In this case the condition yields true and its removal does not
affect the functionality.
2004-02-21 09:33:58 +00:00
Sergey Poznyakoff
93a4273b66 (start_private_header): Removed static qualifier.
(write_extended): Removed superfluous last argument. Use
xheader_write()
(simple_finish_header): New function.
(finish_header): Use simple_finish_header() to break recursive
dependency between this function and write_extended().
2004-02-20 15:32:12 +00:00
Sergey Poznyakoff
b4e605a829 Added a comment 2004-02-20 11:45:15 +00:00
Sergey Poznyakoff
434f2a22ba (write_extended): Call xheader_xhdr_name
instead of using hardcoded "././@PaxHeader" name.
2004-02-18 14:40:21 +00:00
Sergey Poznyakoff
dd6094f6c0 Updated invocations of safer_name_suffix 2004-01-03 22:25:24 +00:00
Sergey Poznyakoff
2690759c06 (dump_dir0): Bugfix. Thanks Piotr Czerwinski <pius@pld-linux.org> for the patch. 2004-01-03 11:45:31 +00:00
uid65697
f7ce5a4ec5 (dump_file0): Use sys_stat_nanoseconds(). 2003-12-25 10:18:37 +00:00
Sergey Poznyakoff
2632f1c8d2 Update calls to xheader_store 2003-12-01 21:19:16 +00:00
Sergey Poznyakoff
25d9ca1163 (write_gnu_long_link): Use oldgnu magic with @LongLink blocks. 2003-11-25 07:04:45 +00:00
Sergey Poznyakoff
3cdbeffe30 Major rewrite. 2003-11-17 07:36:18 +00:00
Sergey Poznyakoff
8c0a6b24b2 Do not zero-terminate name field if
the name is exactly 100 characters long.
(write_ustar_long_name): Fixed cheking for unsplittable
names.
2003-11-14 12:27:50 +00:00
Sergey Poznyakoff
bc73e3d68d Removed debugging hook 2003-11-14 09:56:11 +00:00
Sergey Poznyakoff
f92c7cf4c8 (start_header): Removed debugging hook
(dump_file): Fixed handling of linkname field.
2003-11-14 09:27:50 +00:00
Sergey Poznyakoff
fe4ee38fce Added POSIX.1-1988 support. 2003-11-13 22:27:09 +00:00
Sergey Poznyakoff
c1b9212b16 Moved system dependencies to system.c 2003-10-04 18:14:32 +00:00
Sergey Poznyakoff
91b2d65e9d Use ngettext where appropriate. 2003-09-05 13:24:15 +00:00
Sergey Poznyakoff
aea0a1d970 Support for "linkpath" extended keyword 2003-09-04 09:37:05 +00:00
Paul Eggert
7653d2f6b8 (write_extended): Remove unused local 'bufsize'. 2003-09-03 06:13:26 +00:00
Sergey Poznyakoff
ce059f3cc8 (start_header): Store long file names
in "path" keyword of an extended header if in POSIX
mode.
(finish_header): print header before calling write_extended().
2003-09-03 00:02:32 +00:00
Sergey Poznyakoff
cb3ec64970 (string_to_chars): New function.
(write_extended): New function
(start_header): Create extended POSIX headers if necessary.
(finish_header): Likewise.
2003-09-01 17:00:26 +00:00
Sergey Poznyakoff
d858a433c8 Use current_stat_info 2003-08-31 22:41:32 +00:00
Sergey Poznyakoff
bee35fc152 /tmp/F 2003-07-27 12:00:31 +00:00
Paul Eggert
ea202e1adf (relativize): Remove; replaced by safer_name_suffix.
All callers changed.
(start_header): Clear devmajor and devminor fields, too.
(finish_header): New arg block_ordinal.
(init_sparsearray): Now extern.  Set sp_array_size to
SPARSES_IN_OLDGNU_HEADER if it is zero.
(dump_file): Keep link table as a hash.
Do not count "file changed as we read it" as a failure.
2003-07-05 06:43:30 +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
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
345eb9f767 (dump_file): no_recurse_option -> ! recursion_option 2000-10-29 05:30:02 +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
ba2ef4d075 Update copyright year. 2000-01-07 23:02:32 +00:00
Paul Eggert
f74454cb37 (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.
2000-01-07 19:25:23 +00:00
Paul Eggert
ed7e2ec8a3 (<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.
1999-12-13 03:07:14 +00:00
Paul Eggert
86b765527a (dump_file): Undo previous change about diagnosing unexpectely missing
files.  Instead, diagnose them a bit better.

Report that a file changed if its ctime changes; this is more
sensitive than mtime+size, and more accurate.
1999-12-03 13:46:09 +00:00
Paul Eggert
3495d84e27 (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.
1999-12-03 13:04:17 +00:00
Paul Eggert
04f1deefad (finish_header): Report block numbers with origin 0, not origin 1. 1999-11-07 22:01:27 +00:00
Paul Eggert
f87e585c51 (to_chars): Remove trailing newline from warning.
(dump_file): Ignore doors.
1999-11-07 21:06:38 +00:00
Paul Eggert
3f3860fd6a (dump_file): Fix typo: last two args to dump_file were interchanged. 1999-10-11 06:56:17 +00:00
Paul Eggert
559eeb2b52 (to_chars): Fix base-256 output. 1999-09-25 05:47:17 +00:00
Paul Eggert
a7002a034e (to_chars): Fix typo in decl.
Don't assign through char const *.
Rename name_expand back to collect_and_sort_names.
1999-09-22 06:14:23 +00:00
Paul Eggert
0d70f547f3 (struct link): Remove unused linkcount member.
(base_64_digits): Move to list.c.
(base_8_digits): Remove.
(to_octal): New function, with some of old contents of to_base.
(to_base): Remove.
(to_base256): New function.
(to_chars): Use base 256, not base 64, for huge values.
(mode_to_chars): Don't use two's complement in GNU format or POSIX format.
(dump_file): Interchange last two arguments.  If TOP_LEVEL is negative,
it means we have an incremental dump where we don't know whether this
is a top-level call.
Use deref_stat instead of statx / stat / lstat.
Cast result of alloca.
Check for dates if 0 < top_level, not if listed_incremental_option.
Move multiple-link check after directory check.
Do not dump avoided names.
Dump hard links to symbolic names as links, not as separate symbolic links.
start_header cannot return a null pointer, so don't test for it.
Likewise for find_next_block.
1999-09-21 15:13:33 +00:00
Paul Eggert
aeef457460 Lint cleanup.
(linklist): Now static.
(to_chars): Fix wording of message to match from_chars.
1999-08-23 09:55:55 +00:00
Paul Eggert
2c3d0a2dcd (to_chars): Generate GNU base-64 representation if we are generating
an old or new GNU format tar file for a number that can't be represented
with the POSIX format.
1999-08-20 08:41:32 +00:00
Paul Eggert
f5116dd1db (write_eot): Write at least two zero blocks. 1999-08-18 07:52:26 +00:00
Paul Eggert
14b1583256 indenting fixes 1999-08-16 08:13:20 +00:00
Paul Eggert
619a95af98 (start_header): Include text of ignored filesystem prefix in warning.
(create_archive): Check for excluded names when doing incremental
pass through directory.
(dump_file): Do not dump old files explicitly given on command line
when using --listed-incremental.  Do not strip ./ from front of file names.
1999-08-14 07:10:19 +00:00
Paul Eggert
36682e50cc (base_64_digits): New constant.
(base_8_digits): New macro.
(MAX_VAL_WITH_DIGITS): New macro.
(to_base): Renamed from to_oct.  Support base 64 too.
New parameters specifying bits per digit and digits.
Remove `type' parameter.  The result is now undefined if it doesn't fit;
it's the caller's responsibility to check this.
(to_chars): Other half of old to_oct, for 64-bit support.
Mostly a new function.
(GID_NOBODY, UID_NOBODY): Don't define if the headers don't.
(gid_substitute, uid_substitute): Look up names dynamically if
GID_NOBODY and UID_NOBODY aren't defined; use -2 if all else fails.
(mode_to_chars): Renamed from mode_to_oct.
Support negative values in all the _to_chars functions.
(start_header): Use FILESYSTEM_PREFIX_LEN instead of MSDOS ifdef.
Abort if archive format is DEFAULT_FORMAT when it shouldn't be.
(dump_file): Inspect entire pathname, not just new file name
component, when deciding whether to exclude it.
1999-08-11 12:47:01 +00:00