202 Commits

Author SHA1 Message Date
Sergey Poznyakoff
fb782b023f Updated 2004-12-20 13:59:15 +00:00
Sergey Poznyakoff
8d44c6b51e Added to the repository 2004-12-20 13:56:41 +00:00
Sergey Poznyakoff
c575787495 Removed 2004-12-20 13:56:31 +00:00
Sergey Poznyakoff
71850c6ab3 Document quicktest.sh 2004-12-20 13:55:37 +00:00
Sergey Poznyakoff
fa87656256 Distribute star/quicktest.sh 2004-12-20 13:55:22 +00:00
Sergey Poznyakoff
7c3510b40d (update_po): Give -r to wget. Always remove index.html
Ignore alloca-opt module (it duplicates alloca)
2004-12-20 13:55:06 +00:00
Sergey Poznyakoff
5f1e6a6a3b Raised version number to 1.15 2004-12-20 13:54:01 +00:00
Sergey Poznyakoff
aa600ee769 Updated 2004-12-18 20:14:34 +00:00
Sergey Poznyakoff
bf2b8556e8 Updated 2004-12-18 20:09:55 +00:00
Sergey Poznyakoff
8263cc7bc0 Added delete05.at 2004-12-18 20:08:56 +00:00
Sergey Poznyakoff
6af2e16b9b Fixed typo in AT_SETUP 2004-12-18 20:08:11 +00:00
Sergey Poznyakoff
664ec232d4 Test deletion of non-existing members 2004-12-18 20:07:59 +00:00
Sergey Poznyakoff
90b1e24487 (decode_options): Ignore --seek if used with --delete.
Delete.c is based on the assumption that the archive is being
actually read, not lseeked.
2004-12-18 20:07:04 +00:00
Sergey Poznyakoff
94f7d4e7c1 Document auto-detection of compressed archive formats. 2004-12-18 20:06:39 +00:00
Sergey Poznyakoff
6323ff0880 Updated 2004-12-18 20:06:18 +00:00
Sergey Poznyakoff
7b29b10847 Updated 2004-12-17 16:12:01 +00:00
Sergey Poznyakoff
e6a67c2eb5 (delete_archive_members): Bugfix: when
attempting to delete an unexisting member, the last
blocking_factor blocks were zeroed.
2004-12-17 16:10:36 +00:00
Paul Eggert
2e7378e819 * TODO: Mention sub-second resolution, lutimes, lchmod. 2004-12-14 19:07:44 +00:00
Paul Eggert
849ec50941 Mention sub-second resolution, lutimes, lchmod. 2004-12-14 19:07:20 +00:00
Paul Eggert
889b8a1046 Remove unnecessary entries from lib/.cvsignore and m4/.cvsignore. 2004-11-28 06:41:15 +00:00
Paul Eggert
2f034ae71b Remove pathmax.h, xstrdup.c. 2004-11-28 06:40:35 +00:00
Paul Eggert
bf8852627a Remove malloc.m4, pathmax.m4, realloc.m4. 2004-11-28 06:40:03 +00:00
Paul Eggert
73b52b1b9b Adjust to recent gnulib changes. 2004-11-28 06:32:01 +00:00
Sergey Poznyakoff
c69d2f6539 Updated 2004-11-26 19:12:09 +00:00
Sergey Poznyakoff
412fbeb90d Updated 2004-11-26 19:10:20 +00:00
Sergey Poznyakoff
322114744f (tar_checksum): New function 2004-11-26 19:09:48 +00:00
Sergey Poznyakoff
b5db978830 (tar_checksum): New function 2004-11-26 19:09:26 +00:00
Sergey Poznyakoff
4674867a23 (hit_eof): Changed type to boolean
(read_full_records,reading_from_pipe): New variables
(check_compressed_archive,open_compressed_archive): New functions
(open_archive): Autodetect compressed archives and act accodingly.
Set reading_from_pipe. This fixes contraversial set of changes
introduced 2004-05-11,2004-03-22.
2004-11-26 19:08:58 +00:00
Sergey Poznyakoff
d5f1626556 Updated 2004-11-26 19:08:25 +00:00
Sergey Poznyakoff
c8b0fd28c2 Concatenate multivolume archives 2004-11-26 19:08:14 +00:00
Sergey Poznyakoff
dcdbe18968 Raised version number to 1.14.91 2004-11-26 19:07:42 +00:00
Sergey Poznyakoff
6c941e0826 Updated 2004-11-26 15:55:32 +00:00
Sergey Poznyakoff
ff989f4b84 Updated 2004-11-16 11:03:05 +00:00
Sergey Poznyakoff
b2a65edf5c Fixed -o semantics. Thanks Jean Delvare <khali@linux-fr.org> 2004-11-16 11:02:45 +00:00
Sergey Poznyakoff
d305c258bf Updated 2004-10-25 15:59:44 +00:00
Sergey Poznyakoff
8ff11f27c1 Use locale_charset() from gnulib 2004-10-25 15:57:48 +00:00
Sergey Poznyakoff
5dee0c1348 (options): Use OPTION_NO_TRANS 2004-10-25 15:57:29 +00:00
Sergey Poznyakoff
b55daca933 (decode_header): Set uname/gname to NULL if their header counterparts are empty 2004-10-25 15:56:57 +00:00
Sergey Poznyakoff
f218c29b13 (LDADD): Add LIBICONV 2004-10-25 15:56:37 +00:00
Sergey Poznyakoff
1625cc5f67 Initialize SUFFIXES and CLEANFILES since the makefile snippet from localcharset uses '+=' on them. 2004-10-25 15:56:20 +00:00
Sergey Poznyakoff
c0f0d25271 Add localcharset 2004-10-25 15:55:59 +00:00
Sergey Poznyakoff
2ab1422c04 Minor fix 2004-10-25 15:55:27 +00:00
Sergey Poznyakoff
53a80edafc Updated 2004-10-25 15:55:11 +00:00
Sergey Poznyakoff
75284507b3 Updated 2004-10-04 09:33:11 +00:00
Sergey Poznyakoff
9b712b0fc8 Added Bryan Ford 2004-10-04 09:32:22 +00:00
Sergey Poznyakoff
d47a177d3d Added argp-help.c 2004-10-04 09:30:17 +00:00
Sergey Poznyakoff
2c7d98238b (.text): Fixed rule 2004-10-04 09:29:25 +00:00
Sergey Poznyakoff
9e2233007c Updated 2004-10-04 09:27:53 +00:00
Sergey Poznyakoff
06742ec624 New function check_cache_directory(),
called from dump_dir0() if exclude_caches_option is set,
to check for a cache directory tag and exclude the directory
if such a tag is found.
2004-10-04 09:27:13 +00:00
Sergey Poznyakoff
5b56886a72 New variable exclude_caches_option. 2004-10-04 09:26:42 +00:00
Sergey Poznyakoff
5db60955f5 New option --exclude-caches, to exclude
cache directories automatically on archive creation.
Cache directories are directories containing a
standardized tag file, as specified at:
	http://www.brynosaurus.com/cachedir/spec.html
2004-10-04 09:26:25 +00:00
Sergey Poznyakoff
52030539f7 Updated 2004-09-16 13:42:32 +00:00
Sergey Poznyakoff
e370518b43 Minor fix 2004-09-16 13:42:22 +00:00
Sergey Poznyakoff
3cb52ac16a Updated 2004-09-12 12:51:37 +00:00
Sergey Poznyakoff
75bf036edc Normalized use of remove_any_file(). 2004-09-12 12:50:31 +00:00
Sergey Poznyakoff
6cf99ce8ae (parse_opt): Emit warning if -l option is used.
(show_default_settings): REMOTE_SHELL may be undefined
2004-09-12 12:50:06 +00:00
Sergey Poznyakoff
ae3238495d Comment WANT_DIRECTORY_REMOVE_OPTION 2004-09-12 12:49:41 +00:00
Sergey Poznyakoff
33491a8d7c Added 'rtapelib.o: localedir.h' dependency 2004-09-12 12:48:54 +00:00
Sergey Poznyakoff
5fd2daf959 Updated 2004-09-07 18:53:08 +00:00
Sergey Poznyakoff
37ac08b3fe Updated 2004-09-07 18:52:03 +00:00
Sergey Poznyakoff
35cae74c4c Rewritten testsuite in autotest 2004-09-07 18:48:13 +00:00
Sergey Poznyakoff
a1c8c7bd47 Updated 2004-09-07 18:43:26 +00:00
Sergey Poznyakoff
71c05b230c Rewritten for autotest 2004-09-07 18:43:17 +00:00
Sergey Poznyakoff
cf2fa13bc5 (argp_program_version): Modified. 2004-09-07 18:43:05 +00:00
Sergey Poznyakoff
7d6865480e Updated for autotest 2004-09-07 18:42:47 +00:00
Sergey Poznyakoff
cadabfc4c7 Updated 2004-09-07 13:27:39 +00:00
Sergey Poznyakoff
6b401f904a Use genfile instead of mksparse 2004-09-07 13:27:22 +00:00
Sergey Poznyakoff
f3f06e8a71 Removed mksparse 2004-09-07 13:27:14 +00:00
Sergey Poznyakoff
8fed513af1 Integrated into (paxutils) genfile.c 2004-09-07 13:27:05 +00:00
Sergey Poznyakoff
00478f4bd3 Integrated into paxutils. 2004-09-07 13:26:41 +00:00
Sergey Poznyakoff
4ad940344a Install genfile.c from paxutils 2004-09-07 13:26:03 +00:00
Sergey Poznyakoff
b5d9942a35 Updated 2004-09-06 14:30:57 +00:00
Sergey Poznyakoff
c0b641f055 Updated 2004-09-06 14:30:21 +00:00
Sergey Poznyakoff
7347b4f5d5 Started merging with cpio into paxutils. 2004-09-06 14:28:55 +00:00
Sergey Poznyakoff
e3bd2a63a6 Updated 2004-09-03 09:22:20 +00:00
Sergey Poznyakoff
430b139592 Do not depend on any particular ordering of output. 2004-09-03 09:19:32 +00:00
Sergey Poznyakoff
06bb349ca9 Updated 2004-09-02 13:54:24 +00:00
Sergey Poznyakoff
2e419759d1 (usage): Minor fix 2004-09-02 13:53:30 +00:00
Sergey Poznyakoff
da3f3e0b3b Install rmt into rmtdir 2004-09-02 13:53:18 +00:00
Sergey Poznyakoff
a0404319e2 ew option --with-rmt. New configuration variable DEFAULT_RMT_DIR. Removed DEFAULT_RMT_COMMAND. 2004-09-02 13:53:03 +00:00
Sergey Poznyakoff
a2a6547e2d Document the use of -C option in file lists. Document --seek option. 2004-09-02 13:52:40 +00:00
Sergey Poznyakoff
5e30076bfd Updated 2004-09-01 15:10:04 +00:00
Sergey Poznyakoff
7c7da5f79f use genfile instead of dd 2004-09-01 15:09:33 +00:00
Sergey Poznyakoff
d1f3689d96 Raised version number to 1.14.90 2004-09-01 15:08:14 +00:00
Sergey Poznyakoff
ac830291f1 Updated 2004-09-01 15:06:09 +00:00
Sergey Poznyakoff
44283eb6ca Added listed02.sh 2004-09-01 15:06:00 +00:00
Sergey Poznyakoff
4ad0f97e2c New test 2004-09-01 15:05:50 +00:00
Sergey Poznyakoff
d14f101217 (register_individual_file,is_individual_file): New functions. 2004-09-01 15:05:28 +00:00
Sergey Poznyakoff
19335cdfb4 (dump_file0): Fix bug introduced 2004-02-21. 2004-09-01 15:05:09 +00:00
Sergey Poznyakoff
4e4e8c57fd (is_individual_file): New prototype 2004-09-01 15:04:46 +00:00
Sergey Poznyakoff
df6161b9fe Updated 2004-08-31 11:57:09 +00:00
Sergey Poznyakoff
33da1b2f64 Updated 2004-08-31 11:51:58 +00:00
Sergey Poznyakoff
28efbf6944 (unquote_string): Unquote '\a' and '\v'. Reported by Helmut Waitzmann <helmut.waitzmann@web.de> 2004-08-31 11:49:28 +00:00
Sergey Poznyakoff
678a4411ea (main): Call set_start_time() 2004-08-31 11:49:03 +00:00
Sergey Poznyakoff
001e5cf813 Fixed initialization of stat_info->is_sparse 2004-08-31 11:48:51 +00:00
Sergey Poznyakoff
fc264a87a8 (set_start_time, removed_prefixes_p): New prototypes. 2004-08-31 11:48:23 +00:00
Sergey Poznyakoff
68bd7ac50a When computing write rate do not take
into account the time needed to verify the archive(s).
The bug reported by John L. Males <jlmales@yahoo.com>
(set_start_time,compute_duration): New functions.
(print_total_written): Use the result of compute_duration().
(close_archive): Call compute_duration.
2004-08-31 11:48:05 +00:00
Sergey Poznyakoff
3f4f5a4bf4 (removed_prefixes_p): New function 2004-08-31 11:47:02 +00:00
Sergey Poznyakoff
e563240b95 (verify_volume): Call set_next_block_after
if read_header returns HEADER_FAILURE
Destroy and reinitialize content of current_stat_info and
extended_header after each iteration.
Issue a warning if the archive created contains some members
whose file names were stripped off their leading prefixes.
This is a temporary fix of the issue reported by Bdale Garbee
<bdale@gag.com> (Refs: Debian bug 230064, Message-Id
<87n07kyzhi.fsf@rover.gag.com>, Sun, 15 Feb 2004 11:22:17 -0700)
2004-08-31 11:45:55 +00:00
Sergey Poznyakoff
6522c25b8d (sparse_add_map): Fixed improper initializations
of sparse_map_size. We assume that whatever number it contains
describes adequately the current size of sparse_map. The only
number we need to reset is sparse_map_avail.
2004-08-31 11:45:16 +00:00
Sergey Poznyakoff
0ec47c16a9 Updated 2004-08-30 15:18:09 +00:00
Sergey Poznyakoff
b1f2c77860 Fix copy-n-paste errors in the license 2004-08-30 15:16:00 +00:00
Sergey Poznyakoff
607c1bf3b4 Updated 2004-08-19 13:13:37 +00:00
Sergey Poznyakoff
74b3e8ab49 Updated 2004-08-19 13:10:01 +00:00
Sergey Poznyakoff
8771e7c560 Renamed LIBPATH to LIBDIR.
New option -a (--all). Do not start restore unless
-a or patterns are given.
(restore_fs,restore_files): Fixed use of --listed option.
2004-08-19 13:09:37 +00:00
Sergey Poznyakoff
1992ef9496 (test_root): Append / to ROOT_FS unless it already ends in it. 2004-08-19 13:09:16 +00:00
Sergey Poznyakoff
73030de19f Renamed LIBPATH to LIBDIR.
Use ROOT_FS with -C option. Do not send mail
if ADMINISTRATOR is set to NONE.
2004-08-19 13:08:43 +00:00
Sergey Poznyakoff
a5f5e75388 Updated 2004-08-17 16:06:05 +00:00
Sergey Poznyakoff
bd599facc8 Fixed typo 2004-08-17 16:05:03 +00:00
Paul Eggert
7f27104062 In bootstrap, set LC_ALL=C and save some more gnulib m4 files. 2004-08-12 20:24:51 +00:00
Paul Eggert
e24d4efed0 Set LC_ALL=C so that file names sort consistently.
Prefer the gnulib copies of gettext.m4, glibc21.m4,
lib-ld.m4, lib-prefix.m4, po.m4 too.
2004-08-12 20:24:13 +00:00
Paul Eggert
a418ef678e Merge argp, getopt, xalloc changes from gnulib. 2004-08-12 18:37:09 +00:00
Paul Eggert
83acd3c604 Remove; gnulib now works unpatched. 2004-08-12 18:35:24 +00:00
Paul Eggert
303132dcdc Adjust to changes to gnulib xalloc module.
(extr_init): Remove assignment to xalloc_fail_func; no longer needed.
(xalloc_die): New function.
2004-08-12 18:34:40 +00:00
Paul Eggert
3848b93af6 Add fnmatch.h, getopt_.h, sysexit.h, xalloc-die.c. 2004-08-12 18:34:18 +00:00
Paul Eggert
93becc4f52 (_getopt_long_only_r): Remove check.
gl_ARGP now does this for us.
2004-08-12 18:33:13 +00:00
Paul Eggert
03092879ac (gnulib_modules): Add xalloc-die. 2004-08-12 18:32:54 +00:00
Sergey Poznyakoff
38f39174f2 Updated 2004-08-10 11:24:25 +00:00
Sergey Poznyakoff
1c0a13aade Added multiv03.sh 2004-08-10 11:17:58 +00:00
Sergey Poznyakoff
2d041189aa (flush_write): Limit filenames
of the members that straddle multivolume archive
boundary to 100 characters.
2004-08-10 11:17:16 +00:00
Sergey Poznyakoff
f6c0aee290 Updated 2004-08-09 11:26:16 +00:00
Sergey Poznyakoff
54e4a0df65 Rearranged leading comments. Added explicit references to original report messages wherever available. 2004-08-09 11:25:15 +00:00
Sergey Poznyakoff
34ff480be9 Added extrac05.sh 2004-08-09 11:24:31 +00:00
Sergey Poznyakoff
260acce7a3 (read_and): Call decode_header before calling skip_member()
(skip_member): Use is_sparse field to determine if the
member is a sparse file.
2004-08-09 11:24:06 +00:00
Sergey Poznyakoff
5a8a98cffe Updated 2004-08-08 14:22:00 +00:00
Sergey Poznyakoff
320298c663 Added link01.sh 2004-08-08 14:21:38 +00:00
Sergey Poznyakoff
4f3e70b0f9 New file 2004-08-08 14:21:07 +00:00
Sergey Poznyakoff
c50565d965 Improved compatibility with 1.13.25 2004-08-08 14:20:17 +00:00
Sergey Poznyakoff
df2c78e32b Extended --update-po option to take an optional argument specifying the po file to update. 2004-08-08 14:19:49 +00:00
Paul Eggert
56389381fc Remove patches/argp.diff; no longer needed. 2004-08-07 06:50:56 +00:00
Paul Eggert
45a6a18d85 Merge from gnulib; mostly FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN. 2004-08-07 06:37:30 +00:00
Paul Eggert
68ff77508c (purge_directory): Fix format buffer typos in warning strings. 2004-08-07 06:33:59 +00:00
Paul Eggert
43ca8709c0 (parse_opt): FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN 2004-08-07 06:33:34 +00:00
Paul Eggert
c4e054673b (excluded_name, safer_name_suffix, stripped_prefix_len):
FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN.
2004-08-07 06:33:07 +00:00
Paul Eggert
df6200e97e (must_be_dot_or_slash): FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN. 2004-08-07 06:32:41 +00:00
Paul Eggert
9ae5a981fc Include <getcwd.h>.
(extract_archive): Rewrite with new macro IS_ABSOLUTE_FILE_NAME.
(make_directories):
FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN.
2004-08-07 06:32:12 +00:00
Paul Eggert
7287be445e Remove addext.c, malloc.c, realloc.c. 2004-08-07 06:31:20 +00:00
Paul Eggert
cafa07d966 Don't use valloc; it's buggy on some GNU/Linux systems, and it returns
storage that can't be freed on older BSD systems.
2004-08-03 04:46:37 +00:00
Paul Eggert
9038410bb7 (valloc): Remove. 2004-08-03 04:45:57 +00:00
Paul Eggert
f3da0c26b8 (quote_n, quote): Remove these redundant functions.
(ptr_align): New function, from coreutils/src/system.h.
(page_aligned_alloc): New function.
2004-08-03 04:45:05 +00:00
Paul Eggert
82eff37f6f (page_aligned_alloc): New decl. 2004-08-03 04:44:39 +00:00
Paul Eggert
6869d0f6b3 (diff_init): Don't use valloc; on older or buggy hosts, you can't
free the result.  Use page_aligned_alloc instead.
2004-08-03 04:44:13 +00:00
Paul Eggert
81460a0349 (record_buffer): New var.
(open_archive): Don't use valloc; on older or buggy hosts, you can't
free the result.  Use page_aligned_alloc instead.
Record the pointer to be freed into record_buffer.
(close_archive): Free record_buffer.
2004-08-03 04:43:38 +00:00
Paul Eggert
ae29dcca87 Add getpagesize.m4. 2004-08-03 04:42:53 +00:00
Paul Eggert
ac7c2b7116 Add getpagesize.h. 2004-08-03 04:42:35 +00:00
Paul Eggert
08cba4e4e5 (valloc): Remove check; valloc no longer used. 2004-08-03 04:42:18 +00:00
Paul Eggert
d81b5d6f1e (gnulib_modules): Add getpagesize. 2004-08-03 04:41:48 +00:00
Paul Eggert
55ec665a41 Add fchown-stub.c 2004-07-10 06:51:38 +00:00
Paul Eggert
4ab8cff6b3 * lib/.cvsignore: Add fchown-stub.c. 2004-07-10 06:51:17 +00:00
Paul Eggert
e4afe72b7a src/extract.c (extract_archive): Do not report an error
when hard-linking X to X when X exists.
2004-07-10 06:14:51 +00:00
Paul Eggert
0a3a9744f7 (extract_archive): Do not report an error
when hard-linking X to X when X exists.
2004-07-10 06:13:28 +00:00
Sergey Poznyakoff
ad548198f3 Added Martin Simmons 2004-06-29 10:17:38 +00:00
Sergey Poznyakoff
4f732c1595 Updated 2004-06-29 10:13:14 +00:00
Sergey Poznyakoff
f94cf6216b (gnu_restore): Renamed to purge_directory().
Do not attempt to purge the directory if it is on a different
device and one_file_system_option is set.
2004-06-29 10:11:46 +00:00
Sergey Poznyakoff
44391cb932 (extr_init): Save the device number
of the root device.
(extract_archive): Renamed gnu_restore() to purge_directory().
2004-06-29 10:11:13 +00:00
Sergey Poznyakoff
af15956c4d (root_device): New global.
(gnu_restore): Renamed to purge_directory().
2004-06-29 10:10:26 +00:00
Sergey Poznyakoff
402b50d4d2 Updated 2004-06-29 10:09:52 +00:00
Sergey Poznyakoff
240a4ed90a Updated 2004-06-25 10:33:06 +00:00
Sergey Poznyakoff
6938706958 The actual default for exclude patterns is --no-anchored. Thanks "Felix Natter" <felix.natter@ldc.de> for noticing. 2004-06-25 10:32:44 +00:00
Sergey Poznyakoff
cd2c8d4fbb The actual default for exclude patterns is --no-anchored. Fixed. 2004-06-25 10:32:27 +00:00
Sergey Poznyakoff
421043b6b1 Updated 2004-06-22 09:30:57 +00:00
Sergey Poznyakoff
24aa94e5cf Fixed docstring for --checkpoint option. 2004-06-22 09:30:32 +00:00
Sergey Poznyakoff
8160c0dae9 Fixed several inconsistencies. 2004-06-22 09:30:01 +00:00
Sergey Poznyakoff
53614b3dff Updated 2004-05-19 14:30:21 +00:00
Sergey Poznyakoff
23c2244ddf Updated 2004-05-19 14:28:20 +00:00
Sergey Poznyakoff
ebdf1bc7a6 Determine type of the archive before appending to it. 2004-05-19 14:27:41 +00:00
Sergey Poznyakoff
ba08e339a6 (struct fmttab): Accept 'pax' as alias
for 'posix'
(options): New option -n (--seek).
2004-05-19 14:27:22 +00:00
Sergey Poznyakoff
951b0370df (skip_file): Use seek_archive() if possible. 2004-05-19 14:26:25 +00:00
Sergey Poznyakoff
167f5ba2bc (seek_archive): New function
(seekable_archive): New global.
2004-05-19 14:25:55 +00:00
Sergey Poznyakoff
488430f739 (seek_archive): New function 2004-05-19 14:25:27 +00:00
Sergey Poznyakoff
80c29e6315 Fix typo 2004-05-19 10:59:25 +00:00
Sergey Poznyakoff
432b157a28 Updated 2004-05-19 10:58:04 +00:00
Sergey Poznyakoff
b121917368 (safer_name_suffix): Fixed bug intraduced 2004-05-11. 2004-05-19 10:57:25 +00:00
Sergey Poznyakoff
fa8cb1895c Updated 2004-05-19 10:35:23 +00:00
Sergey Poznyakoff
64759986a9 Document -H option 2004-05-19 10:34:09 +00:00
Sergey Poznyakoff
d4d6c23008 New option -H (short alias to --format) 2004-05-19 10:33:26 +00:00
Sergey Poznyakoff
325a45f0f1 New option --update-po 2004-05-19 10:32:52 +00:00
Sergey Poznyakoff
f41e484f23 Updated 2004-05-16 20:57:53 +00:00
Sergey Poznyakoff
141d267691 Minor formatting fix 2004-05-16 20:56:05 +00:00
Sergey Poznyakoff
3331593d8d Updated 2004-05-16 20:55:18 +00:00
Sergey Poznyakoff
3344bf9380 Minor fix 2004-05-16 20:51:21 +00:00
Sergey Poznyakoff
463d99453f Fix improper use of 'path' word 2004-05-16 20:50:55 +00:00
Sergey Poznyakoff
d2d5d64cb4 Minor fix. 2004-05-16 20:49:53 +00:00
Sergey Poznyakoff
32ebe16224 Updated 2004-05-16 20:48:14 +00:00
Sergey Poznyakoff
a447fd3714 Use argp for command line parsing. 2004-05-16 20:47:47 +00:00
Sergey Poznyakoff
792965270b Check for _getopt_long_only_r and force using included version of getopt if the function is not available. 2004-05-16 20:47:07 +00:00
Sergey Poznyakoff
916019e417 Added to the repository 2004-05-16 20:46:30 +00:00
Sergey Poznyakoff
3ee93d341e Apply patches from 'patches' subdirectory 2004-05-16 20:46:02 +00:00
Sergey Poznyakoff
dd4cef1699 Added to the repository 2004-05-16 09:04:16 +00:00
Sergey Poznyakoff
8286de0946 Updated. 2004-05-13 08:25:51 +00:00
Sergey Poznyakoff
a65779d558 Renamed strip_path_option to strip_components_option 2004-05-13 08:24:32 +00:00
Sergey Poznyakoff
e1a4fea80d Raised version number to 1.14.1 2004-05-13 08:23:47 +00:00
Sergey Poznyakoff
5608be67f7 Renamed --strip-path to --strip-components
Changed improper use of _() to ngettext().
2004-05-13 08:22:28 +00:00
Sergey Poznyakoff
0a79415a97 Updated 2004-05-11 14:25:18 +00:00
Sergey Poznyakoff
f730b47314 Minor correction 2004-05-11 14:24:50 +00:00
Sergey Poznyakoff
48c24ac711 (decode_options): Fixed typo in the comment. 2004-05-11 14:24:23 +00:00
Sergey Poznyakoff
3e8f210904 (open_archive): Removed assignment to read_full_records_option. 2004-05-11 14:23:25 +00:00
Sergey Poznyakoff
ee56bd0d0b (sys_child_open_for_uncompress): Do not
set read_full_records_option: the compressed archive is
likely not to contain integer number of records. Should
the user wish to use reblocking, he may always give tar
-B option. This is a minor improvement over the change
dated 2004-03-22.
2004-05-11 14:17:28 +00:00
Sergey Poznyakoff
ecb338ad8e (safer_name_suffix): (safer_name_suffix): Use "%s"
as the format argument, rather than a possibly-translated variable
string. Patch provided by Jim Meyering  <jim@meyering.net>
2004-05-11 14:12:39 +00:00
Sergey Poznyakoff
ce486a8fd7 Updated 2004-05-11 13:15:18 +00:00
Sergey Poznyakoff
abba83af27 New file 2004-05-11 13:12:56 +00:00
Sergey Poznyakoff
823f96841c Rewritten. Added rules for generating documentation for the project's website. 2004-05-11 13:10:45 +00:00
96 changed files with 4789 additions and 5526 deletions

View File

@@ -18,4 +18,7 @@ stamp-h1
*.shar.gz
gnulib
gnulib/*
gnulib/*/*
gnulib/*/*
rmt
rmt/*
rmt/*/*

591
ChangeLog
View File

@@ -1,3 +1,575 @@
2004-12-20 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Raised version number to 1.15
* NEWS: Likewise
* directory: Updated
* bootstrap (update_po): Give -r to wget. Always remove index.html
Ignore alloca-opt module (it duplicates alloca)
* tests/Makefile.am: Distribute star/quicktest.sh
* tests/star/README: Document quicktest.sh
* tests/star/qucktest.sh: Removed.
* tests/star/quicktest.sh: New file.
2004-12-18 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* NEWS: Updated
* doc/tar.texi: Document auto-detection of compressed archive
formats.
* src/tar.c (decode_options): Ignore --seek if used with --delete.
Delete.c is based on the assumption that the archive is being
actually read, not lseeked.
* tests/delete05.at: New file
* tests/extrac02.at: Fixed typo in AT_SETUP
* tests/Makefile.am: Added delete05.at
* tests/testsuite.at: Likewise.
2004-12-17 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/delete.c (delete_archive_members): Bugfix: when
attempting to delete an unexisting member, the last
blocking_factor blocks were zeroed.
2004-12-14 Paul Eggert <eggert@cs.ucla.edu>
* TODO: Mention sub-second resolution, lutimes, lchmod.
2004-11-27 Paul Eggert <eggert@cs.ucla.edu>
Adjust to recent gnulib changes.
* doc/getdate.texi: Remove, since bootstrap gets it from gnulib now.
* .cvsignore: Add rmt, rmt/*, rmt/*/*.
* lib/.cvsignore: Add allocsa.c, allocsa.h, allocsa.valgrind,
charset.alias, config.charset, getcwd.c, getcwd.h, localcharset.c,
localcharset.h, ref-add.sed, ref-add.sin, ref-del.sed,
ref-del.sin, setenv.c, setenv.h, unsetenv.c. Remove pathmax.h,
xstrdup.c.
* m4/.cvsignore: Add allocsa.m4, eealloc.m4, getcwd-path-max.m4,
localcharset.m4, realloc.m4, setenv.m4. Remove malloc.m4,
pathmax.m4, realloc.m4.
2004-11-26 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Raised version number to 1.14.91
* scripts/tarcat: New file
* scripts/Makefile.am: Added tarcat
* src/buffer.c (hit_eof): Changed type to boolean
(read_full_records,reading_from_pipe): New variables
(check_compressed_archive,open_compressed_archive): New functions
(open_archive): Autodetect compressed archives and act accodingly.
Set reading_from_pipe. This fixes contraversial set of changes
introduced 2004-05-11,2004-03-22.
* src/list.c (tar_checksum): New function
(read_header): Use tar_checksum().
* src/common.h (tar_checksum): New function
* tests/star/README: Updated
* NEWS: Updated
* PORTS: Updated
2004-11-16 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/tar.c (decode_options): Fixed -o semantics. Thanks
Jean Delvare <khali@linux-fr.org>
2004-10-25 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* bootstrap: Add localcharset
* lib/Makefile.tmpl: Initialize SUFFIXES and CLEANFILES since the
makefile snippet from localcharset uses '+=' on them.
* src/Makefile.am (LDADD): Add LIBICONV
* src/list.c (decode_header): Set uname/gname to NULL if their
header counterparts are empty
* src/tar.c (options): Use OPTION_NO_TRANS
* src/utf8.c: Use locale_charset() from gnulib
* tests/star/README: Updated
* NEWS: Updated
* TODO: Minor fix
2004-10-04 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* THANKS: Added Bryan Ford
* doc/Makefile.am (.text): Fixed rule
* po/POTFILES.in: Added argp-help.c
2004-10-04 Bryan Ford <baford@mit.edu>
* src/tar.c: New option --exclude-caches, to exclude
cache directories automatically on archive creation.
Cache directories are directories containing a
standardized tag file, as specified at:
http://www.brynosaurus.com/cachedir/spec.html
* src/common.h: New variable exclude_caches_option.
* src/create.c: New function check_cache_directory(),
called from dump_dir0() if exclude_caches_option is set,
to check for a cache directory tag and exclude the directory
if such a tag is found.
* doc/tar.texi: Updated accordingly.
2004-09-16 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* doc/tar.texi: Minor fix
* src/tar.c (options): Minor fix
2004-09-12 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* TODO: Updated
* lib/Makefile.tmpl: Added 'rtapelib.o: localedir.h' dependency
* src/common.h: Comment WANT_DIRECTORY_REMOVE_OPTION.
* src/extract.c: Normalized use of remove_any_file().
* src/misc.c: Likewise.
* src/tar.c (parse_opt): Emit warning if -l option is used.
(show_default_settings): REMOTE_SHELL may be undefined
2004-09-07 Sergey Poznyakoff <gray@Mirddin.farlep.net>
Test suite rewritten in autotest.
* configure.ac: Updated for autotest
* src/tar.c (argp_program_version): Modified.
* tests/Makefile.am: Rewritten for autotest.
* tests/.cvsignore: Updated
* tests/append.at: New file
* tests/atlocal.in: New file
* tests/delete01.at: New file
* tests/delete02.at: New file
* tests/delete03.at: New file
* tests/delete04.at: New file
* tests/extrac01.at: New file
* tests/extrac02.at: New file
* tests/extrac03.at: New file
* tests/extrac04.at: New file
* tests/extrac05.at: New file
* tests/gzip.at: New file
* tests/ignfail.at: New file
* tests/incremental.at: New file
* tests/link01.at: New file
* tests/listed01.at: New file
* tests/listed02.at: New file
* tests/longv7.at: New file
* tests/multiv01.at: New file
* tests/multiv02.at: New file
* tests/multiv03.at: New file
* tests/old.at: New file
* tests/options.at: New file
* tests/recurse.at: New file
* tests/same-order01.at: New file
* tests/same-order02.at: New file
* tests/sparse01.at: New file
* tests/testsuite.at: New file
* tests/version.at: New file
* tests/volume.at: New file
* tests/star/gtarfail.at: New file
* tests/star/gtarfail2.at: New file
* tests/star/multi-fail.at: New file
* tests/star/pax-big-10g.at: New file
* tests/star/ustar-big-2g.at: New file
* tests/star/ustar-big-8g.at: New file
* tests/preset.in: Removed
* tests/before: Removed
* tests/after: Removed
* tests/version.sh: Removed.
* tests/append.sh: Removed.
* tests/delete01.sh: Removed.
* tests/delete02.sh: Removed.
* tests/delete03.sh: Removed.
* tests/delete04.sh: Removed.
* tests/extrac01.sh: Removed.
* tests/extrac02.sh: Removed.
* tests/extrac03.sh: Removed.
* tests/extrac04.sh: Removed.
* tests/extrac05.sh: Removed.
* tests/gzip.sh: Removed.
* tests/incremen.sh: Removed.
* tests/ignfail.sh: Removed.
* tests/link01.sh: Removed.
* tests/listed01.sh: Removed.
* tests/listed02.sh: Removed.
* tests/longv7.sh: Removed.
* tests/multiv01.sh: Removed.
* tests/multiv02.sh: Removed.
* tests/multiv03.sh: Removed.
* tests/old.sh: Removed.
* tests/options.sh: Removed.
* tests/same-order01.sh: Removed.
* tests/same-order02.sh: Removed.
* tests/volume.sh: Removed.
* tests/recurse.sh: Removed.
* tests/sparse01.sh: Removed.
* tests/star/gtarfail.sh: Removed.
* tests/star/gtarfail2.sh: Removed.
* tests/star/multi-fail.sh: Removed.
* tests/star/ustar-big-2g.sh: Removed.
* tests/star/ustar-big-8g.sh: Removed.
* tests/star/pax-big-10g.sh: Removed.
2004-09-07 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* bootstrap: Install genfile.c from paxutils
* tests/genfile.c: Removed. Integrated into
paxutils.
* tests/mksparse.c: Removed. Integrated into
(paxutils) genfile.c
* tests/Makefile.am: Removed mksparse
* tests/sparse01.sh: Use genfile instead of mksparse
2004-09-06 Sergey Poznyakoff <gray@Mirddin.farlep.net>
Started merging with cpio into paxutils. Sources before
this point are tagged alpha-1_14_90
* Makefile.am: Updated for use with paxutils
* README-alpha: Likewise
* bootstrap: Likewise
* configure.ac: Likewise
* lib/Makefile.tmpl: Likewise
* po/POTFILES.in: Likewise
* src/Makefile.am: Likewise
* src/buffer.c: Likewise
* src/common.h: Likewise
* src/compare.c: Likewise
* src/create.c: Likewise
* src/delete.c: Likewise
* src/extract.c: Likewise
* src/incremen.c: Likewise
* src/list.c: Likewise
* src/mangle.c: Likewise
* src/misc.c: Likewise
* src/names.c: Likewise
* src/sparse.c: Likewise
* src/system.c: Likewise
* src/tar.c: Likewise
* src/update.c: Likewise
* src/utf8.c: Likewise
* src/xheader.c: Likewise
* src/system.h: Removed
* src/rmt.c: Removed
* src/rmt.h: Removed
* src/rtapelib.c: Removed
2004-09-03 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* tests/listed02.sh: Do not depend on any particular ordering
of output.
2004-09-02 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* doc/tar.texi: Document the use of -C option in
file lists. Document --seek option.
* configure.ac: New option --with-rmt. New configuration variable
DEFAULT_RMT_DIR. Removed DEFAULT_RMT_COMMAND.
* src/Makefile.am: Install rmt into rmtdir
* src/tar.c (usage): Minor fix.
* NEWS: Updated.
* README: Updated.
2004-09-01 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Raised version number to 1.14.90
* src/common.h (is_individual_file): New prototype
* src/create.c (dump_file0): Fix bug introduced
2004-02-21.
* src/names.c (register_individual_file)
(is_individual_file): New functions.
* tests/listed01.sh: Use genfile instead of dd.
* tests/listed02.sh: New file.
* tests/Makefile.am: Added listed02.sh
* NEWS: Updated
2004-08-31 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/sparse.c (sparse_add_map): Fixed improper initializations
of sparse_map_size. We assume that whatever number it contains
describes adequately the current size of sparse_map. The only
number we need to reset is sparse_map_avail.
* src/compare.c (verify_volume): Call set_next_block_after
if read_header returns HEADER_FAILURE
Destroy and reinitialize content of current_stat_info and
extended_header after each iteration (bug reported by
John L. Males <jlmales@yahoo.com>).
Issue a warning if the created archive contains some members
whose file names were stripped off their leading prefixes.
This is a temporary fix of the issue reported by Bdale Garbee
<bdale@gag.com> (Refs: Debian bug 230064, Message-Id
<87n07kyzhi.fsf@rover.gag.com>, Sun, 15 Feb 2004 11:22:17 -0700)
* src/names.c (removed_prefixes_p): New function.
* src/buffer.c: When computing write rate do not take
into account the time needed to verify the archive(s).
The bug reported by John L. Males <jlmales@yahoo.com>
(set_start_time,compute_duration): New functions.
(print_total_written): Use the result of compute_duration().
(close_archive): Call compute_duration.
* src/common.h (set_start_time, removed_prefixes_p): New prototypes.
* src/list.c (decode_header): Fixed initialization
of stat_info->is_sparse
* src/tar.c (main): Call set_start_time().
* src/misc.c (unquote_string): Unquote '\a' and '\v'.
Reported by Helmut Waitzmann <helmut.waitzmann@web.de>.
* NEWS: Updated
* THANKS: Updated
2004-08-30 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/tar.c: Fix copy-n-paste errors in the license
2004-08-19 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* scripts/backup.in: Renamed LIBPATH to LIBDIR.
Use ROOT_FS with -C option. Do not send mail
if ADMINISTRATOR is set to NONE.
* scripts/backup.sh.in (test_root): Append / to
ROOT_FS if it does not already end in it.
* scripts/restore.in: Renamed LIBPATH to LIBDIR.
New option -a (--all). Do not start restore unless
-a or patterns are given.
(restore_fs,restore_files): Fixed use of --listed option.
* doc/tar.texi: Updated
* NEWS: Updated
2004-08-17 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/tar.c (find_argp_option): Fixed typo
2004-08-12 Paul Eggert <eggert@cs.ucla.edu>
Merge argp, getopt, xalloc changes from gnulib.
* bootstrap (gnulib_modules): Add xalloc-die.
Remove code to test for patches; we don't have patches now.
Set LC_ALL=C so that file names sort consistently.
Prefer the gnulib copies of gettext.m4, glibc21.m4,
lib-ld.m4, lib-prefix.m4, po.m4 too.
* patches/getopt.diff: Remove; gnulib now works unpatched.
* configure.ac (_getopt_long_only_r): Remove check.
gl_ARGP now does this for us.
* lib/.cvsignore: Add fnmatch.h, getopt_.h, sysexit.h,
xalloc-die.c.
* src/extract.c: Adjust to changes to gnulib xalloc module.
(extr_init): Remove assignment to xalloc_fail_func; no longer needed.
(xalloc_die): New function.
2004-08-10 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* NEWS: Updated
* src/buffer.c (flush_write): Limit filenames
of the members that straddle multivolume archive
boundary to 100 characters.
(flush_read): Use strncmp when comparing multivolume member
names.
* tests/multiv03.sh: New file
* tests/Makefile.am: Added multiv03.sh
2004-08-09 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/list.c (read_and): Call decode_header before
calling skip_member()
(skip_member): Use is_sparse field to determine if the
member is a sparse file.
* tests/Makefile.am: Added extrac05.sh
* tests/extrac05.sh: New file
* tests/append.sh: Rearranged leading comments. Added explicit
references to report messages wherever available.
* tests/delete01.sh: Likewise
* tests/delete02.sh: Likewise
* tests/delete03.sh: Likewise
* tests/delete04.sh: Likewise
* tests/extrac01.sh: Likewise
* tests/extrac02.sh: Likewise
* tests/extrac03.sh: Likewise
* tests/extrac04.sh: Likewise
* tests/gzip.sh: Likewise
* tests/ignfail.sh: Likewise
* tests/incremen.sh: Likewise
* tests/link01.sh: Likewise
* tests/listed01.sh: Likewise
* tests/longv7.sh: Likewise
* tests/multiv01.sh: Likewise
* tests/multiv02.sh: Likewise
* tests/old.sh: Likewise
* tests/options.sh: Likewise
* tests/recurse.sh: Likewise
* tests/same-order01.sh: Likewise
* tests/same-order02.sh: Likewise
* tests/sparse01.sh: Likewise
* tests/version.sh: Likewise
* tests/volume.sh: Likewise
2004-08-08 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* bootstrap: Extended --update-po option to take an
optional argument specifying the po file to update.
* src/create.c: Improved compatibility with 1.13.25
* tests/link01.sh: New file.
* tests/Makefile.am: Added link01.sh
2004-08-06 Paul Eggert <eggert@cs.ucla.edu>
Merge from gnulib.
* patches/argp.diff: Remove; no longer needed.
* lib/.cvsignore: Add stat-macros.h.
Remove addext.c, malloc.c, realloc.c.
* src/extract.c: Include <getcwd.h>.
(extract_archive): Rewrite with new macro IS_ABSOLUTE_FILE_NAME.
* src/extract.c (make_directories):
FILESYSTEM_PREFIX_LEN -> FILE_SYSTEM_PREFIX_LEN.
* src/misc.c (must_be_dot_or_slash): Likewise.
* src/names.c (excluded_name, safer_name_suffix, stripped_prefix_len):
Likewise.
* src/tar.c (parse_opt): Likewise.
* src/incremen.c (purge_directory): Fix format buffer typos in warning
strings.
* src/tar.c (options): Add missing initializers to pacify gcc.
(decode_options): Remove unused var.
2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
* bootstrap (gnulib_modules): Add getpagesize.
* configure.ac (valloc): Remove check; valloc no longer used.
* lib/.cvsignore: Add getpagesize.h.
* m4/.cvsignore: Add getpagesize.m4.
* src/buffer.c (record_buffer): New var.
(open_archive): Don't use valloc; on older or buggy hosts, you can't
free the result. Use page_aligned_alloc instead.
* src/compare.c (diff_init): Likewise.
* src/buffer.c (open_archive): Record the pointer to be freed
into record_buffer.
(close_archive): Free record_buffer.
* src/common.h (page_aligned_alloc): New decl.
* src/misc.c (quote_n, quote): Remove these redundant functions.
(ptr_align): New function, from coreutils/src/system.h.
(page_aligned_alloc): New function.
* src/system.h (valloc): Remove.
2004-07-09 Paul Eggert <eggert@cs.ucla.edu>
* src/extract.c (extract_archive): Do not report an error
when hard-linking X to X when X exists. Problem reported by
Toby Peterson.
* lib/.cvsignore: Add fchown-stub.c.
2004-06-29 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* NEWS: Updated
* src/common.h (root_device): New global.
(gnu_restore): Renamed to purge_directory().
* src/extract.c (extr_init): Save the device number
of the root device.
(extract_archive): Renamed gnu_restore() to purge_directory().
* src/incremen.c (gnu_restore): Renamed to purge_directory().
Do not attempt to purge the directory if it is on a different
device and one_file_system_option is set.
2004-06-25 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* doc/tar.texi: The actual default for exclude patterns
is --no-anchored. Fixed.
* src/tar.c (options): Likewise.
Thanks "Felix Natter" <felix.natter@ldc.de> for noticing.
2004-06-22 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* doc/tar.texi: Fixed several inconsistencies.
* src/tar.c: Fixed docstring for --checkpoint option.
2004-05-19 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/buffer.c (seek_archive): New function
* src/common.h (seek_archive): New function
(seekable_archive): New global.
* src/list.c (skip_file): Use seek_archive() if
possible.
* src/tar.c (struct fmttab): Accept 'pax' as alias
for 'posix'
(options): New option -n (--seek).
* src/update.c: Determine type of the archive before
appending to it.
* TODO: Updated.
2004-05-19 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* bootstrap: New option --update-po
* src/tar.c: New option -H (short alias to --format)
* doc/tar.texi: Document -H option
* src/names.c (safer_name_suffix): Fixed bug introduced
2004-05-11.
2004-05-16 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* bootstrap: Apply patches from patch subdirectory
* patches: New dir
* patches/argp.diff: New file
* patches/getopt.diff: New file
* configure.ac: Check for _getopt_long_only_r and
force using included version of getopt if the function
is not available.
* src/tar.c: Use argp for command line parsing.
* src/system.h: Minor formatting fix
* m4/.cvsignore: Updated
* lib/.cvsignore: Updated
* doc/tar.texi: Minor fix.
* src/extract.c: Fix improper use of 'path' term
* src/incremen.c: Likewise
* src/list.c: Likewise
* src/misc.c: Likewise
* src/names.c: Likewise
* src/rmt.h: Likewise
* src/rtapelib.c: Likewise
* src/update.c: Likewise
* src/xheader.c: Likewise
* tests/star/README: Minor fix
2004-05-13 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Raised version number to 1.14.1
* src/tar.c: Renamed --strip-path to --strip-components
Changed improper use of _() to ngettext().
* src/extract.c: Renamed strip_path_option to strip_components_option
* src/common.h: Likewise.
* NEWS: Updated.
* doc/tar.texi: Updated
2004-05-11 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* src/system.c (sys_child_open_for_uncompress): Do not
set read_full_records_option: the compressed archive is
likely not to contain integer number of records. Should
the user wish to use reblocking, he may always give tar
-B option. This is a minor improvement over the change
dated 2004-03-22.
* src/buffer.c (open_archive): Removed assignment to
read_full_records_option.
* src/names.c (safer_name_suffix): (safer_name_suffix): Use "%s"
as the format argument, rather than a possibly-translated variable
string. Patch provided by Jim Meyering <jim@meyering.net>
* src/tar.c (decode_options): Fixed typo in the comment.
* tests/star/README: Minor correction
2004-05-11 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* directory: New file. GNU directory entry for tar.
* doc/Makefile.am: Rewritten. Added rules for generating
documentation for the project's website.
* doc/.cvsignore: Updated
* doc/index.html.in: New file.
2004-05-11 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Raised version number to 1.14
@@ -8,7 +580,7 @@
Tar 1.14 is released. Sources up to this point are tagged
release_1_14
2004-05-10 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Fixed prerequisite headers for sys/buf.h
@@ -39,7 +611,7 @@
* src/list.c (read_and): Print block number before
issuing 'Skipping to next header' diagnostics, if
requested by block_number_option.
* src/rtapelib.c: Use rmt_command_option instead of
* src/rtapelib.c: Use rmt_command_option instead of
hardcoded "/etc/rmt".
* src/tar.c: New option --rmt-command.
(decode_options): Handle --rmt-command. Initialize
@@ -97,7 +669,7 @@
* tests/star/ustar-big-8g.sh: Likewise
* doc/.cvsignore: Updated
2004-05-06 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Check whether date accepts +format argument
@@ -112,7 +684,7 @@
* scripts/backup-specs: Updated
* scripts/Makefile.am: Updated for new directory contents.
* scripts/.cvsignore: Updated
2004-05-05 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* TODO: Updated
@@ -134,7 +706,7 @@
* lib/.cvsignore: Updated
* m4/.cvsignore: Updated
* src/xheader.c: Include stpcpy.h
* src/create.c: Produce an error, not warning, if the
filename is too long.
* tests/longv7.sh: Synchronized with the recent changes.
@@ -142,7 +714,7 @@
2004-04-20 Sergey Poznyakoff <gray@Mirddin.farlep.net>
* configure.ac: Fixed test for iconv_t
* src/rmt.h: Bugfix by J<>rgen Weigert
* src/rmt.h: Bugfix by J<>rgen Weigert
* THANKS: Add J<>rgen Weigert
* tests/star/README: Fixed typo
@@ -5199,7 +5771,7 @@
See ChangeLog.1 for earlier changes.
Copyright (C) 1997, 1998, 1999, 2000, 2001, 2003, 2004 Free Software
Foundation, Inc.
@@ -5219,3 +5791,8 @@ You should have received a copy of the GNU General Public License
along with GNU tar; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Local Variables:
mode: change-log
version-control: never
End:

View File

@@ -20,4 +20,5 @@
ACLOCAL_AMFLAGS = -I m4
EXTRA_DIST = ChangeLog.1 PORTS
SUBDIRS = doc lib src scripts po tests
SUBDIRS = doc lib rmt src scripts po tests

97
NEWS
View File

@@ -5,7 +5,68 @@ See the end for copying conditions.
Please send GNU tar bug reports to <bug-tar@gnu.org>
version 1.15 - Sergey Poznyakoff, 2004-12-20
* Compressed archives are recognised automatically, it is no longer
necessary to specify -Z, -z, or -j options to read them. Thus, you can
now run `tar tf archive.tar.gz'.
* When restoring incremental dumps, --one-file-system option
prevents directory hierarchies residing on different devices
from being purged.
With the previous versions of tar it was dangerous to create
incremental dumps with --one-file-system option, since they
would recursively remove mount points when restoring from the
back up. This change fixes the bug.
* Renamed --strip-path to --strip-components for consistency with
the GNU convention.
* Skipping archive members is sped up if the archive media supports
seeks.
* Restore script starts restoring only if it is given --all (-a) option,
or some patterns. This is to prevent accidental restores.
* `tar --verify' prints a warning if during archive creation some of
the file names had their prefixes stripped off.
* New option --exclude-caches instructs tar to exclude cache directories
automatically on archive creation. Cache directories are those
containing a standardized tag file, as specified at:
http://www.brynosaurus.com/cachedir/spec.html
* New configure option --with-rmt allows to specify full path name to
the `rmt' utility. This supercedes DEFAULT_RMT_COMMAND variable
introduced in version 1.14
* New configure variable DEFAULT_RMT_DIR allows to specify the directory
where to install `rmt' utility. This is necessary since modifying
--libexecdir as was suggested for version 1.14 produced a side effect: it
also modified installation prefix for backup scripts (if
--enable-backup-scripts was given).
* Bugfixes:
** Fixed flow in recognizing files to be included in incremental dumps.
** Correctly recognize sparse archive members when used with -T option.
** GNU multivolume headers cannot store filenames longer than 100 characters.
Do not allow multivolume archives to begin with such filenames.
** If a member with link count > 2 was stored in the archive twice,
previous versions of tar were not able to extract it, since they
were trying to link the file to itself, which always failed and
lead to removing the already extracted copy. Preserve the first
extracted copy in such cases.
** Restore script was passing improper argument to tar --listed option (which
didn't affect the functionality, but was logically incorrect).
** Fixed verification of created archives.
** Fixed unquoting of file names containing backslash escapes (previous
versions failed to recognize \a and \v).
** When attempting to delete a non-existing member from the archive, previous
versions of tar used to overwrite last archive block with zeroes.
version 1.14 - Sergey Poznyakoff, 2004-05-11
* Added support for POSIX.1-2001 and ustar archive formats.
@@ -81,28 +142,34 @@ tar.
* Bug fixes.
version 1.13.25 - Paul Eggert, 2001-09-26
* Bug fixes.
version 1.13.24 - Paul Eggert, 2001-09-22
* New option --overwrite-dir.
* Fixes for buffer overrun, porting, and copyright notice problems.
* The message translations for Korean are available again.
version 1.13.23 - Paul Eggert, 2001-09-13
* Bug, porting, and copyright notice fixes.
version 1.13.22 - Paul Eggert, 2001-08-29
* Bug fixes.
version 1.13.21 - Paul Eggert, 2001-08-28
* Porting and copyright notice fixes.
version 1.13.20 - Paul Eggert, 2001-08-27
* Some bugs were fixed:
@@ -129,6 +196,7 @@ version 1.13.20 - Paul Eggert, 2001-08-27
The translation for Korean has been withdrawn due to encoding errors.
It will be reissued once those are fixed.
version 1.13.19 - Paul Eggert, 2001-01-13
* The -I option has been withdrawn, as it was buggy and confusing.
@@ -137,6 +205,7 @@ version 1.13.19 - Paul Eggert, 2001-01-13
* With an option like -N DATE, if DATE starts with "/" or ".", it is taken
to be a file name; the last-modified time of that file is used as the date.
version 1.13.18 - Paul Eggert, 2000-10-29
* Some security problems have been fixed. `tar -x' now modifies only
@@ -167,11 +236,13 @@ version 1.13.18 - Paul Eggert, 2000-10-29
* `tar --delete -f -' now works again.
version 1.13.17 - Paul Eggert, 2000-01-07.
* `tar --delete -f -' is no longer allowed; it was too buggy.
* Diagnostic messages have been made more regular and consistent.
version 1.13.16 - Paul Eggert, 1999-12-13.
* By default, tar now refuses to overwrite an existing file when
@@ -215,17 +286,20 @@ version 1.13.16 - Paul Eggert, 1999-12-13.
* tar now ignores socket files when creating an archive.
Previously tar archived sockets as fifos, which caused problems.
version 1.13.15 - Paul Eggert, 1999-12-03.
* If a file's ctime changes when being archived, report an error.
Previously tar looked at mtime, which missed some errors.
version 1.13.14 - Paul Eggert, 1999-11-07.
* New translations ja, pt_BR.
* New options --help and --version for rmt.
* Ignore Solaris door files when creating an archive.
version 1.13.13 - Paul Eggert, 1999-10-11.
* Invalid headers in tar files now elicit errors, not just warnings.
@@ -233,6 +307,7 @@ version 1.13.13 - Paul Eggert, 1999-10-11.
* If you specify an invalid date, `tar' now substitutes (time_t) -1.
* `configure --with-dmalloc' is no longer available.
version 1.13.12 - Paul Eggert, 1999-09-24.
* `tar' now supports hard links to symbolic links.
@@ -263,7 +338,7 @@ version 1.13.12 - Paul Eggert, 1999-09-24.
* Some diagnostics have been reworded for consistency.
version 1.13.11 - Paul Eggert, 1999-08-23.
* The short name of the --bzip option has been changed to -I,
@@ -283,14 +358,14 @@ version 1.13.11 - Paul Eggert, 1999-08-23.
numeric UTC offsets like `-0500' instead of abbreviations like
`EST', as abbreviations are not standardized and are ambiguous.
version 1.13.10 - Paul Eggert, 1999-08-20.
* `tar' now uses signed base-64 when outputting header values that are
out of the range of the standard unsigned base-8 format. [This
change was superseded in 1.13.12, described above.]
version 1.13.9 - Paul Eggert, 1999-08-18.
* `tar' now writes two zero blocks at end-of-archive instead of just one.
@@ -302,14 +377,14 @@ version 1.13.9 - Paul Eggert, 1999-08-18.
* `tar' now reads buggy tar files that have a null byte at the start of a
numeric header field.
version 1.13.8 - Paul Eggert, 1999-08-16.
* For compatibility with traditional `tar', intermediate directories
created automatically by root are no longer given the uid and gid of
the original file or directory.
version 1.13.7 - Paul Eggert, 1999-08-14.
* --listed-incremental and --newer are now incompatible options.
@@ -319,7 +394,7 @@ version 1.13.7 - Paul Eggert, 1999-08-14.
* --diff without --absolute-names no longer falls back on absolute names.
version 1.13.6 - Paul Eggert, 1999-08-11.
* An --exclude pattern containing / now excludes a file only if it matches an
@@ -346,30 +421,30 @@ version 1.13.6 - Paul Eggert, 1999-08-11.
* New option -y or --bzip2 for bzip2 compression, by popular request.
version 1.13.5 - Paul Eggert, 1999-07-20.
* Do the delayed updates of file metadata even after a fatal error.
version 1.13.4 - Paul Eggert, 1999-07-20.
* Do not chmod unless we are root or the -p option was given;
this matches historical practice.
version 1.13.3 - Paul Eggert, 1999-07-16.
* A path name is excluded if any of its file name components matches an
excluded pattern, even if the path name was specified on the command line.
Also see 1.13.6 for later changes in this area.
version 1.13.2 - Paul Eggert, 1999-07-14.
* Bug reporting address changed to <bug-tar@gnu.org>.
version 1.13.1 - Paul Eggert, 1999-07-12.
* Bug fixes only.

288
PORTS
View File

@@ -1,14 +1,151 @@
* Ports of GNU tar and other tars -*- outline -*-
Ports of GNU tar and other tars
See the end of file for copying conditions.
Many entries in this file are out of date, unfortunately.
* Introduction
Most entries in this file are out of date, unfortunately. Such
entries are marked with an `X'. Run grep '^\*\*[^X]' PORTS to
extract valid entries.
Please write bug-tar@gnu.org if you are aware of various ports of GNU tar
to non-GNU and non-Unix systems not listed here, or for corrections.
Please provide the goal system, a complete and stable URL, the maintainer
name and address, the tar version used as a base, and your comments.
.* Copyright notice
* GNU/Linux and Unix
Copyright (C) 1999, 2001, 2003 Free Software Foundation, Inc.
** Star is a tape archiver similar to tar.
<http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/star.html>
* Amiga
**X ftp://ftp.wustl.edu/systems/amiga/aminet/util/arc/GNUtar-1.11.8.lha
maintained by Enrico Forestieri <enrico@com.unipr.it>
Based on tar 1.11.8.
**X ftp://ftp.ninemoons.com/pub/ade/current/amiga-bin/tar-1.11.8-bin.lha
maintained by the ADE group <fnf@fishpond.ninemoons.com>
Based on tar 1.11.8, needs ixemul.library.
**X ftp://ftp.wustl.edu/systems/amiga/aminet/util/arc/gnutar.lha
maintained by <mscheler@wuarchive.wustl.edu>
* DEC alpha (NT)
**X ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
* DEC VAX (VMS)
**X http://www.lp.se/free/vmstar/
maintained by Richard Levitte <levitte@lp.se>
This is not GNU tar, but a separate implementation.
** maintained by William Bader <william@nscs.fast.net>
For V4.7. Based on an old PDtar. Requires compatible shared libraries
to run V5 or V6 executables.
* IBM/PC (DV/X)
**X ftp://qdeck.com/ (?)
maintained by David Ronis <ronis@gibbs.chem.mcgill.ca>
For Desqview/X. Everything works besides compression. Copy of hacked
sources available, some of DV/X's programmer's library also needed.
* IBM/PC (MSDOS)
**X http://www.simtel.net/simtel.net/
http://www.leo.org/pub/comp/platforms/pc/gnuish (Germany)
ftp://ftp.simtel.net/simtelnet/gnu
ftp://ftp.leo.org/pub/comp/platforms/pc/gnuish
maintained by Darrel Hankerson <hankedr@mail.auburn.edu>
You get many GNU tools, not only `tar'. The GNUish project is described
in `gnuish_t.htm'.
** The DJGPP development tools also include some `tar' utilities.
**X ftp://ftp.mcs.com/mcsnet.users/les/dos-gnutar/
maintained by Leslie Mikesell <les@mcs.net>
Based on tar 1.11.2. Support for SCSI (via ASPI) and network (rsh over
packet driver). No support for win95 long file names.
**X ftp://ftp.wu-wien.ac.at/pub/src/PCmisc/aspi-tar/*
maintained by Christoph Splittgerber <chris@orion.sdata.de>
Based on tar 1.10. Support for SCSI (via ASPI).
**X ftp://wuarchive (?)
Several DOS version based on PDtar. John Gilmore <gnu@toad.com> says
he has copies of several vintages saved.
**X ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.exe
ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.taz
ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.zip
**X ftp://ftp.cdrom.com/.4/os2/archiver/tar.zip
Based on PDtar.
**X ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
GNU tar for NT (intel and Alpha platforms).
** ftp://garbo.uwasa.fi/pc/unix/untgz095.zip
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
The `untgz' program is a fast .tar or .tar.gz (.tgz) extractor.
**X http://people.darmstadt.netsurf.de/tst/tar.htm
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
This is not a `tar' port, but an index of them.
* IBM/PC (OS/2)
**X http://www.leo.org/pub/comp/os/os2/leo/gnu/archiver/gtar254.zip
http://www.leo.org/pub/comp/os/os2/leo/gnu/archiver/gtak254.zip
maintained by Andreas Kaiser <Andreas.Kaiser@stuttgart.netsurf.de>
Version 2.54. Based on tar 1.10. The second archive contains SCSI
drivers (DAT streamers notably) and rmt-type programs.
* IBM/PC (Win32: Windows 95, NT 3.5 or NT 4.0)
**X ftp://ftp.cygnus.com:~ftp/pub/sac/win32/usersrc/*
maintained by Cygnus
GNU-Win32 B17.1 distribution. Download all files, `cat' them together,
and `untar' the result. You get many GNU tools, not only `tar'.
Based on tar 1.11.2.
**X ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
GNU tar for NT (intel and Alpha platforms).
** ftp://garbo.uwasa.fi/pc/unix/untgz095.zip
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
The `untgz' program is a fast .tar or .tar.gz (.tgz) extractor.
* IBM/PC (Windows 3.1)
**X ftp://ftp.mcs.com/mcsnet.users/les/win-gnutar/
maintained by Leslie Mikesell <les@mcs.net>
Support for network (rsh over winsock). No support for win95 long
file names.
**X ftp://ftp.gamesdomain.ru/.1/os/windows/programr/tar.zip
Based on GNU tar 1.11.2.
* Macintosh
** Paulo Abreu (paulotex at yahoo dot com) did a
limited port of GNU tar to Darwin, with support for resource forks
and finder info, but this no longer seems to be available.
** There is a tar in Stuffit Expander which is available many places and
comes with MacOS. It creates some spurious files but works on average.
** There is an excellent GNU tar bundled in Tenon MachTen, but it does not
seem to be available separately.
* Copyright notice
Copyright (C) 1999, 2001, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU tar.
@@ -27,139 +164,10 @@
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
.* GNU/Linux and Unix
. + Star is a tape archiver similar to tar.
<http://www.fokus.gmd.de/research/cc/glone/employees/joerg.schilling/private/star.html>
.* Amiga
. + ftp://ftp.wustl.edu/systems/amiga/aminet/util/arc/GNUtar-1.11.8.lha
maintained by Enrico Forestieri <enrico@com.unipr.it>
Based on tar 1.11.8.
. + [This link seems to be dead:]
ftp://ftp.ninemoons.com/pub/ade/current/amiga-bin/tar-1.11.8-bin.lha
maintained by the ADE group <fnf@fishpond.ninemoons.com>
Based on tar 1.11.8, needs ixemul.library.
. + ftp://ftp.wustl.edu/systems/amiga/aminet/util/arc/gnutar.lha
maintained by <mscheler@wuarchive.wustl.edu>
.* DEC alpha (NT)
. + [This link seems to be dead:]
ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
.* DEC VAX (VMS)
. + [This link seems to be dead:]
http://www.lp.se/free/vmstar/
maintained by Richard Levitte <levitte@lp.se>
This is not GNU tar, but a separate implementation.
. + maintained by William Bader <william@nscs.fast.net>
For V4.7. Based on an old PDtar. Requires compatible shared libraries
to run V5 or V6 executables.
.* IBM/PC (DV/X)
. + ftp://qdeck.com/ (?)
maintained by David Ronis <ronis@gibbs.chem.mcgill.ca>
For Desqview/X. Everything works besides compression. Copy of hacked
sources available, some of DV/X's programmer's library also needed.
.* IBM/PC (MSDOS)
. + http://www.simtel.net/simtel.net/
http://www.leo.org/pub/comp/platforms/pc/gnuish (Germany)
ftp://ftp.simtel.net/simtelnet/gnu
ftp://ftp.leo.org/pub/comp/platforms/pc/gnuish
maintained by Darrel Hankerson <hankedr@mail.auburn.edu>
You get many GNU tools, not only `tar'. The GNUish project is described
in `gnuish_t.htm'.
. + The DJGPP development tools also include some `tar' utilities.
. + ftp://ftp.mcs.com/mcsnet.users/les/dos-gnutar/
maintained by Leslie Mikesell <les@mcs.net>
Based on tar 1.11.2. Support for SCSI (via ASPI) and network (rsh over
packet driver). No support for win95 long file names.
. + ftp://ftp.wu-wien.ac.at:pub/src/PCmisc/aspi-tar/*
maintained by Christoph Splittgerber <chris@orion.sdata.de>
Based on tar 1.10. Support for SCSI (via ASPI).
. + ftp://wuarchive (?)
Several DOS version based on PDtar. John Gilmore <gnu@toad.com> says
he has copies of several vintages saved.
. + ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.exe
ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.taz
ftp://ftp.cdrom.com/.14/languages/ada/toolkit/msdos/gtar/gtar.zip
. + ftp://ftp.cdrom.com/.4/os2/archiver/tar.zip
Based on PDtar.
. + ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
GNU tar for NT (intel and Alpha platforms).
. + ftp://garbo.uwasa.fi/pc/unix/untgz095.zip
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
The `untgz' program is a fast .tar or .tar.gz (.tgz) extractor.
. + http://people.darmstadt.netsurf.de/tst/tar.htm
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
This is not a `tar' port, but an index of them.
.* IBM/PC (OS/2)
. + http://www.leo.org/pub/comp/os/os2/leo/gnu/archiver/gtar254.zip
http://www.leo.org/pub/comp/os/os2/leo/gnu/archiver/gtak254.zip
maintained by Andreas Kaiser <Andreas.Kaiser@stuttgart.netsurf.de>
Version 2.54. Based on tar 1.10. The second archive contains SCSI
drivers (DAT streamers notably) and rmt-type programs.
. + ftp://garbo.uwasa.fi/pc/unix/untgz095.zip
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
The `untgz' program is a fast .tar or .tar.gz (.tgz) extractor.
.* IBM/PC (Win32: Windows 95, NT 3.5 or NT 4.0)
. + ftp://ftp.cygnus.com:~ftp/pub/sac/win32/usersrc/*
maintained by Cygnus
GNU-Win32 B17.1 distribution. Download all files, `cat' them together,
and `untar' the result. You get many GNU tools, not only `tar'.
Based on tar 1.11.2.
. + ftp://ftp.cdrom.com/.20/windows/archiver/tar.zip
maintained by Drew Bliss & Geoff Voelker
GNU tar for NT (intel and Alpha platforms).
. + ftp://garbo.uwasa.fi/pc/unix/untgz095.zip
maintained by Tillmann Steinbrecher <tst@darmstadt.netsurf.de>
The `untgz' program is a fast .tar or .tar.gz (.tgz) extractor.
.* IBM/PC (Windows 3.1)
. + ftp://ftp.mcs.com/mcsnet.users/les/win-gnutar/
maintained by Leslie Mikesell <les@mcs.net>
Support for network (rsh over winsock). No support for win95 long
file names.
. + ftp://ftp.gamesdomain.ru/.1/os/windows/programr/tar.zip
Based on GNU tar 1.11.2.
.* Macintosh
. + Paulo Abreu (paulotex at yahoo dot com) did a
limited port of GNU tar to Darwin, with support for resource forks
and finder info, but this no longer seems to be available.
. + There is a tar in Stuffit Expander which is available many places and
comes with MacOS. It creates some spurious files but works on average.
. + There is an excellent GNU tar bundled in Tenon MachTen, but it does not
seem to be available separately.
Local Variables:
mode: outline
paragraph-separate: "[ ]*$"
version-control: never
End:

16
README
View File

@@ -48,14 +48,22 @@ in the environment before configuring (the behavior of `-[0-7]' or
** Selecting full pathname of the "rmt" binary.
Previous versions of tar always looked for "rmt" binary using
hardcoded path "/etc/rmt". However, the "rmt" program included
Previous versions of tar always looked for "rmt" binary in the
directory "/etc/rmt". However, the "rmt" program included
in the distribution was installed under "$prefix/libexec/rmt".
To fix this discrepancy, tar now looks for "$prefix/libexec/rmt".
If you do not want this behavior, specify full path name of
"rmt" binary using DEFAULT_RMT_COMMAND variable, e.g.:
"rmt" binary using DEFAULT_RMT_DIR variable, e.g.:
./configure DEFAULT_RMT_COMMAND=/etc/rmt
./configure DEFAULT_RMT_DIR=/etc
If you already have a copy of "rmt" installed and wish to use it
instead of the version supplied with the distribution, use --with-rmt
option:
./configure --with-rmt=/etc/rmt
This will also disable building the included version of rmt.
** Installing backup scripts.

View File

@@ -24,25 +24,33 @@ Before building the package, run "bootstrap". It obtains various
additional files from the CVS repository and the Translation Project
site and prepares the source directory for building.
When run without arguments, bootstrap will try to obtain gnulib files
from CVS repository on savannah using anonymous SSH access. Then, it
will fetch the po files from tar page at Translation Project, and,
finally, it will start autoconfiguration process. Simply running
it without arguments should do in most cases. Several options
allow to control the behavior of bootstrap:
When run without arguments, bootstrap will try to obtain gnulib and
paxutils files from their corresponding CVS repositories on Savannah
using anonymous SSH access. Then, it will fetch the po files from tar
page at Translation Project, and, finally, it will start autoconfiguration
process. Simply running it without arguments should do in most cases.
Several options allow to control the behavior of bootstrap:
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
do not want to waste your bandwidth dowloading
them again.
--paxutils-srcdir=DIRNAME Specify the local directory where paxutils
sources reside. Use this if you already
have paxutils sources on your machine, and
do not want to waste your bandwidth dowloading
them again.
--cvs-auth=METHOD Set the CVS access method used for downloading
gnulib files. METHOD is one of the keywords
accepted by cvs -d option (see info cvs
repository).
--cvs-user=USERNAME Set the CVS username to be used when accessing
the gnulib repository.
--no-po Do not download po files.
Notice also that when using CVS authentication method "ext", bootstrap

4
THANKS
View File

@@ -62,6 +62,7 @@ Bob Mende Pie mende@piecomputer.rutgers.edu
Bradley A. Smith basmith@prometheus.chem.umn.edu
Brendan Kehoe brendan@cygnus.com
Brett Gaines gaines@saifr00.ateng.az.honeywell.com
Bryan Ford baford@mit.edu
Brian Perkins bperkins@netspace.org
Brian R. Smith brian@cygnus.com
Bruce Evans bde@runx.oz.au
@@ -184,6 +185,7 @@ Harald K
Harald Milz hm@seneca.ix.de
Heiko Schinke mdqac@biochemtech.uni-halle.de
Heiko Schlichting heiko@fu-berlin.de
Helmut Waitzmann Helmut.Waitzmann@web.de
Henrik Bakman hb@csd.uu.se
Hernan Prieto Schmidt hernan@pea.usp.br
Hiroyuki Bessho bsh@grotto.iijnet.or.jp
@@ -237,6 +239,7 @@ John David Anglin dave@hiauly1.hia.nrc.ca
John Gilmore gnu@toad.com
John J. Szetela johns@angelo.amd.com
John L. Chmielewski jlc@attmail.com
John L. Males jlmales@yahoo.com
John Oleynick juo@klinzhai.rutgers.edu
John R. Vanderpool fish@daacdev1.stx.com
John Rouillard rouilj@cs.umb.edu
@@ -302,6 +305,7 @@ Markus Kuhn mskuhn@cip.informatik.uni-erlangen.de
Martin Bellenberg sunsoft@ifm.uni-hamburg.de
Martin Goik goik@HDM-Stuttgart.de
Martin Mares mj@k332.feld.cvut.cz
Martin Simmons ZYHYLCRMZPRP@spammotel.com
Marty Leisner leisner@eso.mc.xerox.com
Massimo Dal Zotto dz@cs.unitn.it
Mats Lofkvist d87-mal@nada.kth.se

21
TODO
View File

@@ -2,6 +2,14 @@ Suggestions for improving GNU tar.
* Incorporate fixes from major distributions, e.g., Debian GNU/Linux.
* Add support for restoring file time stamps to sub-second resolution,
if the file system supports this.
* Add support for restoring the attributes of symbolic links, for
OSes like FreeBSD that have the lutimes and lchmod functions.
* --append should bail out if the two archives are of different types.
* Add support for GNU private keywords in POSIX 1003.1-2001 headers,
so that the GNU extensions (--incremental, --label and
--multi-volume) may be used with POSIX archives.
@@ -16,9 +24,10 @@ so that the GNU extensions (--incremental, --label and
UNIX98 tar warns if all links cannot be resolved.
(GNU tar --check-links option)
Perhaps we could announce a phase-in period where "l" changes in semantics.
In the meanwhile we could make the "l" semantics to be determined by the
value of POSIXLY_CORRECT variable.
Currently tar prints a warning when this option is used. Sometime
in the future its semantics will be changed to that of --check-links.
In the meanwhile we should announce a phase-in period where "l"
changes in semantics.
* Interoperate better with Joerg Schilling's star implementation.
@@ -30,7 +39,7 @@ so that the GNU extensions (--incremental, --label and
It would be useful to be able to use '--remove-files' with '--diff',
to remove all files that compare successfully, when verifying a backup.
* Add tests for testing the added functonality.
* Add tests for the new functonality.
* Consider this:
@@ -47,10 +56,10 @@ so that the GNU extensions (--incremental, --label and
(http://mail.gnu.org/archive/html/bug-gnu-utils/2002-05/msg00022.html)
* Copyright notice
Copyright (C) 2003 Free Software Foundation, Inc.
Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU tar.

143
bootstrap
View File

@@ -19,15 +19,25 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Written by Paul Eggert.
# Written by Paul Eggert and Sergey Poznyakoff.
# URL of our text domain page in Translation Project
TP_URL="http://www2.iro.umontreal.ca/~gnutra/po/maint/tar/"
# Ensure file names are sorted consistently across platforms;
# e.g., m4/ulonglong_gl.m4 should follow m4/ulonglong.m4.
LC_ALL=C
export LC_ALL
usage() {
cat <<EOF
usage: $0 [--gnulib-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
usage: $0 [--gnulib-srcdir=DIR][--paxutils-srcdir=DIR][--cvs-auth=AUTH-METHOD][--cvs-user=USERNAME][--no-po]
Options are:
--paxutils-srcdir=DIRNAME Specify the local directory where paxutils
sources reside. Use this if you already
have paxutils sources on your machine, and
do not want to waste your bandwidth dowloading
them again.
--gnulib-srcdir=DIRNAME Specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
@@ -40,7 +50,8 @@ usage() {
--cvs-user=USERNAME Set the CVS username to be used when accessing
the gnulib repository.
--no-po Do not download po files.
--update-po[=LANG] Update po file(s) and exit.
Running without arguments will suffice in most cases. It is equivalent
to
@@ -49,6 +60,25 @@ to
EOF
}
update_po() {
if [ $# = 1 ]; then
case $1 in
*.po) POFILE=$1;;
*) POFILE=${1}.po;;
esac
echo "$0: getting translation for $1..."
wget -r -C off $TP_URL/$POFILE
else
echo "$0: getting translations into po..."
(cd po &&
rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
rm -f index.html index.html.[0-9]*
ls *.po | sed 's/\.po$//' >LINGUAS
) || exit
fi
}
# Parse options.
DOWNLOAD_PO=yes
@@ -60,18 +90,33 @@ do
exit;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=`expr "$option" : '--gnulib-srcdir=\(.*\)'`;;
--paxutils-srcdir=*)
PAXUTILS_SRCDIR=`expr "$option" : '--paxutils-srcdir=\(.*\)'`;;
--cvs-auth=*)
CVS_AUTH=`expr "$option" : '--cvs-auth=\(.*\)'`;;
--cvs-user=*)
CVS_USER=`expr "$option" : '--cvs-user=\(.*\)'`;;
--no-po)
DOWNLOAD_PO=no;;
--update-po=*)
DOWNLOAD_PO=`expr "$option" : '--update-po=\(.*\)'`;;
--update-po)
DOWNLOAD_PO=only;;
*)
echo >&2 "$0: $option: unknown option"
exit 1;;
esac
done
case $DOWNLOAD_PO in
only) update_po
exit 0
;;
no|yes) ;;
*) update_po $DOWNLOAD_PO
exit 0
esac
echo "$0: Bootstrapping CVS tar..."
build_cvs_prefix() {
@@ -87,33 +132,41 @@ build_cvs_prefix() {
fi
}
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
-)
if [ ! -d gnulib ]; then
echo "$0: getting gnulib files..."
# checkout package
checkout() {
if [ ! -d $1 ]; then
echo "$0: getting $1 files..."
trap exit 1 2 13 15
trap 'rm -fr gnulib; exit 1' 0
trap 'rm -fr $1; exit 1' 0
case "${CVS_AUTH--}" in
-) build_cvs_prefix ext anoncvs;;
pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs};;
-) build_cvs_prefix ext anoncvs
;;
pserver) build_cvs_prefix $CVS_AUTH ${CVS_USER:-anoncvs}
;;
gserver|server)
build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--};;
build_cvs_prefix $CVS_AUTH ${CVS_USER--}
;;
ext) build_cvs_prefix $CVS_AUTH ${CVS_USER--}
;;
*) echo "$0: Unknown CVS access method" >&2
exit 1;;
esac
if [ "${CVS_AUTH--}" = "pserver" ]; then
cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib login || exit
cvs -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/$1 login || exit
fi
cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/gnulib co gnulib || exit
cvs -q -d ${CVS_PREFIX}subversions.gnu.org:/cvsroot/$1 co $1 || exit
trap 0
fi
GNULIB_SRCDIR=gnulib
}
# Get gnulib files.
case ${GNULIB_SRCDIR--} in
-) checkout gnulib
GNULIB_SRCDIR=gnulib
esac
<$GNULIB_SRCDIR/gnulib-tool || exit
@@ -121,6 +174,7 @@ esac
gnulib_modules='
alloca
argmatch
argp
backupfile
dirname
error
@@ -132,11 +186,13 @@ full-write
getdate
getline
getopt
getpagesize
gettext
gettime
hash
human
lchown
localcharset
memset
modechange
obstack
@@ -154,6 +210,7 @@ timespec
unlocked-io
utime
xalloc
xalloc-die
xgetcwd
xstrtoumax
'
@@ -161,11 +218,13 @@ xstrtoumax
previous_gnulib_modules=
while [ "$gnulib_modules" != "$previous_gnulib_modules" ]; do
previous_gnulib_modules=$gnulib_modules
# In gnulib `alloca-opt' duplicates `alloca', so make sure not
# to use it.
gnulib_modules=`
(echo "$gnulib_modules"
for gnulib_module in $gnulib_modules; do
$GNULIB_SRCDIR/gnulib-tool --extract-dependencies $gnulib_module
done) | sort -u
done) | sed 's/alloca-opt/alloca/' | sort -u
`
done
@@ -190,10 +249,10 @@ for gnulib_file in $gnulib_files; do
m4/onceonly_2_57.m4) dest=m4/onceonly.m4;;
# These will be overwritten by autopoint, which still uses
# old jm_.* macro names, so we have to keep both copies.
m4/ulonglong.m4) dest=m4/ulonglong_gl.m4;;
m4/inttypes_h.m4) dest=m4/inttypes_h_gl.m4;;
m4/stdint_h.m4) dest=m4/stdint_h_gl.m4;;
m4/uintmax_t.m4) dest=m4/uintmax_t_gl.m4;;
m4/gettext.m4 | m4/glibc21.m4 | m4/inttypes_h.m4 | m4/lib-ld.m4 | \
m4/lib-prefix.m4 | m4/po.m4 | m4/stdint_h.m4 | m4/uintmax_t.m4 | \
m4/ulonglong.m4)
dest=`expr $gnulib_file : '\(.*\).m4'`_gl.m4;;
esac
rm -f $dest &&
@@ -219,15 +278,41 @@ echo "$0: Creating lib/Makefile.am"
$GNULIB_SRCDIR/gnulib-tool --extract-automake-snippet $gnulib_module
done | sed 's/lib_SOURCES/libtar_a_SOURCES/g' ) > lib/Makefile.am
# Get translations.
# Get paxutils files
case ${PAXUTILS_SRCDIR--} in
-) checkout paxutils
PAXUTILS_SRCDIR=paxutils
esac
# copy_files srcdir dstdir
copy_files() {
for file in `cat $1/DISTFILES`
do
case $file in
"#*") continue;;
esac
echo "$0: Copying file $1/$file"
cp -p $1/$file $2/`expr $file : '.*/\(.*\)'`
done
}
copy_files ${PAXUTILS_SRCDIR}/m4 m4
if [ -d rmt ]; then
:
else
mkdir rmt
fi
copy_files ${PAXUTILS_SRCDIR}/rmt rmt
copy_files ${PAXUTILS_SRCDIR}/lib lib
copy_files ${PAXUTILS_SRCDIR}/tests tests
# Get translations.
if test "$DOWNLOAD_PO" = "yes"; then
echo "$0: getting translations into po..."
(cd po &&
rm -f dummy `ls | sed -n '/\.gmo$/p; /\.po/p'` &&
wget -nv -nd -r -l 1 -A .po -C off $TP_URL &&
ls *.po | sed 's/\.po$//' >LINGUAS
) || exit
update_po
fi
# Reconfigure, getting other files.

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AC_INIT([GNU tar], [1.14], [bug-tar@gnu.org])
AC_INIT([GNU tar], [1.15], [bug-tar@gnu.org])
AC_CONFIG_SRCDIR([src/tar.c])
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_HEADERS([config.h:config.hin])
@@ -49,26 +49,6 @@ AC_CHECK_HEADERS([sys/buf.h], [], [],
AC_HEADER_SYS_WAIT
AM_STDBOOL_H
if test $ac_cv_header_sys_mtio_h = yes; then
AC_CACHE_CHECK(for remote tape header files, tar_cv_header_rmt,
[AC_TRY_CPP([
#if HAVE_SGTTY_H
# include <sgtty.h>
#endif
#include <sys/socket.h>],
tar_cv_header_rmt=yes, tar_cv_header_rmt=no)])
test $tar_cv_header_rmt = yes && RMT='rmt$(EXEEXT)'
AC_SUBST(RMT)
fi
AC_CACHE_CHECK(which ioctl field to test for reversed bytes,
tar_cv_header_mtio_check_field,
[AC_EGREP_HEADER(mt_model, sys/mtio.h,
tar_cv_header_mtio_check_field=mt_model,
tar_cv_header_mtio_check_field=mt_type)])
AC_DEFINE_UNQUOTED(MTIO_CHECK_FIELD, $tar_cv_header_mtio_check_field,
[Define to mt_model (v.g., for DG/UX), else to mt_type.])
AC_HEADER_DIRENT
AC_HEADER_MAJOR
AC_HEADER_STAT
@@ -132,7 +112,6 @@ LIBS=$tar_save_LIBS
AC_CHECK_FUNCS(fsync lstat mkfifo readlink strerror symlink setlocale utimes)
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
AC_CHECK_DECLS([valloc])
AC_CHECK_DECLS([time],,, [#include <time.h>])
# Set LIB_SETSOCKOPT to -lnsl -lsocket if necessary.
@@ -239,16 +218,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_BLOCKING, $DEFAULT_BLOCKING,
[Define to a number giving the default blocking size for archives.])
AC_MSG_RESULT($DEFAULT_BLOCKING)
AC_ARG_VAR([DEFAULT_RMT_COMMAND],
[Define full pathname of rmt program.])
if test "x$DEFAULT_RMT_COMMAND" != x; then
AC_DEFINE_UNQUOTED(DEFAULT_RMT_COMMAND, "$DEFAULT_RMT_COMMAND",
[Define full pathname of rmt program.])
fi
# Gettext.
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION(0.12.1)
PU_RMT
# Iconv
AM_ICONV
@@ -262,6 +232,15 @@ AC_CHECK_TYPE(iconv_t,:,
#endif
])
# Gettext.
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION(0.12.1)
# Initialize the test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([tests/Makefile tests/atlocal]) # FIXME: tests/preset?
AM_MISSING_PROG([AUTOM4TE], [autom4te])
AC_SUBST(BACKUP_LIBEXEC_SCRIPTS)
AC_SUBST(BACKUP_SBIN_SCRIPTS)
AC_ARG_ENABLE(backup-scripts,
@@ -286,6 +265,5 @@ AC_OUTPUT([Makefile\
lib/Makefile\
po/Makefile.in\
scripts/Makefile\
src/Makefile\
tests/Makefile\
tests/preset])
rmt/Makefile\
src/Makefile])

87
directory Normal file
View File

@@ -0,0 +1,87 @@
%%comments:
Copyright (C) 2004 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the file COPYING.
%%name: tar
%%short-description: Creates tar archives
%%full-description:
GNU tar is an archiver that creates and handles file archives in various
formats. You can use tar to create file archives, to extract files from
previously created archives, store additional files, or update or list
files which were already stored.
The program saves many files together into a single tape or disk
archive, and can restore individual files from the archive. It
includes multivolume support, the ability to archive sparse files,
automatic archive compression/decompression, remote archives and
special features that allow 'tar' to be used for incremental and full
backups.
The supported archive formats are: V7 tar, GNU, ustar and POSIX (also
known as pax interchange format). GNU tar is also able to read and
extract 'star' archives.
Tar can direct its output to available devices, files, or other
programs (using pipes); tar can even access remote devices or files
(as archives).
%%category: system, backup
%%license: GPL
%%maintainer: Sergey Poznyakoff <gray@Mirddin.farlep.net>,
Jeff Bailey <jbailey@nisa.net>,
Paul Eggert <eggert@CS.UCLA.EDU>
%%updated: 20 Dec 2004
%%keywords: archive, backup, tar, pax
%%interface: Command line
%%programs: tar, rmt
%%GNU: yes
%%web-page: http://www.gnu.org/software/tar
%%doc: English user reference included
%%doc: English user manual in Texinfo, Dvi, Postscript, HTML, Plaintext is available from http://www.gnu.org/software/tar/manual/tar.html
%%developers:
John Gilmore,
Thomas Bushnell,
Paul Eggert <eggert@twinsun.com>,
Sergey Poznyakoff <gray@Mirddin.farlep.net>
%%contributors: Jay Fenlason,
Joy Kendall,
Francois Pinard <pinard@iro.umontreal.ca>
%%source-tarball: ftp://ftp.gnu.org/pub/gnu/tar/tar-1.15.tar.gz
%%source-info: http://savannah.gnu.org/projects/tar
%%repository:
:pserver:anoncvs@subversions.gnu.org:/cvsroot/tar login,
:pserver:anoncvs@subversions.gnu.org:/cvsroot/tar co tar,
http://savannah.gnu.org/cvs/?group=tar,
http://savannah.gnu.org/cgi-bin/viewcvs/tar/tar,
%%source-language: C
%%related-programs: GNU cpio
%%version: 1.15 (stable) released on 20 Dec 2004
%%bug-list: bug-tar@gnu.org bug-tar@gnu.org http://mail.gnu.org/mailman/listinfo/bug-tar
%%entry-written-by: Sergey Poznyakoff <gray@gnu.org>

View File

@@ -27,3 +27,8 @@ tar.ats
tar.exs
tar.kws
tmp-tar.*
tmp2-tar.*
html_mono
html_node
html_chapter
*.stamp

View File

@@ -18,10 +18,10 @@
## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
info_TEXINFOS = tar.texi
tar_TEXINFOS = fdl.texi freemanuals.texi getdate.texi header.texi
EXTRA_DIST = convtexi.pl
EXTRA_DIST = convtexi.pl fdl.texi freemanuals.texi getdate.texi header.texi
CLEANFILES = tmp-*
CLEANFILES = tmp-* tmp2-* index.html
# The rendering level is anyone of PUBLISH, DISTRIB or PROOF.
# Just call `make dvi RENDITION=PROOF' if you want PROOF rendition.
@@ -31,7 +31,7 @@ $(srcdir)/tar.info: tar.texi fdl.texi freemanuals.texi getdate.texi \
$(srcdir)/header.texi version.texi
$(MAKEINFO) --no-split -D$(RENDITION) -I$(srcdir) tar.texi -o $@
tar.dvi: tar.texi getdate.texi $(srcdir)/header.texi version.texi
tmp-tar.texi: tar.texi getdate.texi $(srcdir)/header.texi version.texi
$(MAKEINFO) -D$(RENDITION) -Etmp-tar.tmp -otmp-tar.info \
-I$(srcdir) tar.texi
rm -f tmp-tar.sed tmp-tar.info*
@@ -41,6 +41,8 @@ tar.dvi: tar.texi getdate.texi $(srcdir)/header.texi version.texi
|| echo >>tmp-tar.sed '/^@smallbook/d'
sed -f tmp-tar.sed tmp-tar.tmp > tmp-tar.texi
rm -f tmp-tar.sed tmp-tar.tmp
tar.dvi: tmp-tar.texi
TEXINPUTS=$(top_srcdir)/config:$$TEXINPUTS \
MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir)' \
$(TEXI2DVI) tmp-tar.texi
@@ -49,3 +51,152 @@ tar.dvi: tar.texi getdate.texi $(srcdir)/header.texi version.texi
$(srcdir)/header.texi: $(top_srcdir)/src/tar.h
sed -n '/Archive Format/,/End of Format/p' $(top_srcdir)/src/tar.h \
| expand | sed 's/\([{}]\)/@\1/g' >$@
##
PROJECT=$(PACKAGE_TARNAME)
BASE_URL="http://www.gnu.org/software/$(PROJECT)/manual/"
TEXI2HTML=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run texi2html
INFO=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run info
DVIPDF=${SHELL} `cd $(top_srcdir); pwd`/config/missing --run dvipdf
clean-local:
rm -rf $(WEBDOC) $(WEB_HTML_STAMPS)
html: html_mono.stamp html_node.stamp html_chapter.stamp
tmp2-$(PROJECT).texi: Makefile tmp-$(PROJECT).texi
echo '/@copying/,/@end copying/{H;x;s/@copying//;s/@end copying//;x;}' > tmp2.sed
echo '/@insertcopying/{x;h;}' >> tmp2.sed
echo 's/\(.\)@ifset/\1\' >> tmp2.sed
echo '@ifset/' >> tmp2.sed
sed -f tmp2.sed tmp-$(PROJECT).texi > tmp2-$(PROJECT).texi
rm -f tmp2.sed
html_node.stamp: tmp2-$(PROJECT).texi
texi2html="$(TEXI2HTML)";\
if ! test -d html_node; then mkdir html_node; fi; \
cd html_node; \
$$texi2html -menu -split_node -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
cd ..; \
touch html_node.stamp
html_chapter.stamp: tmp2-$(PROJECT).texi
texi2html="$(TEXI2HTML)";\
if ! test -d html_chapter; then mkdir html_chapter; fi; \
cd html_chapter; \
$$texi2html -menu -split_chapter -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
cd ..; \
touch html_chapter.stamp
html_mono.stamp: tmp2-$(PROJECT).texi
texi2html="$(TEXI2HTML)";\
if ! test -d html_mono; then mkdir html_mono; fi; \
cd html_mono; \
$$texi2html -menu -monolithic -prefix $(PROJECT) ../tmp2-$(PROJECT).texi; \
cd ..; \
touch html_mono.stamp
ps: $(PROJECT).ps
$(PROJECT).ps: $(PROJECT).dvi
$(DVIPS) -o$(PROJECT).ps $(PROJECT).dvi
# Override the default rule. The texinfo <= 4.5 is unable to cope with
# tar docs.
$(PROJECT).pdf: $(PROJECT).dvi
$(DVIPDF) $(PROJECT).dvi
text: $(PROJECT).text
$(PROJECT).text: Makefile $(PROJECT).info
$(INFO) --node=Top --subnodes --out $(PROJECT).text -f ./$(PROJECT).info
$(PROJECT).info.tar.gz: Makefile
rm -f $(PROJECT).info.tar.gz
tar cf $(PROJECT).info.tar $(PROJECT).info*
gzip -f $(PROJECT).info.tar
$(PROJECT).dvi.gz: Makefile $(PROJECT).dvi
gzip -c $(PROJECT).dvi > $(PROJECT).dvi.gz
$(PROJECT).ps.gz: Makefile $(PROJECT).ps
gzip -c $(PROJECT).ps > $(PROJECT).ps.gz
$(PROJECT).pdf.gz: Makefile $(PROJECT).pdf
gzip -c $(PROJECT).pdf > $(PROJECT).pdf.gz
$(PROJECT).texi.tar.gz: Makefile $(info_TEXINFOS) $(tar_TEXINFOS)
tar cfz $(PROJECT).texi.tar.gz $(info_TEXINFOS) $(tar_TEXINFOS)
WEB_HTML=\
html_mono\
html_node\
html_chapter
WEB_HTML_STAMPS=$(patsubst %,%.stamp,$(WEB_HTML))
WEB_BIN=\
$(PROJECT).info.tar.gz\
$(PROJECT).dvi.gz\
$(PROJECT).pdf.gz\
$(PROJECT).ps.gz\
$(PROJECT).texi.tar.gz\
$(PROJECT).text
WEBDOC=$(WEB_HTML) $(WEB_BIN)
webdocdir: $(WEB_HTML_STAMPS) $(WEB_BIN) index.html
if ! test -d $(WEBDOCDIR); then mkdir $(WEBDOCDIR); fi; \
here=`cd $(srcdir) && pwd`; \
webdocdir=`cd $(WEBDOCDIR) && pwd`; \
for file in $(WEB_HTML) index.html; do \
if test -d $$here/$$file; then \
cp -pr $$here/$$file $$webdocdir/$$file; \
else \
test -f $$webdocdir/$$file \
|| ln $$here/$$file $$webdocdir/$$file 2> /dev/null \
|| cp -p $$here/$$file $$webdocdir/$$file || :; \
fi; \
done; \
if ! test -d $(WEBDOCDIR)/other; then mkdir $(WEBDOCDIR)/other; fi;\
for file in $(WEB_BIN); do \
if test -d $$here/$$file; then \
cp -pr $$here/$$file $$webdocdir/other/$$file; \
else \
test -f $$webdocdir/other/$$file \
|| ln $$here/$$file $$webdocdir/other/$$file 2> /dev/null \
|| cp -p $$here/$$file $$webdocdir/other/$$file || :; \
fi; \
done
index.html: index.html.in $(WEBDOC)
@echo "s^%BASE_URL%^$(BASE_URL)^;" > .webdoc
@echo "s/%DATE%/`date`/;" >> .webdoc
@echo "s/%UPDATED%/`date +'%B, %d'`/;" >> .webdoc
@echo "s/%PACKAGE_NAME%/$(PACKAGE_NAME)/" >> .webdoc
@echo "s/%PACKAGE%/$(PACKAGE)/" >> .webdoc
@echo "s/%VERSION%/$(VERSION)/" >> .webdoc
@for file in `sed -n 's,.*"other/%PACKAGE%\(.*\)".*,$(PACKAGE)\1,pg;s,.*"\(.*\)%PACKAGE%\(.*\)".*,\1$(PACKAGE)\2,pg' index.html.in`; \
do\
ls -sk $$file; \
done |\
$(AWK) -vPACKAGE=$(PACKAGE) \
'BEGIN { len = length(PACKAGE) } \
{ gsub("\\.", "_", $$2); \
if (match($$2,"/")) \
$$2=substr($$2,RSTART+1); \
print "s/%" toupper(substr($$2,len+2)) "_SIZE%/" $$1 "/;" }' >> .webdoc
sed -f .webdoc index.html.in > index.html
rm -f .webdoc
webdocname=$(PACKAGE)-$(VERSION)-doc
WEBDOCDIR=$(webdocname)
webdoc:
$(MAKE) RENDITION=PUBLISH WEBDOCDIR=$(top_builddir)/doc/$(webdocname) webdocdir
cd $(top_builddir)/doc &&\
tar cfz $(webdocname).tar.gz $(webdocname) &&\
rm -r $(webdocname)
## End of webdoc

View File

@@ -1,478 +0,0 @@
@c GNU date syntax documentation
@c Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@c 2003, 2004 Free Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.1 or
@c any later version published by the Free Software Foundation; with no
@c Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
@c Texts. A copy of the license is included in the ``GNU Free
@c Documentation License'' file as part of this distribution.
@node Date input formats
@chapter Date input formats
@cindex date input formats
@findex get_date
First, a quote:
@quotation
Our units of temporal measurement, from seconds on up to months, are so
complicated, asymmetrical and disjunctive so as to make coherent mental
reckoning in time all but impossible. Indeed, had some tyrannical god
contrived to enslave our minds to time, to make it all but impossible
for us to escape subjection to sodden routines and unpleasant surprises,
he could hardly have done better than handing down our present system.
It is like a set of trapezoidal building blocks, with no vertical or
horizontal surfaces, like a language in which the simplest thought
demands ornate constructions, useless particles and lengthy
circumlocutions. Unlike the more successful patterns of language and
science, which enable us to face experience boldly or at least
level-headedly, our system of temporal calculation silently and
persistently encourages our terror of time.
@dots{} It is as though architects had to measure length in feet, width
in meters and height in ells; as though basic instruction manuals
demanded a knowledge of five different languages. It is no wonder then
that we often look into our own immediate past or future, last Tuesday
or a week from Sunday, with feelings of helpless confusion. @dots{}
--- Robert Grudin, @cite{Time and the Art of Living}.
@end quotation
This section describes the textual date representations that @sc{gnu}
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs. The C interface (via the
@code{get_date} function) is not described here.
@menu
* General date syntax:: Common rules.
* Calendar date items:: 19 Dec 1994.
* Time of day items:: 9:20pm.
* Time zone items:: @sc{est}, @sc{pdt}, @sc{gmt}, ...
* Day of week items:: Monday and others.
* Relative items in date strings:: next tuesday, 2 years ago.
* Pure numbers in date strings:: 19931219, 1440.
* Seconds since the Epoch:: @@1078100502.
* Authors of get_date:: Bellovin, Eggert, Salz, Berets, et al.
@end menu
@node General date syntax
@section General date syntax
@cindex general date syntax
@cindex items in date strings
A @dfn{date} is a string, possibly empty, containing many items
separated by whitespace. The whitespace may be omitted when no
ambiguity arises. The empty string means the beginning of today (i.e.,
midnight). Order of the items is immaterial. A date string may contain
many flavors of items:
@itemize @bullet
@item calendar date items
@item time of the day items
@item time zone items
@item day of the week items
@item relative items
@item pure numbers.
@end itemize
@noindent We describe each of these item types in turn, below.
@cindex numbers, written-out
@cindex ordinal numbers
@findex first @r{in date strings}
@findex next @r{in date strings}
@findex last @r{in date strings}
A few numbers may be written out in words in most contexts. This is
most useful for specifying day of the week items or relative items (see
below). Here is the list: @samp{first} for 1, @samp{next} for 2,
@samp{third} for 3, @samp{fourth} for 4, @samp{fifth} for 5,
@samp{sixth} for 6, @samp{seventh} for 7, @samp{eighth} for 8,
@samp{ninth} for 9, @samp{tenth} for 10, @samp{eleventh} for 11 and
@samp{twelfth} for 12. Also, @samp{last} means exactly @math{-1}.
@cindex months, written-out
When a month is written this way, it is still considered to be written
numerically, instead of being ``spelled in full''; this changes the
allowed strings.
@cindex language, in dates
In the current implementation, only English is supported for words and
abbreviations like @samp{AM}, @samp{DST}, @samp{EST}, @samp{first},
@samp{January}, @samp{Sunday}, @samp{tomorrow}, and @samp{year}.
@cindex language, in dates
@cindex time zone item
The output of @command{date} is not always acceptable as a date string,
not only because of the language problem, but also because there is no
standard meaning for time zone items like @samp{IST}. When using
@command{date} to generate a date string intended to be parsed later,
specify a date format that is independent of language and that does not
use time zone items other than @samp{UTC} and @samp{Z}. Here are some
ways to do this:
@example
$ LC_ALL=C TZ=UTC0 date
Mon Mar 1 00:21:42 UTC 2004
$ TZ=UTC0 date +'%Y-%m-%d %H:%M:%SZ'
2004-03-01 00:21:42Z
$ date --iso-8601=ns # a GNU extension
2004-02-29T16:21:42,692722128-0800
$ date --rfc-2822 # a GNU extension
Sun, 29 Feb 2004 16:21:42 -0800
$ date +'%Y-%m-%d %H:%M:%S %z' # %z is a GNU extension.
2004-02-29 16:21:42 -0800
$ date +'@@%s.%N' # %s and %N are GNU extensions.
@@1078100502.692722128
@end example
@cindex case, ignored in dates
@cindex comments, in dates
Alphabetic case is completely ignored in dates. Comments may be introduced
between round parentheses, as long as included parentheses are properly
nested. Hyphens not followed by a digit are currently ignored. Leading
zeros on numbers are ignored.
@node Calendar date items
@section Calendar date items
@cindex calendar date item
A @dfn{calendar date item} specifies a day of the year. It is
specified differently, depending on whether the month is specified
numerically or literally. All these strings specify the same calendar date:
@example
1972-09-24 # @sc{iso} 8601.
72-9-24 # Assume 19xx for 69 through 99,
# 20xx for 00 through 68.
72-09-24 # Leading zeros are ignored.
9/24/72 # Common U.S. writing.
24 September 1972
24 Sept 72 # September has a special abbreviation.
24 Sep 72 # Three-letter abbreviations always allowed.
Sep 24, 1972
24-sep-72
24sep72
@end example
The year can also be omitted. In this case, the last specified year is
used, or the current year if none. For example:
@example
9/24
sep 24
@end example
Here are the rules.
@cindex @sc{iso} 8601 date format
@cindex date format, @sc{iso} 8601
For numeric months, the @sc{iso} 8601 format
@samp{@var{year}-@var{month}-@var{day}} is allowed, where @var{year} is
any positive number, @var{month} is a number between 01 and 12, and
@var{day} is a number between 01 and 31. A leading zero must be present
if a number is less than ten. If @var{year} is 68 or smaller, then 2000
is added to it; otherwise, if @var{year} is less than 100,
then 1900 is added to it. The construct
@samp{@var{month}/@var{day}/@var{year}}, popular in the United States,
is accepted. Also @samp{@var{month}/@var{day}}, omitting the year.
@cindex month names in date strings
@cindex abbreviations for months
Literal months may be spelled out in full: @samp{January},
@samp{February}, @samp{March}, @samp{April}, @samp{May}, @samp{June},
@samp{July}, @samp{August}, @samp{September}, @samp{October},
@samp{November} or @samp{December}. Literal months may be abbreviated
to their first three letters, possibly followed by an abbreviating dot.
It is also permitted to write @samp{Sept} instead of @samp{September}.
When months are written literally, the calendar date may be given as any
of the following:
@example
@var{day} @var{month} @var{year}
@var{day} @var{month}
@var{month} @var{day} @var{year}
@var{day}-@var{month}-@var{year}
@end example
Or, omitting the year:
@example
@var{month} @var{day}
@end example
@node Time of day items
@section Time of day items
@cindex time of day item
A @dfn{time of day item} in date strings specifies the time on a given
day. Here are some examples, all of which represent the same time:
@example
20:02:00.000000
20:02
8:02pm
20:02-0500 # In @sc{est} (U.S. Eastern Standard Time).
@end example
More generally, the time of the day may be given as
@samp{@var{hour}:@var{minute}:@var{second}}, where @var{hour} is
a number between 0 and 23, @var{minute} is a number between 0 and
59, and @var{second} is a number between 0 and 59 possibly followed by
@samp{.} or @samp{,} and a fraction containing one or more digits.
Alternatively,
@samp{:@var{second}} can be omitted, in which case it is taken to
be zero.
@findex am @r{in date strings}
@findex pm @r{in date strings}
@findex midnight @r{in date strings}
@findex noon @r{in date strings}
If the time is followed by @samp{am} or @samp{pm} (or @samp{a.m.}
or @samp{p.m.}), @var{hour} is restricted to run from 1 to 12, and
@samp{:@var{minute}} may be omitted (taken to be zero). @samp{am}
indicates the first half of the day, @samp{pm} indicates the second
half of the day. In this notation, 12 is the predecessor of 1:
midnight is @samp{12am} while noon is @samp{12pm}.
(This is the zero-oriented interpretation of @samp{12am} and @samp{12pm},
as opposed to the old tradition derived from Latin
which uses @samp{12m} for noon and @samp{12pm} for midnight.)
@cindex time zone correction
@cindex minutes, time zone correction by
The time may alternatively be followed by a time zone correction,
expressed as @samp{@var{s}@var{hh}@var{mm}}, where @var{s} is @samp{+}
or @samp{-}, @var{hh} is a number of zone hours and @var{mm} is a number
of zone minutes. When a time zone correction is given this way, it
forces interpretation of the time relative to
Coordinated Universal Time (@sc{utc}), overriding any previous
specification for the time zone or the local time zone. The @var{minute}
part of the time of the day may not be elided when a time zone correction
is used. This is the best way to specify a time zone correction by
fractional parts of an hour.
Either @samp{am}/@samp{pm} or a time zone correction may be specified,
but not both.
@node Time zone items
@section Time zone items
@cindex time zone item
A @dfn{time zone item} specifies an international time zone, indicated
by a small set of letters, e.g., @samp{UTC} or @samp{Z}
for Coordinated Universal
Time. Any included periods are ignored. By following a
non-daylight-saving time zone by the string @samp{DST} in a separate
word (that is, separated by some white space), the corresponding
daylight saving time zone may be specified.
Time zone items other than @samp{UTC} and @samp{Z}
are obsolescent and are not recommended, because they
are ambiguous; for example, @samp{EST} has a different meaning in
Australia than in the United States. Instead, it's better to use
unambiguous numeric time zone corrections like @samp{-0500}, as
described in the previous section.
@node Day of week items
@section Day of week items
@cindex day of week item
The explicit mention of a day of the week will forward the date
(only if necessary) to reach that day of the week in the future.
Days of the week may be spelled out in full: @samp{Sunday},
@samp{Monday}, @samp{Tuesday}, @samp{Wednesday}, @samp{Thursday},
@samp{Friday} or @samp{Saturday}. Days may be abbreviated to their
first three letters, optionally followed by a period. The special
abbreviations @samp{Tues} for @samp{Tuesday}, @samp{Wednes} for
@samp{Wednesday} and @samp{Thur} or @samp{Thurs} for @samp{Thursday} are
also allowed.
@findex next @var{day}
@findex last @var{day}
A number may precede a day of the week item to move forward
supplementary weeks. It is best used in expression like @samp{third
monday}. In this context, @samp{last @var{day}} or @samp{next
@var{day}} is also acceptable; they move one week before or after
the day that @var{day} by itself would represent.
A comma following a day of the week item is ignored.
@node Relative items in date strings
@section Relative items in date strings
@cindex relative items in date strings
@cindex displacement of dates
@dfn{Relative items} adjust a date (or the current date if none) forward
or backward. The effects of relative items accumulate. Here are some
examples:
@example
1 year
1 year ago
3 years
2 days
@end example
@findex year @r{in date strings}
@findex month @r{in date strings}
@findex fortnight @r{in date strings}
@findex week @r{in date strings}
@findex day @r{in date strings}
@findex hour @r{in date strings}
@findex minute @r{in date strings}
The unit of time displacement may be selected by the string @samp{year}
or @samp{month} for moving by whole years or months. These are fuzzy
units, as years and months are not all of equal duration. More precise
units are @samp{fortnight} which is worth 14 days, @samp{week} worth 7
days, @samp{day} worth 24 hours, @samp{hour} worth 60 minutes,
@samp{minute} or @samp{min} worth 60 seconds, and @samp{second} or
@samp{sec} worth one second. An @samp{s} suffix on these units is
accepted and ignored.
@findex ago @r{in date strings}
The unit of time may be preceded by a multiplier, given as an optionally
signed number. Unsigned numbers are taken as positively signed. No
number at all implies 1 for a multiplier. Following a relative item by
the string @samp{ago} is equivalent to preceding the unit by a
multiplier with value @math{-1}.
@findex day @r{in date strings}
@findex tomorrow @r{in date strings}
@findex yesterday @r{in date strings}
The string @samp{tomorrow} is worth one day in the future (equivalent
to @samp{day}), the string @samp{yesterday} is worth
one day in the past (equivalent to @samp{day ago}).
@findex now @r{in date strings}
@findex today @r{in date strings}
@findex this @r{in date strings}
The strings @samp{now} or @samp{today} are relative items corresponding
to zero-valued time displacement, these strings come from the fact
a zero-valued time displacement represents the current time when not
otherwise changed by previous items. They may be used to stress other
items, like in @samp{12:00 today}. The string @samp{this} also has
the meaning of a zero-valued time displacement, but is preferred in
date strings like @samp{this thursday}.
When a relative item causes the resulting date to cross a boundary
where the clocks were adjusted, typically for daylight-saving time,
the resulting date and time are adjusted accordingly.
The fuzz in units can cause problems with relative items. For
example, @samp{2003-07-31 -1 month} might evaluate to 2003-07-01,
because 2003-06-31 is an invalid date. To determine the previous
month more reliably, you can ask for the month before the 15th of the
current month. For example:
@example
$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!
@end example
Also, take care when manipulating dates around clock changes such as
daylight saving leaps. In a few cases these have added or subtracted
as much as 24 hours from the clock, so it is often wise to adopt
universal time by setting the @env{TZ} environment variable to
@samp{UTC0} before embarking on calendrical calculations.
@node Pure numbers in date strings
@section Pure numbers in date strings
@cindex pure numbers in date strings
The precise interpretation of a pure decimal number depends
on the context in the date string.
If the decimal number is of the form @var{yyyy}@var{mm}@var{dd} and no
other calendar date item (@pxref{Calendar date items}) appears before it
in the date string, then @var{yyyy} is read as the year, @var{mm} as the
month number and @var{dd} as the day of the month, for the specified
calendar date.
If the decimal number is of the form @var{hh}@var{mm} and no other time
of day item appears before it in the date string, then @var{hh} is read
as the hour of the day and @var{mm} as the minute of the hour, for the
specified time of the day. @var{mm} can also be omitted.
If both a calendar date and a time of day appear to the left of a number
in the date string, but no relative item, then the number overrides the
year.
@node Seconds since the Epoch
@section Seconds since the Epoch
If you precede a number with @samp{@@}, it represents an internal time
stamp as a count of seconds. The number can contain an internal
decimal point (either @samp{.} or @samp{,}); any excess precision not
supported by the internal representation is truncated toward minus
infinity.
@cindex beginning of time, for @acronym{POSIX}
@cindex epoch, for @acronym{POSIX}
Internally, computer times are represented as a count of seconds since
an epoch---a well-defined point of time. On @acronym{GNU} and
@acronym{POSIX} systems, the epoch is 1970-01-01 00:00:00 @sc{utc}, so
@samp{@@0} represents this time, @samp{@@1} represents 1970-01-01
00:00:01 @sc{utc}, and so forth. @acronym{GNU} and most other
@acronym{POSIX}-compliant systems support such times as an extension
to @acronym{POSIX}, using negative counts, so that @samp{@@-1}
represents 1969-12-31 23:59:59 @sc{utc}.
Traditional Unix systems count seconds with 32-bit two's-complement
integers and can represent times from 1901-12-13 20:45:52 through
2038-01-19 03:14:07 @sc{utc}. More modern systems use 64-bit counts
of seconds with nanosecond subcounts, and can represent all the times
in the known lifetime of the universe to a resolution of 1 nanosecond.
On most systems, these counts ignore the presence of leap seconds.
For example, on most systems @samp{@@915148799} represents 1998-12-31
23:59:59 @sc{utc}, @samp{@@915148800} represents 1999-01-01 00:00:00
@sc{utc}, and there is no way to represent the intervening leap second
1998-12-31 23:59:60 @sc{utc}.
@node Authors of get_date
@section Authors of @code{get_date}
@cindex authors of @code{get_date}
@cindex Bellovin, Steven M.
@cindex Salz, Rich
@cindex Berets, Jim
@cindex MacKenzie, David
@cindex Meyering, Jim
@cindex Eggert, Paul
@code{get_date} was originally implemented by Steven M. Bellovin
(@email{smb@@research.att.com}) while at the University of North Carolina
at Chapel Hill. The code was later tweaked by a couple of people on
Usenet, then completely overhauled by Rich $alz (@email{rsalz@@bbn.com})
and Jim Berets (@email{jberets@@bbn.com}) in August, 1990. Various
revisions for the @sc{gnu} system were made by David MacKenzie, Jim Meyering,
Paul Eggert and others.
@cindex Pinard, F.
@cindex Berry, K.
This chapter was originally produced by Fran@,{c}ois Pinard
(@email{pinard@@iro.umontreal.ca}) from the @file{getdate.y} source code,
and then edited by K.@: Berry (@email{kb@@cs.umb.edu}).

79
doc/index.html.in Normal file
View File

@@ -0,0 +1,79 @@
<!-- X-URL: %BASE_URL% -->
<!-- Date: %DATE% -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>%PACKAGE_NAME% Reference Manual - Table of Contents - GNU Project - Free Software Foundation (FSF)</TITLE>
<LINK REV="made" HREF="mailto:gray@gnu.org">
<BASE HREF="%BASE_URL%">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=US-ASCII">
<META NAME="keywords" CONTENT="tar rmt">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD">
<H1>%PACKAGE_NAME% Reference Manual - Table of Contents</H1>
<ADDRESS>Free Software Foundation</ADDRESS>
<ADDRESS>last updated %UPDATED%</ADDRESS>
<P>
<A HREF="/graphics/gnu-head-sm.jpg"><IMG SRC="/graphics/gnu-head-sm.jpg"
ALT=" [image of the Head of a GNU] "
WIDTH="129" HEIGHT="122">&#32;(jpeg 7k)</A>
<A HREF="/graphics/gnu-head.jpg">(jpeg 21k)</A>
<A HREF="/philosophy/gif.html">no gifs due to patent problems</A>
<P>
<P>
<P><HR><P>
<P>
This manual is available in the following formats:
<P>
<UL>
<LI>formatted in <A HREF="html_mono/%PACKAGE%.html">HTML
(%HTML_SIZE%K characters)</A> entirely on one web page.</LI>
<LI> formatted in <a href="html_chapter/%PACKAGE%_toc.html">HTML</a>
with one web page per chapter.</LI>
<LI> formatted in <a href="html_node/%PACKAGE%_toc.html">HTML</a>
with one web page per node.</LI>
<LI>formatted as an
<A HREF="other/%PACKAGE%.info.tar.gz">Info document (%INFO_TAR_GZ_SIZE%K characters
gzipped tar file)</A>.</LI>
<LI>formatted as
<A HREF="other/%PACKAGE%.text">ASCII text (%TEXT_SIZE%K characters)</A>.</LI>
<LI>formatted as
<A HREF="other/%PACKAGE%.dvi.gz">a TeX dvi file (%DVI_GZ_SIZE%K characters
gzipped)</A>.</LI>
<LI>formatted as
<A href="other/%PACKAGE%.ps.gz">a PostScript file (%PS_GZ_SIZE%K characters
gzipped)</A>.</LI>
<LI>formatted as
<A href="other/%PACKAGE%.pdf.gz">a PDF file (%PDF_GZ_SIZE%K characters
gzipped)</A>.</LI>
<LI>the original
<A HREF="other/%PACKAGE%.texi.tar.gz">Texinfo source (%TEXI_TAR_GZ_SIZE%K characters
gzipped tar file)</A></LI>
</UL>
<P>
<HR>
Return to <A HREF="/home.html">GNU's home page</A>.
<P>
Send FSF &amp; GNU inquiries &amp; questions to
<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>.
Other <A HREF="/home.html#ContactInfo">ways to contact</A> the FSF.
<P>
Comments on these web pages to
<A HREF="mailto:webmasters@www.gnu.org"><EM>webmasters@www.gnu.org</EM></A>,
send other questions to
<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>.
<P>
Copyright (C) 1997, 1998 Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111, USA
<P>
Verbatim copying and distribution of this entire article is
permitted in any medium, provided this notice is preserved.<HR>
</BODY>
</HTML>
<!--
Local Variables:
mode: html
end:
-->

View File

@@ -201,6 +201,11 @@
@set xref-exclude-from @xref{exclude}
@set pxref-exclude-from @pxref{exclude}
@set op-exclude-caches @kbd{--exclude-caches}
@set ref-exclude-from @ref{exclude-caches}
@set xref-exclude-from @xref{exclude-caches}
@set pxref-exclude-from @pxref{exclude-caches}
@set op-extract @kbd{--extract} (@kbd{--get}, @kbd{-x})
@set ref-extract @ref{extract}
@set xref-extract @xref{extract}
@@ -351,7 +356,7 @@
@set xref-owner @xref{Option Summary}
@set pxref-owner @pxref{Option Summary}
@set op-format @kbd{--format}
@set op-format @kbd{--format} (@kbd{-H})
@set ref-format @ref{format}
@set xref-format @xref{format}
@set pxref-format @pxref{format}
@@ -428,10 +433,10 @@
@set xref-starting-file @xref{Scarce}
@set pxref-starting-file @pxref{Scarce}
@set op-strip-path @kbd{--strip-path}
@set ref-strip-path @ref{--strip-path}
@set xref-strip-path @xref{--strip-path}
@set pxref-strip-path @pxref{--strip-path}
@set op-strip-components @kbd{--strip-components}
@set ref-strip-components @ref{--strip-components}
@set xref-strip-components @xref{--strip-components}
@set pxref-strip-components @pxref{--strip-components}
@set op-suffix @kbd{--suffix=@var{suffix}}
@set ref-suffix @ref{Backup options}
@@ -493,6 +498,11 @@
@set xref-volno-file @xref{Using Multiple Tapes}
@set pxref-volno-file @pxref{Using Multiple Tapes}
@set op-seek @kbd{--seek}
@set ref-seek @ref{seek}
@set xref-seek @xref{seek}
@set pxref-seek @pxref{seek}
@c Put everything in one index (arbitrarily chosen to be the concept index).
@syncodeindex fn cp
@syncodeindex ky cp
@@ -1105,8 +1115,9 @@ thing.}
For version 1.12, Daniel Hagerty contributed a great deal of technical
consulting. In particular, he is the primary author of @ref{Backups}.
In July, 2003 @GNUTAR{} was put on CVS at @url{savannah.gnu.org}, and
an active development and maintenance work has started
In July, 2003 @GNUTAR{} was put on CVS at savannah.gnu.org
(see @url{http://savannah.gnu.org/projects/tar}), and
active development and maintenance work has started
again. Currently @GNUTAR{} is being maintained by Paul Eggert, Sergey
Poznyakoff and Jeff Bailey.
@@ -2028,8 +2039,8 @@ $ @kbd{tar -xvf ../untrusted.tar}
@end smallexample
It is also a good practice to examine contents of the archive
before extracting it, using @option{op-list} option, possibly combined
with @option{op-verbose}.
before extracting it, using @value{op-list} option, possibly combined
with @value{op-verbose}.
@node failing commands
@subsection Commands That Will Fail
@@ -2742,6 +2753,11 @@ When performing operations, @command{tar} will skip files that match
Similar to @samp{--exclude}, except @command{tar} will use the list of
patterns in the file @var{file}. @FIXME-xref{}
@item --exclude-caches
Automatically excludes all directories
containing a cache directory tag. @FIXME-xref{}
@item --file=@var{archive}
@itemx -f @var{archive}
@@ -2910,6 +2926,14 @@ multi-volume @command{tar} archive. @FIXME-xref{}
(see --info-script)
@item -n
@itemx --seek
Assume that the archive media supports seeks to arbitrary
locations. Usually @command{tar} determines automatically whether
the archive can be seeked or not. This option is intended for use
in cases when such recognition fails.
@item --newer=@var{date}
@itemx --after-date=@var{date}
@itemx -N
@@ -3266,13 +3290,14 @@ This option affects extraction only; @command{tar} will skip extracting
files in the archive until it finds one that matches @var{name}.
@xref{Scarce}.
@item --strip-path=@var{number}
@item --strip-components=@var{number}
Strip given @var{number} of leading components from file names before
extraction. For example, if archive @file{archive.tar} contained
extraction.@footnote{This option was called @option{--strip-path} in
version 1.14.} For example, if archive @file{archive.tar} contained
@file{/some/file/name}, then running
@smallexample
tar --extract --file archive.tar --strip-path=2
tar --extract --file archive.tar --strip-components=2
@end smallexample
@noindent
@@ -3692,8 +3717,8 @@ The @value{op-totals} option---which is only meaningful when used with
amount written to the archive, after it has been fully created.
The @value{op-checkpoint} option prints an occasional message
as @command{tar} reads or writes the archive. In fact, it print
directory names while reading the archive. It is designed for
as @command{tar} reads or writes the archive. In fact, it prints
a message each 10 records read or written. It is designed for
those who don't need the more detailed (and voluminous) output of
@value{op-block-number}, but do want visual confirmation that @command{tar}
is actually making forward progress.
@@ -4579,7 +4604,7 @@ renamed the whole hierarchy from @file{/usr/local2} to
not be welcome at all that @GNUTAR{} removes the
whole hierarchy just to make room for the link to be reinstated
(unless it @emph{also} simultaneously restores the full
@file{/usr/local2}, of course! @GNUTAR{} is indeed
@file{/usr/local2}, of course!) @GNUTAR{} is indeed
able to remove a whole hierarchy to reestablish a symbolic link, for
example, but @emph{only if} @value{op-recursive-unlink} is specified
to allow this behavior. In any case, single files are silently
@@ -5044,7 +5069,7 @@ distribution.
@end ifclear
This chapter documents both the provided FSF scripts and @command{tar}
This chapter documents both the provided shell scripts and @command{tar}
options which are more specific to usage as a backup tool.
To @dfn{back up} a file system means to create archives that contain
@@ -5287,7 +5312,7 @@ to comparing directories; this is fairly gross, but there does not seem
to be a better way to go.
@command{tar} doesn't access @var{snapshot-file} when
@value{op-create} or @value{op-list} are specified, but the
@value{op-extract} or @value{op-list} are specified, but the
@value{op-listed-incremental} option must still be given. A
placeholder @var{snapshot-file} can be specified, e.g.,
@file{/dev/null}.
@@ -5470,7 +5495,7 @@ located on the remote machine and containing the list of files to
be excluded from the backup. Exclude file lists are searched in
/etc/tar-backup directory. A common use for exclude file lists
is to exclude files containing security-sensitive information
(e.g. @file{/etc/shadow} from backups.
(e.g. @file{/etc/shadow} from backups).
This variable affects only @code{backup}.
@end defvr
@@ -5524,7 +5549,7 @@ mt_begin() @{
@end defvr
@defvr {Backup variable} MT_REWIND
THe name of @dfn{rewind} function. The default definition is as
The name of @dfn{rewind} function. The default definition is as
follows:
@smallexample
@@ -5567,14 +5592,14 @@ mt_status() @{
@subsection User Hooks
@dfn{User hooks} are shell functions executed before and after
each @command{tar} invocations. Thus, there are @dfn{backup
each @command{tar} invocation. Thus, there are @dfn{backup
hooks}, which are executed before and after dumping each file
system, and @dfn{restore hooks}, executed before and
after restoring a file system. Each user hook is a shell function
taking four arguments:
@deffn {User Hook Function} hook @var{level} @var{host} @var{fs} @var{fsname}
The arguments are:
Its arguments are:
@table @var
@item level
@@ -5613,7 +5638,7 @@ Executed after restoring the filesystem.
@node backup-specs example
@subsection An Example Text of @file{Backup-specs}
The following is the text of @file{backup-specs} as it appears at FSF:
The following is an example of @file{backup-specs}:
@smallexample
# site-specific parameters for file system backup.
@@ -5715,8 +5740,8 @@ and files dumped, what time the backup was made, and any error
messages that were generated, as well as how much space was left in
the media volume after the last volume of the archive was written.
You should check this log file after every backup. The file name is
@file{log-@var{mmm-ddd-yyyy}-level-@var{n}}, where @var{n} represents
current dump level number.
@file{log-@var{mm-dd-yyyy}-level-@var{n}}, where @var{mm-dd-yyyy}
represents current date, and @var{n} represents current dump level number.
The script also prints the name of each system being dumped to the
standard output.
@@ -5733,7 +5758,7 @@ Do backup level @var{level} (default 0).
@itemx --force
Force backup even if today's log file already exists.
@item -v@var{level}
@item -v[@var{level}]
@itemx --verbose[=@var{level}]
Set verbosity level. The higher the level is, the more debugging
information will be output during execution. Devault @var{level}
@@ -5762,7 +5787,7 @@ Display program version and exit.
To restore files that were archived using a scripted backup, use the
@code{restore} script. Its usage is quite straightforward. In the
simplest form, invoke @command{restore} without options, it will
simplest form, invoke @code{restore --all}, it will
then restore all the filesystems and files specified in
@file{backup-specs} (@pxref{General-Purpose Variables,BACKUP_DIRS}).
@@ -5800,11 +5825,15 @@ restore --level=1
The full list of options accepted by @code{restore} follows:
@table @option
@item -a
@itemx --all
Restore all filesystems and files specified in @file{backup-specs}
@item -l @var{level}
@itemx --level=@var{level}
Start restoring from the given backup level, instead of the default 0.
@item -v@var{level}
@item -v[@var{level}]
@itemx --verbose[=@var{level}]
Set verbosity level. The higher the level is, the more debugging
information will be output during execution. Devault @var{level}
@@ -6138,6 +6167,24 @@ added to the archive.
@FIXME{do the exclude options files need to have stuff separated by
newlines the same as the files-from option does?}
@table @kbd
@item --exclude-caches
Causes @command{tar} to ignore directories containing a cache directory tag.
@end table
@findex exclude-caches
When creating an archive,
the @samp{--exclude-caches} option
causes @command{tar} to exclude all directories
that contain a @dfn{cache directory tag}.
A cache directory tag is a short file
with the well-known name @file{CACHEDIR.TAG}
and having a standard header
specified in @url{http://www.brynosaurus.com/cachedir/spec.html}.
Various applications write cache directory tags
into directories they use to hold regenerable, non-precious data,
so that such data can be more easily excluded from backups.
@menu
* controlling pattern-patching with exclude::
* problems with exclude::
@@ -6169,8 +6216,9 @@ ignores case when excluding @samp{makefile}, but not when excluding
@table @option
@item --anchored
@itemx --no-anchored
If anchored (the default), a pattern must match an initial subsequence
of the name's components. Otherwise, the pattern can match any subsequence.
If anchored, a pattern must match an initial subsequence
of the name's components. Otherwise, the pattern can match any
subsequence. Default is @option{--no-anchored}.
@item --ignore-case
@itemx --no-ignore-case
@@ -6573,14 +6621,35 @@ relative to the then current directory, which might not be the same as
the original current working directory of @command{tar}, due to a previous
@samp{--directory} option.
@FIXME{dan: does this mean that you *can* use the short option form, but
you can *not* use the long option form with --files-from? or is this
totally screwed?}
When using @samp{--files-from} (@pxref{files}), you can put @samp{-C}
options in the file list. Unfortunately, you cannot put
@samp{--directory} options in the file list. (This interpretation can
be disabled by using the @value{op-null} option.)
options in the file list. Notice, however, that in this case the
option and its argument must occupy two consecutive lines. For
instance, the file list for the above example will be:
@smallexample
@group
-C
/etc
passwd
hosts
-C
/lib
libc.a
@end group
@end smallexample
@noindent
To use it, you would invoke @command{tar} as follows:
@smallexample
$ @kbd{tar -c -f foo.tar --files-from list}
@end smallexample
Notice also that you can only use the short option variant in the file
list, i.e. always use @option{-C}, not @option{--directory}.
The interpretation of @value{op-directory} is disabled by
@value{op-null} option.
@node absolute
@subsection Absolute File Names
@@ -7040,61 +7109,90 @@ it issues a warning, as these time stamps are nonstandard and unportable.
@subsection Creating and Reading Compressed Archives
@cindex Compressed archives
@cindex Storing archives in compressed format
@UNREVISED
@GNUTAR{} is able to create and read compressed archives. It supports
@command{gzip} and @command{bzip2} compression programms. For backward
compatibilty, it also supports @command{compress} command, although
we strongly recommend against using it, since there is a patent
covering the algorithm it uses and you could be sued for patent
infringement merely by running @command{compress}! Besides, it is less
effective than @command{gzip} and @command{bzip2}.
Creating a compressed archive is simple: you just specify a
@dfn{compression option} along with the usual archive creation
commands. The compression option is @option{-z} (@option{--gzip}) to
create a @command{gzip} compressed archive, @option{-j}
(@option{--bzip2}) to create a @command{bzip2} compressed archive, and
@option{-Z} (@option{--compress}) to use @command{compress} program.
For example:
@smallexample
$ @kbd{tar cfz archive.tar.gz .}
@end smallexample
Reading compressed archive is even simpler: you don't need to specify
any additional options as @GNUTAR{} recognizes its format
automatically. Thus, the following commands will list and extract the
archive created in previous example:
@smallexample
# List the compressed archive
$ @kbd{tar tf archive.tar.gz}
# Extract the compressed archive
$ @kbd{tar xf archive.tar.gz}
@end smallexample
The only case when you have to specify a decompression option while
reading the archive is when reading from a pipe or from a tape drive
that does not support random access. However, in this case @GNUTAR{}
will indicate which option you should use. For example:
@smallexample
$ @kbd{cat archive.tar.gz | tar tf -}
tar: Archive is compressed. Use -z option
tar: Error is not recoverable: exiting now
@end smallexample
If you see such diagnostics, just add the suggested option to the
invocation of @GNUTAR{}:
@smallexample
$ @kbd{cat archive.tar.gz | tar tfz -}
@end smallexample
Notice also, that there are several restrictions on operations on
compressed archives. First of all, compressed archives cannot be
modified, i.e. you cannot update (@value{op-update}) them or delete
(@value{op-delete}) members from them. Likewise, you cannot append
another @command{tar} archive to a compressed archive using
@value{op-append}). Secondly, multi-volume archives cannot be
compressed.
The following table summarizes compression options used by @GNUTAR{}.
@table @kbd
@item -z
@itemx --gzip
@itemx --ungzip
Filter the archive through @command{gzip}.
@end table
@FIXME{ach; these two bits orig from "compare" (?). where to put?} Some
format parameters must be taken into consideration when modifying an
archive.@FIXME{???} Compressed archives cannot be modified.
You can use @samp{--gzip} and @samp{--gunzip} on physical devices
(tape drives, etc.) and remote files as well as on normal files; data
to or from such devices or remote files is reblocked by another copy
of the @command{tar} program to enforce the specified (or default) record
size. The default compression parameters are used; if you need to
override them, avoid the @value{op-gzip} option and run @command{gzip}
explicitly. (Or set the @env{GZIP} environment variable.)
The @value{op-gzip} option does not work with the @value{op-multi-volume}
option, or with the @value{op-update}, @value{op-append},
@value{op-concatenate}, or @value{op-delete} operations.
It is not exact to say that @GNUTAR{} is to work in concert
with @command{gzip} in a way similar to @command{zip}, say. Surely, it is
possible that @command{tar} and @command{gzip} be done with a single call,
like in:
override them, set @env{GZIP} environment variable, e.g.:
@smallexample
$ @kbd{tar cfz archive.tar.gz subdir}
$ @kbd{GZIP=--best tar cfz archive.tar.gz subdir}
@end smallexample
@noindent
to save all of @samp{subdir} into a @code{gzip}'ed archive. Later you
can do:
Another way would be to avoid the @value{op-gzip} option and run
@command{gzip} explicitly:
@smallexample
$ @kbd{tar xfz archive.tar.gz}
@end smallexample
@noindent
to explode and unpack.
The difference is that the whole archive is compressed. With
@command{zip}, archive members are archived individually. @command{tar}'s
method yields better compression. On the other hand, one can view the
contents of a @command{zip} archive without having to decompress it. As
for the @command{tar} and @command{gzip} tandem, you need to decompress the
archive to see its contents. However, this may be done without needing
disk space, by using pipes internally:
@smallexample
$ @kbd{tar tfz archive.tar.gz}
$ @kbd{tar cf - subdir | gzip --best -c - > archive.tar.gz}
@end smallexample
@cindex corrupted archives
@@ -7112,7 +7210,6 @@ every volume or file, in case of corrupted archives. Doing so, we might
lose some compressibility. But this would have make recovering easier.
So, there are pros and cons. We'll see!
@table @kbd
@item -j
@itemx --bzip2
Filter the archive through @code{bzip2}. Otherwise like @value{op-gzip}.
@@ -7123,57 +7220,24 @@ Filter the archive through @code{bzip2}. Otherwise like @value{op-gzip}.
Filter the archive through @command{compress}. Otherwise like
@value{op-gzip}.
@item --use-compress-program=@var{prog}
Filter through @var{prog} (must accept @samp{-d}).
@end table
@value{op-compress} stores an archive in compressed format. This
option is useful in saving time over networks and space in pipes, and
when storage space is at a premium. @value{op-compress} causes
@command{tar} to compress when writing the archive, or to uncompress when
reading the archive.
To perform compression and uncompression on the archive, @command{tar}
runs the @command{compress} utility. @command{tar} uses the default
compression parameters; if you need to override them, avoid the
@value{op-compress} option and run the @command{compress} utility
explicitly. It is useful to be able to call the @command{compress}
utility from within @command{tar} because the @command{compress} utility by
itself cannot access remote tape drives.
The @value{op-compress} option will not work in conjunction with the
@value{op-multi-volume} option or the @value{op-append}, @value{op-update}
and @value{op-delete} operations. @xref{Operations}, for
more information on these operations.
If there is no compress utility available, @command{tar} will report an error.
@strong{Please note} that the @command{compress} program may be covered by
a patent, and therefore we recommend you stop using it.
@value{op-bzip2} acts like @value{op-compress}, except that it uses
the @code{bzip2} utility.
@table @kbd
@item --compress
@itemx --uncompress
@itemx -z
@itemx -Z
When this option is specified, @command{tar} will compress (when
writing an archive), or uncompress (when reading an archive). Used in
conjunction with the @value{op-create}, @value{op-extract},
@value{op-list} and @value{op-compare} operations.
@end table
You can have archives be compressed by using the @value{op-gzip} option.
This will arrange for @command{tar} to use the @command{gzip} program to be
used to compress or uncompress the archive wren writing or reading it.
To use the older, obsolete, @command{compress} program, use the
@value{op-compress} option. The @acronym{GNU} Project recommends you not use
The @acronym{GNU} Project recommends you not use
@command{compress}, because there is a patent covering the algorithm it
uses. You could be sued for patent infringement merely by running
@command{compress}.
@item --use-compress-program=@var{prog}
Use external compression program @var{prog}. Use this option if you
have a compression program that @GNUTAR{} does not support. There
are two requirements to which @var{prog} should comply:
First, when called without options, it should read data from standard
input, compress it and output it on standard output.
Secondly, if called with @option{-d} argument, it should do exactly
the opposite, i.e. read the compressed data from the standard input
and produce uncompressed data on the standard output.
@end table
@FIXME{I have one question, or maybe it's a suggestion if there isn't a way
to do it now. I would like to use @value{op-gzip}, but I'd also like
the output to be fed through a program like @acronym{GNU}
@@ -8644,8 +8708,7 @@ head is on. Before writing an archive, you should make sure that no
data on the tape will be overwritten (unless it is no longer needed).
Before reading an archive, you should make sure the tape head is at
the beginning of the archive you want to read. (The @code{restore}
script will find the archive automatically. @FIXME{There is no such
restore script!}@FIXME-xref{Scripted Restoration}@xref{mt}, for
script will find the archive automatically. @FIXME-xref{Scripted Restoration}@xref{mt}, for
an explanation of the tape moving utility.
If you want to add new archive file entries to a tape, you should

View File

@@ -2,16 +2,32 @@
Makefile
Makefile.am
Makefile.in
addext.c
alloca.c
alloca.h
alloca_.h
allocsa.c
allocsa.h
allocsa.valgrind
argmatch.c
argmatch.h
argp-ba.c
argp-eexst.c
argp-fmtstream.c
argp-fmtstream.h
argp-fs-xinl.c
argp-help.c
argp-namefrob.h
argp-parse.c
argp-pv.c
argp-pvh.c
argp-xinl.c
argp.h
backupfile.c
backupfile.h
basename.c
charset.alias
chown.c
config.charset
dirname.c
dirname.h
error.c
@@ -21,13 +37,17 @@ exclude.h
exit.h
exitfail.c
exitfail.h
fchown-stub.c
fileblocks.c
fnmatch.c
fnmatch.h
fnmatch_.h
fnmatch_loop.c
ftruncate.c
full-write.c
full-write.h
getcwd.c
getcwd.h
getdate.c
getdate.h
getdate.y
@@ -38,7 +58,9 @@ getndelim2.h
getopt.c
getopt.h
getopt1.c
getopt_.h
getopt_int.h
getpagesize.h
gettext.h
gettime.c
gettimeofday.c
@@ -48,20 +70,28 @@ human.c
human.h
lchown.c
lchown.h
malloc.c
localcharset.c
localcharset.h
localedir.h
mempcpy.c
mempcpy.h
memset.c
mktime.c
modechange.c
modechange.h
obstack.c
obstack.h
pathmax.h
quote.c
quote.h
quotearg.c
quotearg.h
realloc.c
ref-add.sed
ref-add.sin
ref-del.sed
ref-del.sin
rmdir.c
rmt.h
rtapelib.c
safe-read.c
safe-read.h
safe-write.c
@@ -70,30 +100,43 @@ save-cwd.c
save-cwd.h
savedir.c
savedir.h
setenv.c
setenv.h
stat-macros.h
stdbool.h
stdbool_.h
stpcpy.c
stpcpy.h
strcase.h
strcasecmp.c
strchrnul.c
strchrnul.h
stripslash.c
strncasecmp.c
strndup.c
strndup.h
strnlen.c
strtoimax.c
strtol.c
strtoll.c
strtoul.c
strtoull.c
strtoumax.c
sysexit.h
sysexit_.h
sysexits.h
system.h
time_r.c
time_r.h
timespec.h
unlocked-io.h
unsetenv.c
utime.c
xalloc-die.c
xalloc.h
xgetcwd.c
xgetcwd.h
xmalloc.c
xstrdup.c
xstrtol.c
xstrtol.h
xstrtoul.c

View File

@@ -19,8 +19,19 @@
## 02111-1307, USA.
noinst_LIBRARIES = libtar.a
noinst_HEADERS = system.h localedir.h rmt.h
libtar_a_SOURCES = prepargs.c prepargs.h rtapelib.c
libtar_a_SOURCES = prepargs.c prepargs.h
localedir = $(datadir)/locale
DISTCLEANFILES = localedir.h
localedir.h : Makefile
echo '#define LOCALEDIR "$(localedir)"' >$@
echo "#ifndef DEFAULT_RMT_COMMAND" >> $@
echo "# define DEFAULT_RMT_COMMAND \"$(DEFAULT_RMT_DIR)/`echo \"rmt\" | sed 's,^.*/,,;$(transform)'`$(EXEEXT)\"" >> $@
echo "#endif" >> $@
rtapelib.o: localedir.h
libtar_a_LIBADD = $(LIBOBJS) $(ALLOCA)
libtar_a_DEPENDENCIES = $(libtar_a_LIBADD)
@@ -39,5 +50,7 @@ $(srcdir)/getdate.c: getdate.y
$(YACC) $(YFLAGS) getdate.y && \
mv -f y.tab.c getdate.c
SUFFIXES = .o .c .h
CLEANFILES =
# gnulib modules

View File

@@ -1,6 +1,9 @@
*_gl.m4
Makefile
Makefile.in
alloca.m4
allocsa.m4
argp.m4
backupfile.m4
bison.m4
chown.m4
@@ -9,6 +12,7 @@ codeset.m4
d-ino.m4
dirname.m4
dos.m4
eealloc.m4
error.m4
exclude.m4
exitfail.m4
@@ -16,15 +20,18 @@ extensions.m4
fileblocks.m4
fnmatch.m4
ftruncate.m4
getcwd-path-max.m4
getcwd.m4
getdate.m4
getline.m4
getndelim2.m4
getopt.m4
getpagesize.m4
gettext.m4
gettime.m4
gettimeofday.m4
glibc21.m4
gnulib.m4
hash.m4
human.m4
iconv.m4
@@ -40,17 +47,18 @@ lcmessage.m4
lib-ld.m4
lib-link.m4
lib-prefix.m4
localcharset.m4
longdouble.m4
longlong.m4
mbrtowc.m4
mbstate_t.m4
mempcpy.m4
memset.m4
mktime.m4
modechange.m4
nls.m4
obstack.m4
onceonly.m4
pathmax.m4
po.m4
printf-posix.m4
progtest.m4
@@ -58,10 +66,12 @@ quote.m4
quotearg.m4
restrict.m4
rmdir.m4
rmt.m4
safe-read.m4
safe-write.m4
save-cwd.m4
savedir.m4
setenv.m4
signed.m4
size_max.m4
ssize_t.m4
@@ -70,13 +80,17 @@ stdbool.m4
stdint_h.m4
stpcpy.m4
strcase.m4
strchrnul.m4
strerror_r.m4
strndup.m4
strnlen.m4
strtoimax.m4
strtol.m4
strtoll.m4
strtoul.m4
strtoull.m4
strtoumax.m4
sysexits.m4
time_r.m4
timespec.m4
tm_gmtoff.m4
@@ -94,7 +108,3 @@ xgetcwd.m4
xsize.m4
xstrtol.m4
xstrtoumax.m4
*_gl.m4
gnulib.m4
malloc.m4
realloc.m4

View File

@@ -24,6 +24,9 @@ lib/getopt.c
lib/human.c
lib/quotearg.c
lib/xmalloc.c
lib/rtapelib.c
lib/argp-help.c
rmt/rmt.c
# Package source files
src/buffer.c
@@ -37,8 +40,6 @@ src/list.c
src/mangle.c
src/misc.c
src/names.c
src/rmt.c
src/rtapelib.c
src/tar.c
src/update.c
src/xheader.c

View File

@@ -20,7 +20,7 @@ BACKUP_SBIN_SCRIPTS_LIST=backup restore
libexec_SCRIPTS=@BACKUP_LIBEXEC_SCRIPTS@
AM_INSTALLCHECK_STD_OPTIONS_EXEMPT=backup.sh dump-remind
sbin_SCRIPTS=@BACKUP_SBIN_SCRIPTS@
EXTRA_SCRIPTS=
EXTRA_SCRIPTS=tarcat
EXTRA_DIST=\
backup.sh.in\
backup.in\
@@ -46,4 +46,4 @@ restore: $(srcdir)/restore.in
sed $(SED_CMD) $? > $@
dump-remind: $(srcdir)/dump-remind.in
sed $(SED_CMD) $? > $@
sed $(SED_CMD) $? > $@

View File

@@ -19,7 +19,7 @@
# Load library routines
SYSCONFDIR=${SYSCONFDIR-@sysconfdir@}
. ${LIBPATH-@libexecdir@}/backup.sh
. ${LIBDIR-@libexecdir@}/backup.sh
DUMP_LEVEL=0
TIME=
@@ -187,7 +187,7 @@ message 20 "BACKUP_FILES=$BACKUP_FILES"
backup_host ${remotehost} \
"--listed=`level_log_name temp`" \
"--label='`print_level` backup of ${fs} on ${remotehost} at ${NOW}'" \
-C ${fs} .
-C ${ROOT_FS}${fs} .
# `rsh' doesn't exit with the exit status of the remote command. What
# stupid lossage. TODO: think of a reliable workaround.
@@ -247,7 +247,9 @@ message 20 "BACKUP_FILES=$BACKUP_FILES"
echo "."
) 2>&1 | tee -a "${LOGFILE}"
echo "Sending the dump log to ${ADMINISTRATOR}"
mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}"
if test "${ADMINISTRATOR}" != NONE; then
echo "Sending the dump log to ${ADMINISTRATOR}"
mail -s "Results of backup started ${startdate}" ${ADMINISTRATOR} < "${LOGFILE}"
fi
# EOF

View File

@@ -104,6 +104,10 @@ test_root() {
if [ ! -w ${ROOT_FS-/} ]; then
bailout "The backup must be run as root or else some files will fail to be dumped."
fi
case "${ROOT_FS}" in
*/) ;;
*) ROOT_FS="${ROOT_FS}/"
esac
}
advice() {

View File

@@ -19,14 +19,16 @@
# Load library routines
SYSCONFDIR=${SYSCONFDIR-@sysconfdir@}
. ${LIBPATH-@libexecdir@}/backup.sh
. ${LIBDIR-@libexecdir@}/backup.sh
usage() {
cat - <<EOF
usage: $PROGNAME [OPTIONS] [PATTERN [PATTERN...]]
Options are:
-l, --level=LEVEL Start restoring from backup level LEVEL (default $DUMP_LEVEL).
-a, --all Restore all filesystems.
-l, --level=LEVEL Start restoring from the given backup LEVEL
(default $DUMP_LEVEL).
-v, --verbose[=LEVEL] Set verbosity level. Default 100.
Informational options:
@@ -53,6 +55,9 @@ do
optarg=$opt
fi
case $option in
-a|--a|--al|--all)
RESTORE_ALL=1
;;
--l=*|--le=*|--lev=*|--leve=*|--level=*)
DUMP_LEVEL=$optarg
;;
@@ -85,6 +90,13 @@ do
esac
done
if [ -z "$RESTORE_ALL" ]; then
if [ -z "$PATTERN" ]; then
usage
exit;
fi
fi
init_restore
cat > $LOGFILE <<EOF
This file contains any messages produced by $PROGNAME.
@@ -132,7 +144,7 @@ restore_fs()
LABEL="`print_level $level` backup of ${fs} on ${remotehost} at ${DATE}"
${RESTORE_BEGIN-:} $level $remotehost $fs $fsname
backup_host ${remotehost} \
"--listed=`level_log_name $fs $level`" \
"--listed=\"$FILE\"" \
"--label=\"$LABEL\"" \
-C ${ROOT_FS-/}$fs
${RESTORE_END-:} $level $remotehost $fs $fsname
@@ -164,7 +176,7 @@ restore_files()
LABEL="`print_level $level` backup of miscellaneous files at ${DATE}"
${RESTORE_BEGIN-:} $level $localhost MISC MISC
backup_host ${localhost} \
"--listed=`level_log_name MISC $level`" \
"--listed=\"$FILE\"" \
"--label=\"$LABEL\"" \
-C ${ROOT_FS-/} $@
${RESTORE_END-:} $level $localhost MISC MISC

11
scripts/tarcat Executable file
View File

@@ -0,0 +1,11 @@
#! /bin/sh
# Usage: tarcat volume1 volume2 ...
# concatenates a GNU tar multi-volume archive into a single tar archive.
# Author: Bruno Haible <bruno@clisp.org>
cat "$1"
shift
for f
do
dd skip=1 if="$f"
done

View File

@@ -19,11 +19,8 @@
## 02111-1307, USA.
bin_PROGRAMS = tar
libexec_PROGRAMS = @RMT@
EXTRA_PROGRAMS = rmt
noinst_HEADERS = arith.h common.h rmt.h system.h tar.h
rmt_SOURCES = rmt.c
noinst_HEADERS = arith.h common.h tar.h
tar_SOURCES = \
buffer.c\
compare.c\
@@ -36,26 +33,16 @@ tar_SOURCES = \
mangle.c\
misc.c\
names.c\
rtapelib.c\
sparse.c\
system.c\
tar.c\
update.c\
utf8.c
localedir = $(datadir)/locale
INCLUDES = -I$(top_srcdir)/lib -I../lib
INCLUDES = -I$(top_srcdir)/lib -I../ -I../lib
DISTCLEANFILES = localedir.h
localedir.h : Makefile
echo '#define LOCALEDIR "$(localedir)"' >$@
echo "#ifndef DEFAULT_RMT_COMMAND" >> $@
echo "# define DEFAULT_RMT_COMMAND \"$(libexecdir)/`echo \"rmt\" | sed 's,^.*/,,;$(transform)'`$(EXEEXT)\"" >> $@
echo "#endif" >> $@
tar.o: ../lib/localedir.h
rmt.o tar.o : localedir.h
LDADD = ../lib/libtar.a $(LIBINTL) $(LIBICONV)
LDADD = ../lib/libtar.a $(LIBINTL)
rmt_LDADD = $(LDADD) $(LIB_SETSOCKOPT)
tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)

View File

@@ -19,7 +19,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <signal.h>
@@ -28,7 +28,7 @@
#include <quotearg.h>
#include "common.h"
#include "rmt.h"
#include <rmt.h>
/* Number of retries before giving up on read. */
#define READ_ERROR_MAX 10
@@ -40,6 +40,7 @@
static tarlong prev_written; /* bytes written on previous volumes */
static tarlong bytes_written; /* bytes written on this volume */
static void *record_buffer; /* allocated memory */
/* FIXME: The following variables should ideally be static to this
module. However, this cannot be done yet. The cleanup continues! */
@@ -66,11 +67,14 @@ static pid_t child_pid;
static int read_error_count;
/* Have we hit EOF yet? */
static int hit_eof;
static bool hit_eof;
/* Checkpointing counter */
static int checkpoint;
static bool read_full_records = false;
static bool reading_from_pipe = false;
/* We're reading, but we just read the last block and it's time to update.
Declared in update.c
@@ -114,6 +118,134 @@ clear_read_error_count (void)
read_error_count = 0;
}
/* Time-related functions */
double duration;
void
set_start_time ()
{
#if HAVE_CLOCK_GETTIME
if (clock_gettime (CLOCK_REALTIME, &start_timespec) != 0)
#endif
start_time = time (0);
}
void
compute_duration ()
{
#if HAVE_CLOCK_GETTIME
struct timespec now;
if (clock_gettime (CLOCK_REALTIME, &now) == 0)
duration += ((now.tv_sec - start_timespec.tv_sec)
+ (now.tv_nsec - start_timespec.tv_nsec) / 1e9);
else
#endif
duration += time (NULL) - start_time;
set_start_time ();
}
/* Compression detection */
enum compress_type {
ct_none,
ct_compress,
ct_gzip,
ct_bzip2
};
struct zip_magic
{
enum compress_type type;
unsigned char *magic;
size_t length;
char *program;
char *option;
};
static struct zip_magic magic[] = {
{ ct_none, },
{ ct_compress, "\037\235", 2, "compress", "-Z" },
{ ct_gzip, "\037\213", 2, "gzip", "-z" },
{ ct_bzip2, "BZh", 3, "bzip2", "-j" },
};
#define NMAGIC (sizeof(magic)/sizeof(magic[0]))
#define compress_option(t) magic[t].option
#define compress_program(t) magic[t].program
/* Check if the file FD is a compressed archive. FD is guaranteed to
represent a local file */
enum compress_type
check_compressed_archive (int fd)
{
struct zip_magic *p;
size_t status;
union block buf;
status = read (fd, &buf, sizeof buf);
if (status != sizeof buf)
{
archive_read_error ();
FATAL_ERROR ((0, 0, _("Quitting now.")));
}
lseek (fd, 0, SEEK_SET); /* This will fail if fd==0, but that does not
matter, since we do not handle compressed
stdin anyway */
if (tar_checksum (&buf) == HEADER_SUCCESS)
/* Probably a valid header */
return ct_none;
for (p = magic + 1; p < magic + NMAGIC; p++)
if (memcmp (buf.buffer, p->magic, p->length) == 0)
return p->type;
return ct_none;
}
/* Open an archive named archive_name_array[0]. Detect if it is
a compressed archive of known type and use corresponding decompression
program if so */
int
open_compressed_archive ()
{
enum compress_type type;
int fd = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
MODE_RW, rsh_command_option);
if (fd == -1 || _isrmt (fd))
return fd;
type = check_compressed_archive (fd);
if (type == ct_none)
{
if (rmtlseek (fd, (off_t) 0, SEEK_CUR) != 0)
{
/* Archive may be not seekable. Reopen it. */
rmtclose (fd);
fd = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
MODE_RW, rsh_command_option);
}
return fd;
}
/* FD is not needed any more */
rmtclose (fd);
/* Open compressed archive */
use_compress_program_option = compress_program (type);
child_pid = sys_child_open_for_uncompress ();
read_full_records = reading_from_pipe = true;
return archive;
}
void
print_total_written (void)
{
@@ -121,25 +253,16 @@ print_total_written (void)
char bytes[sizeof (tarlong) * CHAR_BIT];
char abbr[LONGEST_HUMAN_READABLE + 1];
char rate[LONGEST_HUMAN_READABLE + 1];
double seconds;
int human_opts = human_autoscale | human_base_1024 | human_SI | human_B;
#if HAVE_CLOCK_GETTIME
struct timespec now;
if (clock_gettime (CLOCK_REALTIME, &now) == 0)
seconds = ((now.tv_sec - start_timespec.tv_sec)
+ (now.tv_nsec - start_timespec.tv_nsec) / 1e9);
else
#endif
seconds = time (0) - start_time;
sprintf (bytes, TARLONG_FORMAT, written);
/* Amanda 2.4.1p1 looks for "Total bytes written: [0-9][0-9]*". */
fprintf (stderr, _("Total bytes written: %s (%s, %s/s)\n"), bytes,
human_readable (written, abbr, human_opts, 1, 1),
(0 < seconds && written / seconds < (uintmax_t) -1
? human_readable (written / seconds, rate, human_opts, 1, 1)
(0 < duration && written / duration < (uintmax_t) -1
? human_readable (written / duration, rate, human_opts, 1, 1)
: "?"));
}
@@ -156,7 +279,7 @@ reset_eof (void)
{
if (hit_eof)
{
hit_eof = 0;
hit_eof = false;
current_block = record_start;
record_end = record_start + blocking_factor;
access_mode = ACCESS_WRITE;
@@ -176,7 +299,7 @@ find_next_block (void)
flush_archive ();
if (current_block == record_end)
{
hit_eof = 1;
hit_eof = true;
return 0;
}
}
@@ -270,30 +393,28 @@ open_archive (enum access_mode wanted_access)
save_name = 0;
real_s_name = 0;
record_start =
page_aligned_alloc (&record_buffer,
(record_size
+ (multi_volume_option ? 2 * BLOCKSIZE : 0)));
if (multi_volume_option)
{
record_start = valloc (record_size + (2 * BLOCKSIZE));
if (record_start)
record_start += 2;
}
else
record_start = valloc (record_size);
if (!record_start)
FATAL_ERROR ((0, 0, _("Cannot allocate memory for blocking factor %d"),
blocking_factor));
record_start += 2;
current_block = record_start;
record_end = record_start + blocking_factor;
/* When updating the archive, we start with reading. */
access_mode = wanted_access == ACCESS_UPDATE ? ACCESS_READ : wanted_access;
read_full_records = read_full_records_option;
reading_from_pipe = false;
if (use_compress_program_option)
{
switch (wanted_access)
{
case ACCESS_READ:
child_pid = sys_child_open_for_uncompress ();
read_full_records_option = false;
read_full_records = reading_from_pipe = true;
break;
case ACCESS_WRITE:
@@ -311,14 +432,24 @@ open_archive (enum access_mode wanted_access)
}
else if (strcmp (archive_name_array[0], "-") == 0)
{
read_full_records_option = true; /* could be a pipe, be safe */
read_full_records = true; /* could be a pipe, be safe */
if (verify_option)
FATAL_ERROR ((0, 0, _("Cannot verify stdin/stdout archive")));
switch (wanted_access)
{
case ACCESS_READ:
archive = STDIN_FILENO;
{
enum compress_type type;
archive = STDIN_FILENO;
type = check_compressed_archive (archive);
if (type != ct_none)
FATAL_ERROR ((0, 0,
_("Archive is compressed. Use %s option"),
compress_option (type)));
}
break;
case ACCESS_WRITE:
@@ -340,8 +471,7 @@ open_archive (enum access_mode wanted_access)
switch (wanted_access)
{
case ACCESS_READ:
archive = rmtopen (archive_name_array[0], O_RDONLY | O_BINARY,
MODE_RW, rsh_command_option);
archive = open_compressed_archive ();
break;
case ACCESS_WRITE:
@@ -515,17 +645,24 @@ flush_write (void)
if (volume_label_option)
record_start++;
if (strlen (real_s_name) > NAME_FIELD_SIZE)
FATAL_ERROR ((0, 0,
_("%s: file name too long to be stored in a GNU multivolume header"),
quotearg_colon (real_s_name)));
memset (record_start, 0, BLOCKSIZE);
/* FIXME: Michael P Urban writes: [a long name file] is being written
when a new volume rolls around [...] Looks like the wrong value is
being preserved in real_s_name, though. */
strcpy (record_start->header.name, real_s_name);
strncpy (record_start->header.name, real_s_name, NAME_FIELD_SIZE);
record_start->header.typeflag = GNUTYPE_MULTIVOL;
OFF_TO_CHARS (real_s_sizeleft, record_start->header.size);
OFF_TO_CHARS (real_s_totsize - real_s_sizeleft,
record_start->oldgnu_header.offset);
tmp = verbose_option;
verbose_option = 0;
finish_header (&current_stat_info, record_start, -1);
@@ -609,7 +746,7 @@ short_read (size_t status)
left = record_size - status;
while (left % BLOCKSIZE != 0
|| (left && status && read_full_records_option))
|| (left && status && read_full_records))
{
if (status)
while ((status = rmtread (archive, more, left)) == SAFE_READ_ERROR)
@@ -617,15 +754,18 @@ short_read (size_t status)
if (status == 0)
{
char buf[UINTMAX_STRSIZE_BOUND];
if (!reading_from_pipe)
{
char buf[UINTMAX_STRSIZE_BOUND];
WARN((0, 0, _("Read %s bytes from %s"),
STRINGIFY_BIGINT (record_size - left, buf),
*archive_name_cursor));
WARN((0, 0, _("Read %s bytes from %s"),
STRINGIFY_BIGINT (record_size - left, buf),
*archive_name_cursor));
}
break;
}
if (! read_full_records_option)
if (! read_full_records)
{
unsigned long rest = record_size - left;
@@ -645,7 +785,7 @@ short_read (size_t status)
/* FIXME: for size=0, multi-volume support. On the first record, warn
about the problem. */
if (!read_full_records_option && verbose_option > 1
if (!read_full_records && verbose_option > 1
&& record_start_block == 0 && status != 0)
{
unsigned long rsize = (record_size - left) / BLOCKSIZE;
@@ -707,7 +847,7 @@ flush_read (void)
}
/* The condition below used to include
|| (status > 0 && !read_full_records_option)
|| (status > 0 && !read_full_records)
This is incorrect since even if new_volume() succeeds, the
subsequent call to rmtread will overwrite the chunk of data
already read in the buffer, so the processing will fail */
@@ -768,7 +908,7 @@ flush_read (void)
{
uintmax_t s1, s2;
if (cursor->header.typeflag != GNUTYPE_MULTIVOL
|| strcmp (cursor->header.name, real_s_name))
|| strncmp (cursor->header.name, real_s_name, NAME_FIELD_SIZE))
{
WARN ((0, 0, _("%s is not continued on this volume"),
quote (real_s_name)));
@@ -889,6 +1029,42 @@ backspace_output (void)
}
}
off_t
seek_archive (off_t size)
{
off_t start = current_block_ordinal ();
off_t offset;
off_t nrec, nblk;
off_t skipped = (blocking_factor - (current_block - record_start));
size -= skipped * BLOCKSIZE;
if (size < record_size)
return 0;
/* FIXME: flush? */
/* Compute number of records to skip */
nrec = size / record_size;
offset = rmtlseek (archive, nrec * record_size, SEEK_CUR);
if (offset < 0)
return offset;
if (offset % record_size)
FATAL_ERROR ((0, 0, _("rmtlseek not stopped at a record boundary")));
/* Convert to number of records */
offset /= BLOCKSIZE;
/* Compute number of skipped blocks */
nblk = offset - start;
/* Update buffering info */
records_read += nblk / blocking_factor;
record_start_block = offset - blocking_factor;
current_block = record_end;
return nblk;
}
/* Close the archive file. */
void
close_archive (void)
@@ -898,7 +1074,8 @@ close_archive (void)
sys_drain_input_pipe ();
if (verify_option)
compute_duration ();
if (verify_option)
verify_volume ();
if (rmtclose (archive) != 0)
@@ -911,7 +1088,7 @@ close_archive (void)
free (save_name);
if (real_s_name)
free (real_s_name);
free (multi_volume_option ? record_start - 2 : record_start);
free (record_buffer);
}
/* Called to initialize the global volume number. */
@@ -1079,7 +1256,7 @@ new_volume (enum access_mode mode)
if (strcmp (archive_name_cursor[0], "-") == 0)
{
read_full_records_option = true;
read_full_records = true;
archive = STDIN_FILENO;
}
else if (verify_option)

View File

@@ -38,11 +38,6 @@
/* Some various global definitions. */
/* Name of file to use for interacting with user. */
#if MSDOS
# define TTY_NAME "con"
#else
# define TTY_NAME "/dev/tty"
#endif
/* GLOBAL is defined to empty in tar.c only, and left alone in other *.c
modules. Here, we merely set it to "extern" if it is not already set.
@@ -160,11 +155,12 @@ GLOBAL int check_links_option;
/* Patterns that match file names to be excluded. */
GLOBAL struct exclude *excluded;
/* Exclude directories containing a cache directory tag. */
GLOBAL bool exclude_caches_option;
/* Specified file containing names to work on. */
GLOBAL const char *files_from_option;
GLOBAL bool force_local_option;
/* Specified value to be put into tar file in place of stat () results, or
just -1 if such an override should not take place. */
GLOBAL gid_t group_option;
@@ -251,9 +247,9 @@ GLOBAL int same_owner_option;
/* If positive, preserve permissions when extracting. */
GLOBAL int same_permissions_option;
/* When set, strip the given number of path elements from the file name
/* When set, strip the given number of file name components from the file name
before extracting */
GLOBAL size_t strip_path_elements;
GLOBAL size_t strip_name_components;
GLOBAL bool show_omitted_dirs_option;
@@ -331,6 +327,10 @@ struct name
GLOBAL dev_t ar_dev;
GLOBAL ino_t ar_ino;
GLOBAL bool seekable_archive;
GLOBAL dev_t root_device;
/* Declarations for each module. */
@@ -370,6 +370,8 @@ void clear_read_error_count (void);
void xclose (int fd);
void archive_write_error (ssize_t) __attribute__ ((noreturn));
void archive_read_error (void);
off_t seek_archive (off_t size);
void set_start_time (void);
/* Module create.c. */
@@ -440,7 +442,7 @@ void delete_archive_members (void);
char *get_directory_contents (char *, dev_t);
void read_directory_file (void);
void write_directory_file (void);
void gnu_restore (char const *);
void purge_directory (char const *);
/* Module list.c. */
@@ -499,6 +501,7 @@ void print_for_mkdir (char *, int, mode_t);
void print_header (struct tar_stat_info *, off_t);
void read_and (void (*) (void));
enum read_header read_header (bool);
enum read_header tar_checksum (union block *header);
void skip_file (off_t);
void skip_member (void);
@@ -518,7 +521,15 @@ enum remove_option
{
ORDINARY_REMOVE_OPTION,
RECURSIVE_REMOVE_OPTION,
WANT_DIRECTORY_REMOVE_OPTION
/* FIXME: The following value is never used. It seems to be intended
as a placeholder for a hypothetical option that should instruct tar
to recursively remove subdirectories in purge_directory(),
as opposed to the functionality of --recursive-unlink
(RECURSIVE_REMOVE_OPTION value), which removes them in
prepare_to_extract() phase. However, with the addition of more
meta-info to the incremental dumps, this should become unnecessary */
WANT_DIRECTORY_REMOVE_OPTION
};
int remove_any_file (const char *, enum remove_option);
bool maybe_backup_file (const char *, int);
@@ -581,6 +592,8 @@ void write_fatal_details (char const *, ssize_t, size_t)
pid_t xfork (void);
void xpipe (int[2]);
void *page_aligned_alloc (void **, size_t);
/* Module names.c. */
extern struct name *gnu_list_name;
@@ -613,9 +626,12 @@ bool excluded_name (char const *);
void add_avoided_name (char const *);
bool is_avoided_name (char const *);
bool is_individual_file (char const *);
bool contains_dot_dot (char const *);
bool removed_prefixes_p (void);
#define ISFOUND(c) ((occurrence_option == 0) ? (c)->found_count : \
(c)->found_count == occurrence_option)
#define WASFOUND(c) ((occurrence_option == 0) ? (c)->found_count : \
@@ -667,13 +683,10 @@ bool sys_compare_gid (struct stat *a, struct stat *b);
bool sys_file_is_archive (struct tar_stat_info *p);
bool sys_compare_links (struct stat *link_data, struct stat *stat_data);
int sys_truncate (int fd);
void sys_reset_uid_gid (void);
pid_t sys_child_open_for_compress (void);
pid_t sys_child_open_for_uncompress (void);
void sys_reset_uid_gid (void);
size_t sys_write_archive_buffer (void);
bool sys_get_archive_stat (void);
void sys_reset_uid_gid (void);
/* Module compare.c */
void report_difference (struct tar_stat_info *st, const char *message, ...);

View File

@@ -19,7 +19,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#if HAVE_UTIME_H
# include <utime.h>
@@ -38,7 +38,7 @@ struct utimbuf
#include <quotearg.h>
#include "common.h"
#include "rmt.h"
#include <rmt.h>
#include <stdarg.h>
/* Nonzero if we are verifying at the moment. */
@@ -54,9 +54,8 @@ static char *diff_buffer;
void
diff_init (void)
{
diff_buffer = valloc (record_size);
if (!diff_buffer)
xalloc_die ();
void *ptr;
diff_buffer = page_aligned_alloc (&ptr, record_size);
}
/* Sigh about something that differs by writing a MESSAGE to stdlis,
@@ -495,6 +494,14 @@ diff_archive (void)
void
verify_volume (void)
{
if (removed_prefixes_p ())
{
WARN((0, 0,
_("Archive contains file names with leading prefixes removed.")));
WARN((0, 0,
_("Verification may fail to locate original files.")));
}
if (!diff_buffer)
diff_init ();
@@ -556,6 +563,7 @@ verify_volume (void)
do
{
counter++;
set_next_block_after (current_header);
status = read_header (false);
}
while (status == HEADER_FAILURE);
@@ -569,6 +577,8 @@ verify_volume (void)
break;
diff_archive ();
tar_stat_destroy (&current_stat_info);
xheader_destroy (&extended_header);
}
access_mode = ACCESS_WRITE;

View File

@@ -19,7 +19,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#if HAVE_UTIME_H
# include <utime.h>
@@ -406,6 +406,11 @@ write_short_name (struct tar_stat_info *st)
return header;
}
#define FILL(field,byte) do { \
memset(field, byte, sizeof(field)-1); \
(field)[sizeof(field)-1] = 0; \
} while (0)
/* Write a GNUTYPE_LONGLINK or GNUTYPE_LONGNAME block. */
static void
write_gnu_long_link (struct tar_stat_info *st, const char *p, char type)
@@ -413,8 +418,22 @@ write_gnu_long_link (struct tar_stat_info *st, const char *p, char type)
size_t size = strlen (p) + 1;
size_t bufsize;
union block *header;
char *tmpname;
header = start_private_header ("././@LongLink", size);
FILL(header->header.mtime, '0');
FILL(header->header.mode, '0');
FILL(header->header.uid, '0');
FILL(header->header.gid, '0');
FILL(header->header.devmajor, 0);
FILL(header->header.devminor, 0);
uid_to_uname (0, &tmpname);
UNAME_TO_CHARS (tmpname, header->header.uname);
free (tmpname);
gid_to_gname (0, &tmpname);
GNAME_TO_CHARS (tmpname, header->header.gname);
free (tmpname);
strcpy (header->header.magic, OLDGNU_MAGIC);
header->header.typeflag = type;
finish_header (st, header, -1);
@@ -664,7 +683,7 @@ start_header (struct tar_stat_info *st)
else
MAJOR_TO_CHARS (st->devminor, header->header.devminor);
}
else
else if (archive_format != GNU_FORMAT && archive_format != OLDGNU_FORMAT)
{
MAJOR_TO_CHARS (0, header->header.devmajor);
MINOR_TO_CHARS (0, header->header.devminor);
@@ -903,6 +922,47 @@ dump_regular_finish (int fd, struct tar_stat_info *st, time_t original_ctime)
}
}
/* Look in directory DIRNAME for a cache directory tag file
with the magic name "CACHEDIR.TAG" and a standard header,
as described at:
http://www.brynosaurus.com/cachedir
Applications can write this file into directories they create
for use as caches containing purely regenerable, non-precious data,
allowing us to avoid archiving them if --exclude-caches is specified. */
#define CACHEDIR_SIGNATURE "Signature: 8a477f597d28d172789f06886806bc55"
#define CACHEDIR_SIGNATURE_SIZE (sizeof CACHEDIR_SIGNATURE - 1)
static bool
check_cache_directory (char *dirname)
{
static char tagname[] = "CACHEDIR.TAG";
char *tagpath;
int fd;
int tag_present = false;
tagpath = xmalloc (strlen (dirname) + strlen (tagname) + 1);
strcpy (tagpath, dirname);
strcat (tagpath, tagname);
fd = open (tagpath, O_RDONLY);
if (fd >= 0)
{
static char tagbuf[CACHEDIR_SIGNATURE_SIZE];
if (read (fd, tagbuf, CACHEDIR_SIGNATURE_SIZE)
== CACHEDIR_SIGNATURE_SIZE
&& memcmp (tagbuf, CACHEDIR_SIGNATURE, CACHEDIR_SIGNATURE_SIZE) == 0)
tag_present = true;
close (fd);
}
free (tagpath);
return tag_present;
}
static void
dump_dir0 (char *directory,
struct tar_stat_info *st, int top_level, dev_t parent_device)
@@ -993,6 +1053,16 @@ dump_dir0 (char *directory,
return;
}
if (exclude_caches_option
&& check_cache_directory(st->orig_file_name))
{
if (verbose_option)
WARN ((0, 0,
_("%s: contains a cache directory tag; not dumped"),
quotearg_colon (st->orig_file_name)));
return;
}
{
char const *entry;
size_t entry_len;
@@ -1303,16 +1373,19 @@ dump_file0 (struct tar_stat_info *st, char *p,
#endif
/* See if we want only new files, and check if this one is too old to
put in the archive. */
put in the archive.
if (!S_ISDIR (st->stat.st_mode)
This check is omitted if incremental_option is set *and* the
requested file is not explicitely listed in the command line. */
if (!(incremental_option && !is_individual_file (p))
&& !S_ISDIR (st->stat.st_mode)
&& OLDER_STAT_TIME (st->stat, m)
&& (!after_date_option || OLDER_STAT_TIME (st->stat, c)))
{
if (0 < top_level) /* equivalent to !incremental_option */
if (!incremental_option)
WARN ((0, 0, _("%s: file is unchanged; not dumped"),
quotearg_colon (p)));
/* FIXME: recheck this return. */
return;
}

View File

@@ -17,10 +17,10 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include "common.h"
#include "rmt.h"
#include <rmt.h>
static union block *new_record;
static int new_blocks;
@@ -359,33 +359,32 @@ delete_archive_members (void)
write_record (1);
}
}
}
if (logical_status == HEADER_END_OF_FILE)
{
/* Write the end of tape. FIXME: we can't use write_eot here,
as it gets confused when the input is at end of file. */
int total_zero_blocks = 0;
do
if (logical_status == HEADER_END_OF_FILE)
{
int zero_blocks = blocking_factor - new_blocks;
memset (new_record + new_blocks, 0, BLOCKSIZE * zero_blocks);
total_zero_blocks += zero_blocks;
write_record (total_zero_blocks < 2);
/* Write the end of tape. FIXME: we can't use write_eot here,
as it gets confused when the input is at end of file. */
int total_zero_blocks = 0;
do
{
int zero_blocks = blocking_factor - new_blocks;
memset (new_record + new_blocks, 0, BLOCKSIZE * zero_blocks);
total_zero_blocks += zero_blocks;
write_record (total_zero_blocks < 2);
}
while (total_zero_blocks < 2);
}
while (total_zero_blocks < 2);
}
if (! acting_as_filter && ! _isrmt (archive))
{
if (sys_truncate (archive))
truncate_warn (archive_name_array[0]);
}
}
free (new_record);
if (! acting_as_filter && ! _isrmt (archive))
{
if (sys_truncate (archive))
truncate_warn (archive_name_array[0]);
}
close_archive ();
names_notfound ();
}

View File

@@ -19,9 +19,10 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <quotearg.h>
#include <errno.h>
#include <xgetcwd.h>
#if HAVE_UTIME_H
# include <utime.h>
@@ -113,8 +114,20 @@ extr_init (void)
we_are_root = geteuid () == 0;
same_permissions_option += we_are_root;
same_owner_option += we_are_root;
xalloc_fail_func = extract_finish;
/* Save 'root device' to avoid purging mount points.
FIXME: Should the same be done after handling -C option ? */
if (one_file_system_option)
{
struct stat st;
char *dir = xgetcwd ();
if (deref_stat (true, dir, &st))
stat_diag (dir);
else
root_device = st.st_dev;
}
/* Option -p clears the kernel umask, so it does not affect proper
restoration of file permissions. New intermediate directories will
comply with umask at start of program. */
@@ -315,7 +328,7 @@ delay_set_stat (char const *file_name, struct stat const *stat_info,
}
/* Update the delayed_set_stat info for an intermediate directory
created on the path to DIR. The intermediate directory turned
created within the file name of DIR. The intermediate directory turned
out to be the same as this directory, e.g. due to ".." or symbolic
links. *DIR_STAT_INFO is the status of the directory. */
static void
@@ -354,8 +367,8 @@ repair_delayed_set_stat (char const *dir,
static int
make_directories (char *file_name)
{
char *cursor0 = file_name + FILESYSTEM_PREFIX_LEN (file_name);
char *cursor; /* points into path */
char *cursor0 = file_name + FILE_SYSTEM_PREFIX_LEN (file_name);
char *cursor; /* points into the file name */
int did_something = 0; /* did we do anything yet? */
int mode;
int invert_permissions;
@@ -372,7 +385,7 @@ make_directories (char *file_name)
if (cursor == cursor0 || ISSLASH (cursor[-1]))
continue;
/* Avoid mkdir where last part of path is "." or "..". */
/* Avoid mkdir where last part of file name is "." or "..". */
if (cursor[-1] == '.'
&& (cursor == cursor0 + 1 || ISSLASH (cursor[-2])
@@ -380,7 +393,7 @@ make_directories (char *file_name)
&& (cursor == cursor0 + 2 || ISSLASH (cursor[-3])))))
continue;
*cursor = '\0'; /* truncate the path there */
*cursor = '\0'; /* truncate the name there */
mode = MODE_RWX & ~ newdir_umask;
invert_permissions = we_are_root ? 0 : MODE_WXUSR & ~ mode;
status = mkdir (file_name, mode ^ invert_permissions);
@@ -449,7 +462,9 @@ prepare_to_extract (char const *file_name)
switch (old_files_option)
{
case UNLINK_FIRST_OLD_FILES:
if (!remove_any_file (file_name, recursive_unlink_option)
if (!remove_any_file (file_name,
recursive_unlink_option ? RECURSIVE_REMOVE_OPTION
: ORDINARY_REMOVE_OPTION)
&& errno && errno != ENOENT)
{
unlink_error (file_name);
@@ -506,7 +521,7 @@ maybe_recoverable (char *file_name, int *interdir_made)
case NO_OVERWRITE_DIR_OLD_FILES:
case OVERWRITE_OLD_FILES:
{
int r = remove_any_file (file_name, 0);
int r = remove_any_file (file_name, ORDINARY_REMOVE_OPTION);
errno = EEXIST;
return r;
}
@@ -618,9 +633,9 @@ extract_archive (void)
print_header (&current_stat_info, -1);
file_name = safer_name_suffix (current_stat_info.file_name, false);
if (strip_path_elements)
if (strip_name_components)
{
size_t prefix_len = stripped_prefix_len (file_name, strip_path_elements);
size_t prefix_len = stripped_prefix_len (file_name, strip_name_components);
if (prefix_len == (size_t) -1)
{
skip_member ();
@@ -798,8 +813,7 @@ extract_archive (void)
break;
if (absolute_names_option
|| ! (ISSLASH (current_stat_info.link_name
[FILESYSTEM_PREFIX_LEN (current_stat_info.link_name)])
|| ! (IS_ABSOLUTE_FILE_NAME (current_stat_info.link_name)
|| contains_dot_dot (current_stat_info.link_name)))
{
while (status = symlink (current_stat_info.link_name, file_name),
@@ -912,11 +926,12 @@ extract_archive (void)
/* MSDOS does not implement links. However, djgpp's link() actually
copies the file. */
status = link (link_name, file_name);
e = errno;
if (status == 0)
{
struct delayed_symlink *ds = delayed_symlink_head;
if (ds && stat (link_name, &st1) == 0)
if (ds && lstat (link_name, &st1) == 0)
for (; ds; ds = ds->next)
if (ds->dev == st1.st_dev
&& ds->ino == st1.st_ino
@@ -932,17 +947,20 @@ extract_archive (void)
}
break;
}
if ((e == EEXIST && strcmp (link_name, file_name) == 0)
|| (lstat (link_name, &st1) == 0
&& lstat (file_name, &st2) == 0
&& st1.st_dev == st2.st_dev
&& st1.st_ino == st2.st_ino))
break;
errno = e;
if (maybe_recoverable (file_name, &interdir_made))
goto again_link;
if (incremental_option && errno == EEXIST)
break;
e = errno;
if (stat (link_name, &st1) == 0
&& stat (file_name, &st2) == 0
&& st1.st_dev == st2.st_dev
&& st1.st_ino == st2.st_ino)
break;
link_error (link_name, file_name);
if (backup_option)
@@ -1012,7 +1030,7 @@ extract_archive (void)
/* Read the entry and delete files that aren't listed in the
archive. */
gnu_restore (file_name);
purge_directory (file_name);
}
else if (typeflag == GNUTYPE_DUMPDIR)
skip_member ();
@@ -1193,3 +1211,10 @@ fatal_exit (void)
error (TAREXIT_FAILURE, 0, _("Error is not recoverable: exiting now"));
abort ();
}
void
xalloc_die (void)
{
error (0, 0, "%s", _("memory exhausted"));
fatal_exit ();
}

View File

@@ -17,7 +17,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <getline.h>
#include <hash.h>
#include <quotearg.h>
@@ -39,7 +39,7 @@ struct directory
enum children children;
bool nfs;
bool found;
char name[1]; /* path name of directory */
char name[1]; /* file name of directory */
};
static Hash_table *directory_table;
@@ -95,7 +95,7 @@ note_directory (char const *name, dev_t dev, ino_t ino, bool nfs, bool found)
return directory;
}
/* Return a directory entry for a given path NAME, or zero if none found. */
/* Return a directory entry for a given file NAME, or zero if none found. */
static struct directory *
find_directory (char *name)
{
@@ -117,11 +117,11 @@ compare_dirents (const void *first, const void *second)
(*(char *const *) second) + 1);
}
/* Recursively scan the given PATH. */
/* Recursively scan the given directory. */
static void
scan_path (struct obstack *stk, char *path, dev_t device)
scan_directory (struct obstack *stk, char *dir_name, dev_t device)
{
char *dirp = savedir (path); /* for scanning directory */
char *dirp = savedir (dir_name); /* for scanning directory */
char const *entry; /* directory entry being scanned */
size_t entrylen; /* length of directory entry */
char *name_buffer; /* directory, `/', and directory member */
@@ -132,18 +132,18 @@ scan_path (struct obstack *stk, char *path, dev_t device)
if (! dirp)
{
savedir_error (path);
savedir_error (dir_name);
}
errno = 0;
name_buffer_size = strlen (path) + NAME_FIELD_SIZE;
name_buffer_size = strlen (dir_name) + NAME_FIELD_SIZE;
name_buffer = xmalloc (name_buffer_size + 2);
strcpy (name_buffer, path);
if (! ISSLASH (path[strlen (path) - 1]))
strcpy (name_buffer, dir_name);
if (! ISSLASH (dir_name[strlen (dir_name) - 1]))
strcat (name_buffer, "/");
name_length = strlen (name_buffer);
directory = find_directory (path);
directory = find_directory (dir_name);
children = directory ? directory->children : CHANGED_CHILDREN;
if (dirp && children != NO_CHILDREN)
@@ -298,13 +298,13 @@ sort_obstack (struct obstack *stk)
}
char *
get_directory_contents (char *path, dev_t device)
get_directory_contents (char *dir_name, dev_t device)
{
struct obstack stk;
char *buffer;
obstack_init (&stk);
scan_path (&stk, path, device);
scan_directory (&stk, dir_name, device);
buffer = sort_obstack (&stk);
obstack_free (&stk, NULL);
return buffer;
@@ -460,10 +460,9 @@ write_directory_file (void)
/* Restoration of incremental dumps. */
/* Examine the directories under directory_name and delete any
files that were not there at the time of the back-up.
FIXME: The function name is obviously a misnomer */
files that were not there at the time of the back-up. */
void
gnu_restore (char const *directory_name)
purge_directory (char const *directory_name)
{
char *archive_dir;
char *current_dir;
@@ -516,13 +515,30 @@ gnu_restore (char const *directory_name)
}
if (*arc == '\0')
{
struct stat st;
char *p = new_name (directory_name, cur);
if (deref_stat (true, p, &st))
{
stat_diag (p);
WARN((0, 0, _("%s: Not purging directory: unable to stat"),
quotearg_colon (p)));
continue;
}
else if (one_file_system_option && st.st_dev != root_device)
{
WARN((0, 0,
_("%s: directory is on a different device: not purging"),
quotearg_colon (p)));
continue;
}
if (! interactive_option || confirm ("delete", p))
{
if (verbose_option)
fprintf (stdlis, _("%s: Deleting %s\n"),
program_name, quote (p));
if (! remove_any_file (p, 1))
if (! remove_any_file (p, RECURSIVE_REMOVE_OPTION))
{
int e = errno;
ERROR ((0, e, _("%s: Cannot remove"), quotearg_colon (p)));

View File

@@ -22,7 +22,7 @@
/* Define to non-zero for forcing old ctime format instead of ISO format. */
#undef USE_OLD_CTIME
#include "system.h"
#include <system.h>
#include <quotearg.h>
#include "common.h"
@@ -118,6 +118,8 @@ read_and (void (*do_something) (void))
quotearg_colon (current_stat_info.file_name)));
/* Fall through. */
default:
decode_header (current_header,
&current_stat_info, &current_format, 0);
skip_member ();
continue;
}
@@ -264,6 +266,61 @@ list_archive (void)
assign_string (&save_name, 0);
}
/* Check header checksum */
/* The standard BSD tar sources create the checksum by adding up the
bytes in the header as type char. I think the type char was unsigned
on the PDP-11, but it's signed on the Next and Sun. It looks like the
sources to BSD tar were never changed to compute the checksum
correctly, so both the Sun and Next add the bytes of the header as
signed chars. This doesn't cause a problem until you get a file with
a name containing characters with the high bit set. So tar_checksum
computes two checksums -- signed and unsigned. */
enum read_header
tar_checksum (union block *header)
{
size_t i;
int unsigned_sum = 0; /* the POSIX one :-) */
int signed_sum = 0; /* the Sun one :-( */
int recorded_sum;
uintmax_t parsed_sum;
char *p;
p = header->buffer;
for (i = sizeof *header; i-- != 0;)
{
unsigned_sum += (unsigned char) *p;
signed_sum += (signed char) (*p++);
}
if (unsigned_sum == 0)
return HEADER_ZERO_BLOCK;
/* Adjust checksum to count the "chksum" field as blanks. */
for (i = sizeof header->header.chksum; i-- != 0;)
{
unsigned_sum -= (unsigned char) header->header.chksum[i];
signed_sum -= (signed char) (header->header.chksum[i]);
}
unsigned_sum += ' ' * sizeof header->header.chksum;
signed_sum += ' ' * sizeof header->header.chksum;
parsed_sum = from_header (header->header.chksum,
sizeof header->header.chksum, 0,
(uintmax_t) 0,
(uintmax_t) TYPE_MAXIMUM (int));
if (parsed_sum == (uintmax_t) -1)
return HEADER_FAILURE;
recorded_sum = parsed_sum;
if (unsigned_sum != recorded_sum && signed_sum != recorded_sum)
return HEADER_FAILURE;
return HEADER_SUCCESS;
}
/* Read a block that's supposed to be a header block. Return its
address in "current_header", and if it is good, the file's size in
current_stat_info.stat.st_size.
@@ -277,23 +334,9 @@ list_archive (void)
You must always set_next_block_after(current_header) to skip past
the header which this routine reads. */
/* The standard BSD tar sources create the checksum by adding up the
bytes in the header as type char. I think the type char was unsigned
on the PDP-11, but it's signed on the Next and Sun. It looks like the
sources to BSD tar were never changed to compute the checksum
correctly, so both the Sun and Next add the bytes of the header as
signed chars. This doesn't cause a problem until you get a file with
a name containing characters with the high bit set. So read_header
computes two checksums -- signed and unsigned. */
enum read_header
read_header (bool raw_extended_headers)
{
size_t i;
int unsigned_sum; /* the POSIX one :-) */
int signed_sum; /* the Sun one :-( */
int recorded_sum;
uintmax_t parsed_sum;
char *p;
union block *header;
union block *header_copy;
@@ -307,44 +350,15 @@ read_header (bool raw_extended_headers)
while (1)
{
enum read_header status;
header = find_next_block ();
current_header = header;
if (!header)
return HEADER_END_OF_FILE;
unsigned_sum = 0;
signed_sum = 0;
p = header->buffer;
for (i = sizeof *header; i-- != 0;)
{
unsigned_sum += (unsigned char) *p;
signed_sum += (signed char) (*p++);
}
if (unsigned_sum == 0)
return HEADER_ZERO_BLOCK;
/* Adjust checksum to count the "chksum" field as blanks. */
for (i = sizeof header->header.chksum; i-- != 0;)
{
unsigned_sum -= (unsigned char) header->header.chksum[i];
signed_sum -= (signed char) (header->header.chksum[i]);
}
unsigned_sum += ' ' * sizeof header->header.chksum;
signed_sum += ' ' * sizeof header->header.chksum;
parsed_sum = from_header (header->header.chksum,
sizeof header->header.chksum, 0,
(uintmax_t) 0,
(uintmax_t) TYPE_MAXIMUM (int));
if (parsed_sum == (uintmax_t) -1)
return HEADER_FAILURE;
recorded_sum = parsed_sum;
if (unsigned_sum != recorded_sum && signed_sum != recorded_sum)
return HEADER_FAILURE;
if ((status = tar_checksum (header)) != HEADER_SUCCESS)
return status;
/* Good block. Decode file size and return. */
@@ -530,8 +544,10 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
stat_info->stat.st_mode = MODE_FROM_HEADER (header->header.mode);
stat_info->stat.st_mtime = TIME_FROM_HEADER (header->header.mtime);
assign_string (&stat_info->uname, header->header.uname);
assign_string (&stat_info->gname, header->header.gname);
assign_string (&stat_info->uname,
header->header.uname[0] ? header->header.uname : NULL);
assign_string (&stat_info->gname,
header->header.gname[0] ? header->header.gname : NULL);
stat_info->devmajor = MAJOR_FROM_HEADER (header->header.devmajor);
stat_info->devminor = MINOR_FROM_HEADER (header->header.devminor);
@@ -595,6 +611,8 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
sparse_fixup_header (stat_info);
stat_info->is_sparse = true;
}
else
stat_info->is_sparse = false;
}
/* Convert buffer at WHERE0 of size DIGS from external format to
@@ -1202,7 +1220,7 @@ print_header (struct tar_stat_info *st, off_t block_ordinal)
/* Print a similar line when we make a directory automatically. */
void
print_for_mkdir (char *pathname, int length, mode_t mode)
print_for_mkdir (char *dirname, int length, mode_t mode)
{
char modes[11];
@@ -1221,7 +1239,7 @@ print_for_mkdir (char *pathname, int length, mode_t mode)
}
fprintf (stdlis, "%s %*s %.*s\n", modes, ugswidth + DATEWIDTH,
_("Creating directory:"), length, quotearg (pathname));
_("Creating directory:"), length, quotearg (dirname));
}
}
@@ -1237,6 +1255,19 @@ skip_file (off_t size)
save_sizeleft = size;
}
if (seekable_archive)
{
off_t nblk = seek_archive (size);
if (nblk >= 0)
{
size -= nblk * BLOCKSIZE;
if (multi_volume_option) /* Argh.. */
save_sizeleft -= nblk * BLOCKSIZE;
}
else
seekable_archive = false;
}
while (size > 0)
{
x = find_next_block ();
@@ -1250,16 +1281,17 @@ skip_file (off_t size)
}
}
/* Skip the current member in the archive. */
/* Skip the current member in the archive.
NOTE: Current header must be decoded before calling this function. */
void
skip_member (void)
{
char save_typeflag = current_header->header.typeflag;
set_next_block_after (current_header);
assign_string (&save_name, current_stat_info.file_name);
if (sparse_member_p (&current_stat_info))
if (current_stat_info.is_sparse)
sparse_skip_file (&current_stat_info);
else if (save_typeflag != DIRTYPE)
skip_file (current_stat_info.stat.st_size);

View File

@@ -15,7 +15,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include "common.h"
#include <quotearg.h>

View File

@@ -17,8 +17,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include "rmt.h"
#include <system.h>
#include <rmt.h>
#include "common.h"
#include <quotearg.h>
#include <save-cwd.h>
@@ -123,13 +123,13 @@ unquote_string (char *string)
source++;
break;
case 'n':
*destination++ = '\n';
case 'a':
*destination++ = '\a';
source++;
break;
case 't':
*destination++ = '\t';
case 'b':
*destination++ = '\b';
source++;
break;
@@ -138,8 +138,8 @@ unquote_string (char *string)
source++;
break;
case 'b':
*destination++ = '\b';
case 'n':
*destination++ = '\n';
source++;
break;
@@ -148,6 +148,16 @@ unquote_string (char *string)
source++;
break;
case 't':
*destination++ = '\t';
source++;
break;
case 'v':
*destination++ = '\v';
source++;
break;
case '?':
*destination++ = 0177;
source++;
@@ -203,32 +213,33 @@ unquote_string (char *string)
static char *before_backup_name;
static char *after_backup_name;
/* Return 1 if PATH is obviously "." or "/". */
/* Return 1 if FILE_NAME is obviously "." or "/". */
static bool
must_be_dot_or_slash (char const *path)
must_be_dot_or_slash (char const *file_name)
{
path += FILESYSTEM_PREFIX_LEN (path);
file_name += FILE_SYSTEM_PREFIX_LEN (file_name);
if (ISSLASH (path[0]))
if (ISSLASH (file_name[0]))
{
for (;;)
if (ISSLASH (path[1]))
path++;
else if (path[1] == '.' && ISSLASH (path[2 + (path[2] == '.')]))
path += 2 + (path[2] == '.');
if (ISSLASH (file_name[1]))
file_name++;
else if (file_name[1] == '.'
&& ISSLASH (file_name[2 + (file_name[2] == '.')]))
file_name += 2 + (file_name[2] == '.');
else
return ! path[1];
return ! file_name[1];
}
else
{
while (path[0] == '.' && ISSLASH (path[1]))
while (file_name[0] == '.' && ISSLASH (file_name[1]))
{
path += 2;
while (ISSLASH (*path))
path++;
file_name += 2;
while (ISSLASH (*file_name))
file_name++;
}
return ! path[0] || (path[0] == '.' && ! path[1]);
return ! file_name[0] || (file_name[0] == '.' && ! file_name[1]);
}
}
@@ -236,32 +247,32 @@ must_be_dot_or_slash (char const *path)
Report an error with errno set to zero for obvious cases of this;
otherwise call rmdir. */
static int
safer_rmdir (const char *path)
safer_rmdir (const char *file_name)
{
if (must_be_dot_or_slash (path))
if (must_be_dot_or_slash (file_name))
{
errno = 0;
return -1;
}
return rmdir (path);
return rmdir (file_name);
}
/* Remove PATH, returning 1 on success. If PATH is a directory, then
if OPTION is RECURSIVE_REMOVE_OPTION is set remove PATH
recursively; otherwise, remove it only if it is empty. If PATH is
/* Remove FILE_NAME, returning 1 on success. If FILE_NAME is a directory,
then if OPTION is RECURSIVE_REMOVE_OPTION is set remove FILE_NAME
recursively; otherwise, remove it only if it is empty. If FILE_NAME is
a directory that cannot be removed (e.g., because it is nonempty)
and if OPTION is WANT_DIRECTORY_REMOVE_OPTION, then return -1.
Return 0 on error, with errno set; if PATH is obviously the working
Return 0 on error, with errno set; if FILE_NAME is obviously the working
directory return zero with errno set to zero. */
int
remove_any_file (const char *path, enum remove_option option)
remove_any_file (const char *file_name, enum remove_option option)
{
/* Try unlink first if we are not root, as this saves us a system
call in the common case where we're removing a non-directory. */
if (! we_are_root)
{
if (unlink (path) == 0)
if (unlink (file_name) == 0)
return 1;
/* POSIX 1003.1-2001 requires EPERM when attempting to unlink a
@@ -271,13 +282,13 @@ remove_any_file (const char *path, enum remove_option option)
return 0;
}
if (safer_rmdir (path) == 0)
if (safer_rmdir (file_name) == 0)
return 1;
switch (errno)
{
case ENOTDIR:
return we_are_root && unlink (path) == 0;
return we_are_root && unlink (file_name) == 0;
case 0:
case EEXIST:
@@ -294,7 +305,7 @@ remove_any_file (const char *path, enum remove_option option)
case RECURSIVE_REMOVE_OPTION:
{
char *directory = savedir (path);
char *directory = savedir (file_name);
char const *entry;
size_t entrylen;
@@ -305,10 +316,11 @@ remove_any_file (const char *path, enum remove_option option)
(entrylen = strlen (entry)) != 0;
entry += entrylen + 1)
{
char *path_buffer = new_name (path, entry);
int r = remove_any_file (path_buffer, 1);
char *file_name_buffer = new_name (file_name, entry);
int r = remove_any_file (file_name_buffer,
RECURSIVE_REMOVE_OPTION);
int e = errno;
free (path_buffer);
free (file_name_buffer);
if (! r)
{
@@ -319,7 +331,7 @@ remove_any_file (const char *path, enum remove_option option)
}
free (directory);
return safer_rmdir (path) == 0;
return safer_rmdir (file_name) == 0;
}
}
break;
@@ -328,28 +340,28 @@ remove_any_file (const char *path, enum remove_option option)
return 0;
}
/* Check if PATH already exists and make a backup of it right now.
/* Check if FILE_NAME already exists and make a backup of it right now.
Return success (nonzero) only if the backup is either unneeded, or
successful. For now, directories are considered to never need
backup. If THIS_IS_THE_ARCHIVE is nonzero, this is the archive and
so, we do not have to backup block or character devices, nor remote
entities. */
bool
maybe_backup_file (const char *path, int this_is_the_archive)
maybe_backup_file (const char *file_name, int this_is_the_archive)
{
struct stat file_stat;
/* Check if we really need to backup the file. */
if (this_is_the_archive && _remdev (path))
if (this_is_the_archive && _remdev (file_name))
return true;
if (stat (path, &file_stat))
if (stat (file_name, &file_stat))
{
if (errno == ENOENT)
return true;
stat_error (path);
stat_error (file_name);
return false;
}
@@ -360,7 +372,7 @@ maybe_backup_file (const char *path, int this_is_the_archive)
&& (S_ISBLK (file_stat.st_mode) || S_ISCHR (file_stat.st_mode)))
return true;
assign_string (&before_backup_name, path);
assign_string (&before_backup_name, file_name);
/* A run situation may exist between Emacs or other GNU programs trying to
make a backup for the same file simultaneously. If theoretically
@@ -368,7 +380,7 @@ maybe_backup_file (const char *path, int this_is_the_archive)
convention, GNU-wide, for all programs doing backups. */
assign_string (&after_backup_name, 0);
after_backup_name = find_backup_file_name (path, backup_type);
after_backup_name = find_backup_file_name (file_name, backup_type);
if (! after_backup_name)
xalloc_die ();
@@ -915,18 +927,29 @@ xpipe (int fd[2])
call_arg_fatal ("pipe", _("interprocess channel"));
}
/* Return an unambiguous printable representation, allocated in slot N,
for NAME, suitable for diagnostics. */
char const *
quote_n (int n, char const *name)
/* Return PTR, aligned upward to the next multiple of ALIGNMENT.
ALIGNMENT must be nonzero. The caller must arrange for ((char *)
PTR) through ((char *) PTR + ALIGNMENT - 1) to be addressable
locations. */
static inline void *
ptr_align (void *ptr, size_t alignment)
{
return quotearg_n_style (n, locale_quoting_style, name);
char *p0 = ptr;
char *p1 = p0 + alignment - 1;
return p1 - (size_t) p1 % alignment;
}
/* Return an unambiguous printable representation of NAME, suitable
for diagnostics. */
char const *
quote (char const *name)
/* Return the address of a page-aligned buffer of at least SIZE bytes.
The caller should free *PTR when done with the buffer. */
void *
page_aligned_alloc (void **ptr, size_t size)
{
return quote_n (0, name);
size_t alignment = getpagesize ();
size_t size1 = size + alignment;
if (size1 < size)
xalloc_die ();
*ptr = xmalloc (size1);
return ptr_align (*ptr, alignment);
}

View File

@@ -17,7 +17,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <fnmatch.h>
#include <hash.h>
@@ -56,6 +56,8 @@ static char *cached_no_such_gname;
static uid_t cached_no_such_uid;
static gid_t cached_no_such_gid;
static void register_individual_file (char const *name);
/* Given UID, find the corresponding UNAME. */
void
uid_to_uname (uid_t uid, char **uname)
@@ -358,6 +360,8 @@ name_next (int change_dirs)
else
{
unquote_string (name_buffer);
if (incremental_option)
register_individual_file (name_buffer);
return name_buffer;
}
}
@@ -515,10 +519,10 @@ addname (char const *string, int change_dir)
return name;
}
/* Find a match for PATH (whose string length is LENGTH) in the name
/* Find a match for FILE_NAME (whose string length is LENGTH) in the name
list. */
static struct name *
namelist_match (char const *path, size_t length)
namelist_match (char const *file_name, size_t length)
{
struct name *p;
@@ -526,27 +530,27 @@ namelist_match (char const *path, size_t length)
{
/* If first chars don't match, quick skip. */
if (p->firstch && p->name[0] != path[0])
if (p->firstch && p->name[0] != file_name[0])
continue;
if (p->regexp
? fnmatch (p->name, path, recursion_option) == 0
? fnmatch (p->name, file_name, recursion_option) == 0
: (p->length <= length
&& (path[p->length] == '\0'
|| (ISSLASH (path[p->length]) && recursion_option))
&& memcmp (path, p->name, p->length) == 0))
&& (file_name[p->length] == '\0'
|| (ISSLASH (file_name[p->length]) && recursion_option))
&& memcmp (file_name, p->name, p->length) == 0))
return p;
}
return 0;
}
/* Return true if and only if name PATH (from an archive) matches any
/* Return true if and only if name FILE_NAME (from an archive) matches any
name from the namelist. */
int
name_match (const char *path)
name_match (const char *file_name)
{
size_t length = strlen (path);
size_t length = strlen (file_name);
while (1)
{
@@ -563,10 +567,10 @@ name_match (const char *path)
return ! files_from_option;
}
cursor = namelist_match (path, length);
cursor = namelist_match (file_name, length);
if (cursor)
{
if (!(ISSLASH (path[cursor->length]) && recursion_option)
if (!(ISSLASH (file_name[cursor->length]) && recursion_option)
|| cursor->found_count == 0)
cursor->found_count++; /* remember it matched */
if (starting_file_option)
@@ -750,8 +754,8 @@ compare_names (struct name const *n1, struct name const *n2)
static void
add_hierarchy_to_namelist (struct name *name, dev_t device)
{
char *path = name->name;
char *buffer = get_directory_contents (path, device);
char *file_name = name->name;
char *buffer = get_directory_contents (file_name, device);
if (! buffer)
name->dir_contents = "\0\0\0\0";
@@ -768,7 +772,7 @@ add_hierarchy_to_namelist (struct name *name, dev_t device)
int change_dir = name->change_dir;
name->dir_contents = buffer;
strcpy (namebuf, path);
strcpy (namebuf, file_name);
if (! ISSLASH (namebuf[name_length - 1]))
{
namebuf[name_length++] = '/';
@@ -859,13 +863,13 @@ collect_and_sort_names (void)
will have to do that if it wants to. Oh, and if the namelist is
empty, it returns null, unlike name_match, which returns TRUE. */
struct name *
name_scan (const char *path)
name_scan (const char *file_name)
{
size_t length = strlen (path);
size_t length = strlen (file_name);
while (1)
{
struct name *cursor = namelist_match (path, length);
struct name *cursor = namelist_match (file_name, length);
if (cursor)
return cursor;
@@ -916,18 +920,18 @@ blank_name_list (void)
name->found_count = 0;
}
/* Yield a newly allocated file name consisting of PATH concatenated to
NAME, with an intervening slash if PATH does not already end in one. */
/* Yield a newly allocated file name consisting of FILE_NAME concatenated to
NAME, with an intervening slash if FILE_NAME does not already end in one. */
char *
new_name (const char *path, const char *name)
new_name (const char *file_name, const char *name)
{
size_t pathlen = strlen (path);
size_t file_name_len = strlen (file_name);
size_t namesize = strlen (name) + 1;
int slash = pathlen && ! ISSLASH (path[pathlen - 1]);
char *buffer = xmalloc (pathlen + slash + namesize);
memcpy (buffer, path, pathlen);
buffer[pathlen] = '/';
memcpy (buffer + pathlen + slash, name, namesize);
int slash = file_name_len && ! ISSLASH (file_name[file_name_len - 1]);
char *buffer = xmalloc (file_name_len + slash + namesize);
memcpy (buffer, file_name, file_name_len);
buffer[file_name_len] = '/';
memcpy (buffer + file_name_len + slash, name, namesize);
return buffer;
}
@@ -935,7 +939,7 @@ new_name (const char *path, const char *name)
bool
excluded_name (char const *name)
{
return excluded_filename (excluded, name + FILESYSTEM_PREFIX_LEN (name));
return excluded_filename (excluded, name + FILE_SYSTEM_PREFIX_LEN (name));
}
/* Hash tables of strings. */
@@ -1001,7 +1005,44 @@ is_avoided_name (char const *name)
{
return hash_string_lookup (avoided_name_table, name);
}
static Hash_table *individual_file_table;
static void
register_individual_file (char const *name)
{
struct stat st;
if (deref_stat (dereference_option, name, &st) != 0)
return; /* Will be complained about later */
if (S_ISDIR (st.st_mode))
return;
hash_string_insert (&individual_file_table, name);
}
bool
is_individual_file (char const *name)
{
return hash_string_lookup (individual_file_table, name);
}
static Hash_table *prefix_table[2];
/* Return true if file names of some members in the archive were stripped off
their leading components. We could have used
return prefix_table[0] || prefix_table[1]
but the following seems to be safer: */
bool
removed_prefixes_p (void)
{
return (prefix_table[0] && hash_get_n_entries (prefix_table[0]) != 0)
|| (prefix_table[1] && hash_get_n_entries (prefix_table[1]) != 0);
}
/* Return a safer suffix of FILE_NAME, or "." if it has no safer
suffix. Check for fully specified file names and other atrocities.
Warn the user if we do not return NAME. If LINK_TARGET is 1,
@@ -1016,10 +1057,10 @@ safer_name_suffix (char const *file_name, bool link_target)
p = file_name;
else
{
/* Skip file system prefixes, leading pathnames that contain
/* Skip file system prefixes, leading file name components that contain
"..", and leading slashes. */
size_t prefix_len = FILESYSTEM_PREFIX_LEN (file_name);
size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (file_name);
for (p = file_name + prefix_len; *p; )
{
@@ -1041,7 +1082,6 @@ safer_name_suffix (char const *file_name, bool link_target)
if (prefix_len)
{
static Hash_table *prefix_table[2];
char *prefix = alloca (prefix_len + 1);
memcpy (prefix, file_name, prefix_len);
prefix[prefix_len] = '\0';
@@ -1067,7 +1107,7 @@ safer_name_suffix (char const *file_name, bool link_target)
N_("Substituting `.' for empty member name"),
N_("Substituting `.' for empty hard link target")
};
WARN ((0, 0, _(diagnostic[link_target])));
WARN ((0, 0, "%s", _(diagnostic[link_target])));
}
p = ".";
@@ -1077,13 +1117,13 @@ safer_name_suffix (char const *file_name, bool link_target)
}
/* Return the size of the prefix of FILE_NAME that is removed after
stripping NUM leading path name components. NUM must be
stripping NUM leading file name components. NUM must be
positive. */
size_t
stripped_prefix_len (char const *file_name, size_t num)
{
char const *p = file_name + FILESYSTEM_PREFIX_LEN (file_name);
char const *p = file_name + FILE_SYSTEM_PREFIX_LEN (file_name);
while (ISSLASH (*p))
p++;
while (*p)
@@ -1101,11 +1141,11 @@ stripped_prefix_len (char const *file_name, size_t num)
return -1;
}
/* Return nonzero if NAME contains ".." as a path name component. */
/* Return nonzero if NAME contains ".." as a file name component. */
bool
contains_dot_dot (char const *name)
{
char const *p = name + FILESYSTEM_PREFIX_LEN (name);
char const *p = name + FILE_SYSTEM_PREFIX_LEN (name);
for (;; p++)
{

577
src/rmt.c
View File

@@ -1,577 +0,0 @@
/* Remote connection server.
Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2003, 2004
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Copyright (C) 1983 Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms are permitted provided
that the above copyright notice and this paragraph are duplicated in all
such forms and that any documentation, advertising materials, and other
materials related to such distribution and use acknowledge that the
software was developed by the University of California, Berkeley. The
name of the University may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
#include "system.h"
#include <localedir.h>
#include <safe-read.h>
#include <full-write.h>
#include <getopt.h>
#include <sys/socket.h>
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
/* Maximum size of a string from the requesting program. */
#define STRING_SIZE 64
/* Name of executing program. */
const char *program_name;
/* File descriptor of the tape device, or negative if none open. */
static int tape = -1;
/* Buffer containing transferred data, and its allocated size. */
static char *record_buffer;
static size_t allocated_size;
/* Buffer for constructing the reply. */
static char reply_buffer[BUFSIZ];
/* Debugging tools. */
static FILE *debug_file;
#define DEBUG(File) \
if (debug_file) fprintf(debug_file, File)
#define DEBUG1(File, Arg) \
if (debug_file) fprintf(debug_file, File, Arg)
#define DEBUG2(File, Arg1, Arg2) \
if (debug_file) fprintf(debug_file, File, Arg1, Arg2)
/* Return an error string, given an error number. */
#if HAVE_STRERROR
# ifndef strerror
char *strerror ();
# endif
#else
static char *
private_strerror (int errnum)
{
extern char *sys_errlist[];
extern int sys_nerr;
if (errnum > 0 && errnum <= sys_nerr)
return _(sys_errlist[errnum]);
return _("Unknown system error");
}
# define strerror private_strerror
#endif
static void
report_error_message (const char *string)
{
DEBUG1 ("rmtd: E 0 (%s)\n", string);
sprintf (reply_buffer, "E0\n%s\n", string);
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
}
static void
report_numbered_error (int num)
{
DEBUG2 ("rmtd: E %d (%s)\n", num, strerror (num));
sprintf (reply_buffer, "E%d\n%s\n", num, strerror (num));
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
}
static void
get_string (char *string)
{
int counter;
for (counter = 0; ; counter++)
{
if (safe_read (STDIN_FILENO, string + counter, 1) != 1)
exit (EXIT_SUCCESS);
if (string[counter] == '\n' || counter == STRING_SIZE - 1)
break;
}
string[counter] = '\0';
}
static void
prepare_input_buffer (int fd, size_t size)
{
if (size <= allocated_size)
return;
if (record_buffer)
free (record_buffer);
record_buffer = malloc (size);
if (! record_buffer)
{
DEBUG (_("rmtd: Cannot allocate buffer space\n"));
report_error_message (N_("Cannot allocate buffer space"));
exit (EXIT_FAILURE); /* exit status used to be 4 */
}
allocated_size = size;
#ifdef SO_RCVBUF
if (0 <= fd)
{
int isize = size < INT_MAX ? size : INT_MAX;
while (setsockopt (fd, SOL_SOCKET, SO_RCVBUF,
(char *) &isize, sizeof isize)
&& 1024 < isize)
isize >>= 1;
}
#endif
}
/* Decode OFLAG_STRING, which represents the 2nd argument to `open'.
OFLAG_STRING should contain an optional integer, followed by an optional
symbolic representation of an open flag using only '|' to separate its
components (e.g. "O_WRONLY|O_CREAT|O_TRUNC"). Prefer the symbolic
representation if available, falling back on the numeric
representation, or to zero if both formats are absent.
This function should be the inverse of encode_oflag. The numeric
representation is not portable from one host to another, but it is
for backward compatibility with old-fashioned clients that do not
emit symbolic open flags. */
static int
decode_oflag (char const *oflag_string)
{
char *oflag_num_end;
int numeric_oflag = strtol (oflag_string, &oflag_num_end, 10);
int symbolic_oflag = 0;
oflag_string = oflag_num_end;
while (ISSPACE ((unsigned char) *oflag_string))
oflag_string++;
do
{
struct name_value_pair { char const *name; int value; };
static struct name_value_pair const table[] =
{
#ifdef O_APPEND
{"APPEND", O_APPEND},
#endif
{"CREAT", O_CREAT},
#ifdef O_DSYNC
{"DSYNC", O_DSYNC},
#endif
{"EXCL", O_EXCL},
#ifdef O_LARGEFILE
{"LARGEFILE", O_LARGEFILE}, /* LFS extension for opening large files */
#endif
#ifdef O_NOCTTY
{"NOCTTY", O_NOCTTY},
#endif
#ifdef O_NONBLOCK
{"NONBLOCK", O_NONBLOCK},
#endif
{"RDONLY", O_RDONLY},
{"RDWR", O_RDWR},
#ifdef O_RSYNC
{"RSYNC", O_RSYNC},
#endif
#ifdef O_SYNC
{"SYNC", O_SYNC},
#endif
{"TRUNC", O_TRUNC},
{"WRONLY", O_WRONLY}
};
struct name_value_pair const *t;
size_t s;
if (*oflag_string++ != 'O' || *oflag_string++ != '_')
return numeric_oflag;
for (t = table;
(strncmp (oflag_string, t->name, s = strlen (t->name)) != 0
|| (oflag_string[s]
&& strchr ("ABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789",
oflag_string[s])));
t++)
if (t == table + sizeof table / sizeof *table - 1)
return numeric_oflag;
symbolic_oflag |= t->value;
oflag_string += s;
}
while (*oflag_string++ == '|');
return symbolic_oflag;
}
static struct option const long_opts[] =
{
{"help", no_argument, 0, 'h'},
{"version", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
static void usage (int) __attribute__ ((noreturn));
static void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("\
Usage: %s [OPTION]\n\
Manipulate a tape drive, accepting commands from a remote process.\n\
\n\
--version Output version info.\n\
--help Output this help.\n"),
program_name);
printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
}
exit (status);
}
int
main (int argc, char *const *argv)
{
char command;
size_t status;
/* FIXME: Localization is meaningless, unless --help and --version are
locally used. Localization would be best accomplished by the calling
tar, on messages found within error packets. */
program_name = argv[0];
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
switch (getopt_long (argc, argv, "", long_opts, NULL))
{
default:
usage (EXIT_FAILURE);
case 'h':
usage (EXIT_SUCCESS);
case 'v':
{
printf ("rmt (%s) %s\n%s\n", PACKAGE_NAME, PACKAGE_VERSION,
"Copyright (C) 2004 Free Software Foundation, Inc.");
puts (_("\
This program comes with NO WARRANTY, to the extent permitted by law.\n\
You may redistribute it under the terms of the GNU General Public License;\n\
see the file named COPYING for details."));
}
return EXIT_SUCCESS;
case -1:
break;
}
if (optind < argc)
{
if (optind != argc - 1)
usage (EXIT_FAILURE);
debug_file = fopen (argv[optind], "w");
if (debug_file == 0)
{
report_numbered_error (errno);
return EXIT_FAILURE;
}
setbuf (debug_file, 0);
}
top:
errno = 0;
status = 0;
if (safe_read (STDIN_FILENO, &command, 1) != 1)
return EXIT_SUCCESS;
switch (command)
{
/* FIXME: Maybe 'H' and 'V' for --help and --version output? */
case 'O':
{
char device_string[STRING_SIZE];
char oflag_string[STRING_SIZE];
get_string (device_string);
get_string (oflag_string);
DEBUG2 ("rmtd: O %s %s\n", device_string, oflag_string);
if (tape >= 0)
close (tape);
tape = open (device_string, decode_oflag (oflag_string), MODE_RW);
if (tape < 0)
goto ioerror;
goto respond;
}
case 'C':
{
char device_string[STRING_SIZE];
get_string (device_string); /* discard */
DEBUG ("rmtd: C\n");
if (close (tape) < 0)
goto ioerror;
tape = -1;
goto respond;
}
case 'L':
{
char count_string[STRING_SIZE];
char position_string[STRING_SIZE];
off_t count = 0;
int negative;
int whence;
char *p;
get_string (count_string);
get_string (position_string);
DEBUG2 ("rmtd: L %s %s\n", count_string, position_string);
/* Parse count_string, taking care to check for overflow.
We can't use standard functions,
since off_t might be longer than long. */
for (p = count_string; *p == ' ' || *p == '\t'; p++)
continue;
negative = *p == '-';
p += negative || *p == '+';
for (;;)
{
int digit = *p++ - '0';
if (9 < (unsigned) digit)
break;
else
{
off_t c10 = 10 * count;
off_t nc = negative ? c10 - digit : c10 + digit;
if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
{
report_error_message (N_("Seek offset out of range"));
return EXIT_FAILURE;
}
count = nc;
}
}
switch (atoi (position_string))
{
case 0: whence = SEEK_SET; break;
case 1: whence = SEEK_CUR; break;
case 2: whence = SEEK_END; break;
default:
report_error_message (N_("Seek direction out of range"));
return EXIT_FAILURE;
}
count = lseek (tape, count, whence);
if (count < 0)
goto ioerror;
/* Convert count back to string for reply.
We can't use sprintf, since off_t might be longer than long. */
p = count_string + sizeof count_string;
*--p = '\0';
do
*--p = '0' + (int) (count % 10);
while ((count /= 10) != 0);
DEBUG1 ("rmtd: A %s\n", p);
sprintf (reply_buffer, "A%s\n", p);
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
goto top;
}
case 'W':
{
char count_string[STRING_SIZE];
size_t size;
size_t counter;
get_string (count_string);
size = atol (count_string);
DEBUG1 ("rmtd: W %s\n", count_string);
prepare_input_buffer (STDIN_FILENO, size);
for (counter = 0; counter < size; counter += status)
{
status = safe_read (STDIN_FILENO, &record_buffer[counter],
size - counter);
if (status == SAFE_READ_ERROR || status == 0)
{
DEBUG (_("rmtd: Premature eof\n"));
report_error_message (N_("Premature end of file"));
return EXIT_FAILURE; /* exit status used to be 2 */
}
}
status = full_write (tape, record_buffer, size);
if (status != size)
goto ioerror;
goto respond;
}
case 'R':
{
char count_string[STRING_SIZE];
size_t size;
get_string (count_string);
DEBUG1 ("rmtd: R %s\n", count_string);
size = atol (count_string);
prepare_input_buffer (-1, size);
status = safe_read (tape, record_buffer, size);
if (status == SAFE_READ_ERROR)
goto ioerror;
sprintf (reply_buffer, "A%lu\n", (unsigned long int) status);
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
full_write (STDOUT_FILENO, record_buffer, status);
goto top;
}
case 'I':
{
char operation_string[STRING_SIZE];
char count_string[STRING_SIZE];
get_string (operation_string);
get_string (count_string);
DEBUG2 ("rmtd: I %s %s\n", operation_string, count_string);
#ifdef MTIOCTOP
{
struct mtop mtop;
const char *p;
off_t count = 0;
int negative;
/* Parse count_string, taking care to check for overflow.
We can't use standard functions,
since off_t might be longer than long. */
for (p = count_string; *p == ' ' || *p == '\t'; p++)
continue;
negative = *p == '-';
p += negative || *p == '+';
for (;;)
{
int digit = *p++ - '0';
if (9 < (unsigned) digit)
break;
else
{
off_t c10 = 10 * count;
off_t nc = negative ? c10 - digit : c10 + digit;
if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
{
report_error_message (N_("Seek offset out of range"));
return EXIT_FAILURE;
}
count = nc;
}
}
mtop.mt_count = count;
if (mtop.mt_count != count)
{
report_error_message (N_("Seek offset out of range"));
return EXIT_FAILURE;
}
mtop.mt_op = atoi (operation_string);
if (ioctl (tape, MTIOCTOP, (char *) &mtop) < 0)
goto ioerror;
}
#endif
goto respond;
}
case 'S': /* status */
{
DEBUG ("rmtd: S\n");
#ifdef MTIOCGET
{
struct mtget operation;
if (ioctl (tape, MTIOCGET, (char *) &operation) < 0)
goto ioerror;
status = sizeof operation;
sprintf (reply_buffer, "A%ld\n", (long) status);
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
full_write (STDOUT_FILENO, (char *) &operation, sizeof operation);
}
#endif
goto top;
}
default:
DEBUG1 (_("rmtd: Garbage command %c\n"), command);
report_error_message (N_("Garbage command"));
return EXIT_FAILURE; /* exit status used to be 3 */
}
respond:
DEBUG1 ("rmtd: A %ld\n", (long) status);
sprintf (reply_buffer, "A%ld\n", (long) status);
full_write (STDOUT_FILENO, reply_buffer, strlen (reply_buffer));
goto top;
ioerror:
report_numbered_error (errno);
goto top;
}

View File

@@ -1,95 +0,0 @@
/* Definitions for communicating with a remote tape drive.
Copyright (C) 1988, 1992, 1996, 1997, 2001, 2003, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
extern char *rmt_path__;
int rmt_open__ (const char *, int, int, const char *);
int rmt_close__ (int);
size_t rmt_read__ (int, char *, size_t);
size_t rmt_write__ (int, char *, size_t);
off_t rmt_lseek__ (int, off_t, int);
int rmt_ioctl__ (int, int, char *);
/* A filename is remote if it contains a colon not preceded by a slash,
to take care of `/:/' which is a shorthand for `/.../<CELL-NAME>/fs'
on machines running OSF's Distributing Computing Environment (DCE) and
Distributed File System (DFS). However, when --force-local, a
filename is never remote. */
#define _remdev(Path) \
(!force_local_option && (rmt_path__ = strchr (Path, ':')) \
&& rmt_path__ > (Path) && ! memchr (Path, '/', rmt_path__ - (Path)))
#define _isrmt(Fd) \
((Fd) >= __REM_BIAS)
#define __REM_BIAS (1 << 30)
#ifndef O_CREAT
# define O_CREAT 01000
#endif
#define rmtopen(Path, Oflag, Mode, Command) \
(_remdev (Path) ? rmt_open__ (Path, Oflag, __REM_BIAS, Command) \
: open (Path, Oflag, Mode))
#define rmtaccess(Path, Amode) \
(_remdev (Path) ? 0 : access (Path, Amode))
#define rmtstat(Path, Buffer) \
(_remdev (Path) ? (errno = EOPNOTSUPP), -1 : stat (Path, Buffer))
#define rmtcreat(Path, Mode, Command) \
(_remdev (Path) \
? rmt_open__ (Path, 1 | O_CREAT, __REM_BIAS, Command) \
: creat (Path, Mode))
#define rmtlstat(Path, Buffer) \
(_remdev (Path) ? (errno = EOPNOTSUPP), -1 : lstat (Path, Buffer))
#define rmtread(Fd, Buffer, Length) \
(_isrmt (Fd) ? rmt_read__ (Fd - __REM_BIAS, Buffer, Length) \
: safe_read (Fd, Buffer, Length))
#define rmtwrite(Fd, Buffer, Length) \
(_isrmt (Fd) ? rmt_write__ (Fd - __REM_BIAS, Buffer, Length) \
: full_write (Fd, Buffer, Length))
#define rmtlseek(Fd, Offset, Where) \
(_isrmt (Fd) ? rmt_lseek__ (Fd - __REM_BIAS, Offset, Where) \
: lseek (Fd, Offset, Where))
#define rmtclose(Fd) \
(_isrmt (Fd) ? rmt_close__ (Fd - __REM_BIAS) : close (Fd))
#define rmtioctl(Fd, Request, Argument) \
(_isrmt (Fd) ? rmt_ioctl__ (Fd - __REM_BIAS, Request, Argument) \
: ioctl (Fd, Request, Argument))
#define rmtdup(Fd) \
(_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : dup (Fd))
#define rmtfstat(Fd, Buffer) \
(_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : fstat (Fd, Buffer))
#define rmtfcntl(Fd, Command, Argument) \
(_isrmt (Fd) ? (errno = EOPNOTSUPP), -1 : fcntl (Fd, Command, Argument))
#define rmtisatty(Fd) \
(_isrmt (Fd) ? 0 : isatty (Fd))

View File

@@ -1,734 +0,0 @@
/* Functions for communicating with a remote tape drive.
Copyright 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2004 Free
Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The man page rmt(8) for /etc/rmt documents the remote mag tape protocol
which rdump and rrestore use. Unfortunately, the man page is *WRONG*.
The author of the routines I'm including originally wrote his code just
based on the man page, and it didn't work, so he went to the rdump source
to figure out why. The only thing he had to change was to check for the
'F' return code in addition to the 'E', and to separate the various
arguments with \n instead of a space. I personally don't think that this
is much of a problem, but I wanted to point it out. -- Arnold Robbins
Originally written by Jeff Lee, modified some by Arnold Robbins. Redone
as a library that can replace open, read, write, etc., by Fred Fish, with
some additional work by Arnold Robbins. Modified to make all rmt* calls
into macros for speed by Jay Fenlason. Use -DWITH_REXEC for rexec
code, courtesy of Dan Kegel. */
#include "system.h"
#include "common.h"
#include <safe-read.h>
#include <full-write.h>
/* Try hard to get EOPNOTSUPP defined. 486/ISC has it in net/errno.h,
3B2/SVR3 has it in sys/inet.h. Otherwise, like on MSDOS, use EINVAL. */
#ifndef EOPNOTSUPP
# if HAVE_NET_ERRNO_H
# include <net/errno.h>
# endif
# if HAVE_SYS_INET_H
# include <sys/inet.h>
# endif
# ifndef EOPNOTSUPP
# define EOPNOTSUPP EINVAL
# endif
#endif
#include <signal.h>
#if HAVE_NETDB_H
# include <netdb.h>
#endif
#include "rmt.h"
/* Exit status if exec errors. */
#define EXIT_ON_EXEC_ERROR 128
/* FIXME: Size of buffers for reading and writing commands to rmt. */
#define COMMAND_BUFFER_SIZE 64
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif
/* FIXME: Maximum number of simultaneous remote tape connections. */
#define MAXUNIT 4
#define PREAD 0 /* read file descriptor from pipe() */
#define PWRITE 1 /* write file descriptor from pipe() */
/* Return the parent's read side of remote tape connection Fd. */
#define READ_SIDE(Fd) (from_remote[Fd][PREAD])
/* Return the parent's write side of remote tape connection Fd. */
#define WRITE_SIDE(Fd) (to_remote[Fd][PWRITE])
/* The pipes for receiving data from remote tape drives. */
static int from_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
/* The pipes for sending data to remote tape drives. */
static int to_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
#define RMT_COMMAND (rmt_command_option ? rmt_command_option : "/etc/rmt")
/* Temporary variable used by macros in rmt.h. */
char *rmt_path__;
/* Close remote tape connection HANDLE, and reset errno to ERRNO_VALUE. */
static void
_rmt_shutdown (int handle, int errno_value)
{
close (READ_SIDE (handle));
close (WRITE_SIDE (handle));
READ_SIDE (handle) = -1;
WRITE_SIDE (handle) = -1;
errno = errno_value;
}
/* Attempt to perform the remote tape command specified in BUFFER on
remote tape connection HANDLE. Return 0 if successful, -1 on
error. */
static int
do_command (int handle, const char *buffer)
{
/* Save the current pipe handler and try to make the request. */
size_t length = strlen (buffer);
RETSIGTYPE (*pipe_handler) () = signal (SIGPIPE, SIG_IGN);
ssize_t written = full_write (WRITE_SIDE (handle), buffer, length);
signal (SIGPIPE, pipe_handler);
if (written == length)
return 0;
/* Something went wrong. Close down and go home. */
_rmt_shutdown (handle, EIO);
return -1;
}
static char *
get_status_string (int handle, char *command_buffer)
{
char *cursor;
int counter;
/* Read the reply command line. */
for (counter = 0, cursor = command_buffer;
counter < COMMAND_BUFFER_SIZE;
counter++, cursor++)
{
if (safe_read (READ_SIDE (handle), cursor, 1) != 1)
{
_rmt_shutdown (handle, EIO);
return 0;
}
if (*cursor == '\n')
{
*cursor = '\0';
break;
}
}
if (counter == COMMAND_BUFFER_SIZE)
{
_rmt_shutdown (handle, EIO);
return 0;
}
/* Check the return status. */
for (cursor = command_buffer; *cursor; cursor++)
if (*cursor != ' ')
break;
if (*cursor == 'E' || *cursor == 'F')
{
/* Skip the error message line. */
/* FIXME: there is better to do than merely ignoring error messages
coming from the remote end. Translate them, too... */
{
char character;
while (safe_read (READ_SIDE (handle), &character, 1) == 1)
if (character == '\n')
break;
}
errno = atoi (cursor + 1);
if (*cursor == 'F')
_rmt_shutdown (handle, errno);
return 0;
}
/* Check for mis-synced pipes. */
if (*cursor != 'A')
{
_rmt_shutdown (handle, EIO);
return 0;
}
/* Got an `A' (success) response. */
return cursor + 1;
}
/* Read and return the status from remote tape connection HANDLE. If
an error occurred, return -1 and set errno. */
static long int
get_status (int handle)
{
char command_buffer[COMMAND_BUFFER_SIZE];
const char *status = get_status_string (handle, command_buffer);
if (status)
{
long int result = atol (status);
if (0 <= result)
return result;
errno = EIO;
}
return -1;
}
static off_t
get_status_off (int handle)
{
char command_buffer[COMMAND_BUFFER_SIZE];
const char *status = get_status_string (handle, command_buffer);
if (! status)
return -1;
else
{
/* Parse status, taking care to check for overflow.
We can't use standard functions,
since off_t might be longer than long. */
off_t count = 0;
int negative;
for (; *status == ' ' || *status == '\t'; status++)
continue;
negative = *status == '-';
status += negative || *status == '+';
for (;;)
{
int digit = *status++ - '0';
if (9 < (unsigned) digit)
break;
else
{
off_t c10 = 10 * count;
off_t nc = negative ? c10 - digit : c10 + digit;
if (c10 / 10 != count || (negative ? c10 < nc : nc < c10))
return -1;
count = nc;
}
}
return count;
}
}
#if WITH_REXEC
/* Execute /etc/rmt as user USER on remote system HOST using rexec.
Return a file descriptor of a bidirectional socket for stdin and
stdout. If USER is zero, use the current username.
By default, this code is not used, since it requires that the user
have a .netrc file in his/her home directory, or that the
application designer be willing to have rexec prompt for login and
password info. This may be unacceptable, and .rhosts files for use
with rsh are much more common on BSD systems. */
static int
_rmt_rexec (char *host, char *user)
{
int saved_stdin = dup (STDIN_FILENO);
int saved_stdout = dup (STDOUT_FILENO);
struct servent *rexecserv;
int result;
/* When using cpio -o < filename, stdin is no longer the tty. But the
rexec subroutine reads the login and the passwd on stdin, to allow
remote execution of the command. So, reopen stdin and stdout on
/dev/tty before the rexec and give them back their original value
after. */
if (! freopen ("/dev/tty", "r", stdin))
freopen ("/dev/null", "r", stdin);
if (! freopen ("/dev/tty", "w", stdout))
freopen ("/dev/null", "w", stdout);
if (rexecserv = getservbyname ("exec", "tcp"), !rexecserv)
error (EXIT_ON_EXEC_ERROR, 0, _("exec/tcp: Service not available"));
result = rexec (&host, rexecserv->s_port, user, 0, RMT_COMMAND, 0);
if (fclose (stdin) == EOF)
error (0, errno, _("stdin"));
fdopen (saved_stdin, "r");
if (fclose (stdout) == EOF)
error (0, errno, _("stdout"));
fdopen (saved_stdout, "w");
return result;
}
#endif /* WITH_REXEC */
/* Place into BUF a string representing OFLAG, which must be suitable
as argument 2 of `open'. BUF must be large enough to hold the
result. This function should generate a string that decode_oflag
can parse. */
static void
encode_oflag (char *buf, int oflag)
{
sprintf (buf, "%d ", oflag);
switch (oflag & O_ACCMODE)
{
case O_RDONLY: strcat (buf, "O_RDONLY"); break;
case O_RDWR: strcat (buf, "O_RDWR"); break;
case O_WRONLY: strcat (buf, "O_WRONLY"); break;
default: abort ();
}
#ifdef O_APPEND
if (oflag & O_APPEND) strcat (buf, "|O_APPEND");
#endif
if (oflag & O_CREAT) strcat (buf, "|O_CREAT");
#ifdef O_DSYNC
if (oflag & O_DSYNC) strcat (buf, "|O_DSYNC");
#endif
if (oflag & O_EXCL) strcat (buf, "|O_EXCL");
#ifdef O_LARGEFILE
if (oflag & O_LARGEFILE) strcat (buf, "|O_LARGEFILE");
#endif
#ifdef O_NOCTTY
if (oflag & O_NOCTTY) strcat (buf, "|O_NOCTTY");
#endif
#ifdef O_NONBLOCK
if (oflag & O_NONBLOCK) strcat (buf, "|O_NONBLOCK");
#endif
#ifdef O_RSYNC
if (oflag & O_RSYNC) strcat (buf, "|O_RSYNC");
#endif
#ifdef O_SYNC
if (oflag & O_SYNC) strcat (buf, "|O_SYNC");
#endif
if (oflag & O_TRUNC) strcat (buf, "|O_TRUNC");
}
/* Open a file (a magnetic tape device?) on the system specified in
PATH, as the given user. PATH has the form `[USER@]HOST:FILE'.
OPEN_MODE is O_RDONLY, O_WRONLY, etc. If successful, return the
remote pipe number plus BIAS. REMOTE_SHELL may be overridden. On
error, return -1. */
int
rmt_open__ (const char *path, int open_mode, int bias, const char *remote_shell)
{
int remote_pipe_number; /* pseudo, biased file descriptor */
char *path_copy ; /* copy of path string */
char *remote_host; /* remote host name */
char *remote_file; /* remote file name (often a device) */
char *remote_user; /* remote user name */
/* Find an unused pair of file descriptors. */
for (remote_pipe_number = 0;
remote_pipe_number < MAXUNIT;
remote_pipe_number++)
if (READ_SIDE (remote_pipe_number) == -1
&& WRITE_SIDE (remote_pipe_number) == -1)
break;
if (remote_pipe_number == MAXUNIT)
{
errno = EMFILE;
return -1;
}
/* Pull apart the system and device, and optional user. */
{
char *cursor;
path_copy = xstrdup (path);
remote_host = path_copy;
remote_user = 0;
remote_file = 0;
for (cursor = path_copy; *cursor; cursor++)
switch (*cursor)
{
default:
break;
case '\n':
/* Do not allow newlines in the path, since the protocol
uses newline delimiters. */
free (path_copy);
errno = ENOENT;
return -1;
case '@':
if (!remote_user)
{
remote_user = remote_host;
*cursor = '\0';
remote_host = cursor + 1;
}
break;
case ':':
if (!remote_file)
{
*cursor = '\0';
remote_file = cursor + 1;
}
break;
}
}
/* FIXME: Should somewhat validate the decoding, here. */
if (remote_user && *remote_user == '\0')
remote_user = 0;
#if WITH_REXEC
/* Execute the remote command using rexec. */
READ_SIDE (remote_pipe_number) = _rmt_rexec (remote_host, remote_user);
if (READ_SIDE (remote_pipe_number) < 0)
{
int e = errno;
free (path_copy);
errno = e;
return -1;
}
WRITE_SIDE (remote_pipe_number) = READ_SIDE (remote_pipe_number);
#else /* not WITH_REXEC */
{
const char *remote_shell_basename;
pid_t status;
/* Identify the remote command to be executed. */
if (!remote_shell)
{
#ifdef REMOTE_SHELL
remote_shell = REMOTE_SHELL;
#else
free (path_copy);
errno = EIO;
return -1;
#endif
}
remote_shell_basename = base_name (remote_shell);
/* Set up the pipes for the `rsh' command, and fork. */
if (pipe (to_remote[remote_pipe_number]) == -1
|| pipe (from_remote[remote_pipe_number]) == -1)
{
int e = errno;
free (path_copy);
errno = e;
return -1;
}
status = fork ();
if (status == -1)
{
int e = errno;
free (path_copy);
errno = e;
return -1;
}
if (status == 0)
{
/* Child. */
close (STDIN_FILENO);
dup (to_remote[remote_pipe_number][PREAD]);
close (to_remote[remote_pipe_number][PREAD]);
close (to_remote[remote_pipe_number][PWRITE]);
close (STDOUT_FILENO);
dup (from_remote[remote_pipe_number][PWRITE]);
close (from_remote[remote_pipe_number][PREAD]);
close (from_remote[remote_pipe_number][PWRITE]);
sys_reset_uid_gid ();
if (remote_user)
execl (remote_shell, remote_shell_basename, remote_host,
"-l", remote_user, RMT_COMMAND, (char *) 0);
else
execl (remote_shell, remote_shell_basename, remote_host,
RMT_COMMAND, (char *) 0);
/* Bad problems if we get here. */
/* In a previous version, _exit was used here instead of exit. */
error (EXIT_ON_EXEC_ERROR, errno, _("Cannot execute remote shell"));
}
/* Parent. */
close (from_remote[remote_pipe_number][PWRITE]);
close (to_remote[remote_pipe_number][PREAD]);
}
#endif /* not WITH_REXEC */
/* Attempt to open the tape device. */
{
size_t remote_file_len = strlen (remote_file);
char *command_buffer = xmalloc (remote_file_len + 1000);
sprintf (command_buffer, "O%s\n", remote_file);
encode_oflag (command_buffer + remote_file_len + 2, open_mode);
strcat (command_buffer, "\n");
if (do_command (remote_pipe_number, command_buffer) == -1
|| get_status (remote_pipe_number) == -1)
{
int e = errno;
free (command_buffer);
free (path_copy);
_rmt_shutdown (remote_pipe_number, e);
return -1;
}
free (command_buffer);
}
free (path_copy);
return remote_pipe_number + bias;
}
/* Close remote tape connection HANDLE and shut down. Return 0 if
successful, -1 on error. */
int
rmt_close__ (int handle)
{
long int status;
if (do_command (handle, "C\n") == -1)
return -1;
status = get_status (handle);
_rmt_shutdown (handle, errno);
return status;
}
/* Read up to LENGTH bytes into BUFFER from remote tape connection HANDLE.
Return the number of bytes read on success, SAFE_READ_ERROR on error. */
size_t
rmt_read__ (int handle, char *buffer, size_t length)
{
char command_buffer[COMMAND_BUFFER_SIZE];
size_t status;
size_t rlen;
size_t counter;
sprintf (command_buffer, "R%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1
|| (status = get_status (handle)) == SAFE_READ_ERROR)
return SAFE_READ_ERROR;
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
{
rlen = safe_read (READ_SIDE (handle), buffer, status - counter);
if (rlen == SAFE_READ_ERROR || rlen == 0)
{
_rmt_shutdown (handle, EIO);
return SAFE_READ_ERROR;
}
}
return status;
}
/* Write LENGTH bytes from BUFFER to remote tape connection HANDLE.
Return the number of bytes written. */
size_t
rmt_write__ (int handle, char *buffer, size_t length)
{
char command_buffer[COMMAND_BUFFER_SIZE];
RETSIGTYPE (*pipe_handler) ();
size_t written;
sprintf (command_buffer, "W%lu\n", (unsigned long) length);
if (do_command (handle, command_buffer) == -1)
return 0;
pipe_handler = signal (SIGPIPE, SIG_IGN);
written = full_write (WRITE_SIDE (handle), buffer, length);
signal (SIGPIPE, pipe_handler);
if (written == length)
{
long int r = get_status (handle);
if (r < 0)
return 0;
if (r == length)
return length;
written = r;
}
/* Write error. */
_rmt_shutdown (handle, EIO);
return written;
}
/* Perform an imitation lseek operation on remote tape connection
HANDLE. Return the new file offset if successful, -1 if on error. */
off_t
rmt_lseek__ (int handle, off_t offset, int whence)
{
char command_buffer[COMMAND_BUFFER_SIZE];
char operand_buffer[UINTMAX_STRSIZE_BOUND];
uintmax_t u = offset < 0 ? - (uintmax_t) offset : (uintmax_t) offset;
char *p = operand_buffer + sizeof operand_buffer;
*--p = 0;
do
*--p = '0' + (int) (u % 10);
while ((u /= 10) != 0);
if (offset < 0)
*--p = '-';
switch (whence)
{
case SEEK_SET: whence = 0; break;
case SEEK_CUR: whence = 1; break;
case SEEK_END: whence = 2; break;
default: abort ();
}
sprintf (command_buffer, "L%s\n%d\n", p, whence);
if (do_command (handle, command_buffer) == -1)
return -1;
return get_status_off (handle);
}
/* Perform a raw tape operation on remote tape connection HANDLE.
Return the results of the ioctl, or -1 on error. */
int
rmt_ioctl__ (int handle, int operation, char *argument)
{
switch (operation)
{
default:
errno = EOPNOTSUPP;
return -1;
#ifdef MTIOCTOP
case MTIOCTOP:
{
char command_buffer[COMMAND_BUFFER_SIZE];
char operand_buffer[UINTMAX_STRSIZE_BOUND];
uintmax_t u = (((struct mtop *) argument)->mt_count < 0
? - (uintmax_t) ((struct mtop *) argument)->mt_count
: (uintmax_t) ((struct mtop *) argument)->mt_count);
char *p = operand_buffer + sizeof operand_buffer;
*--p = 0;
do
*--p = '0' + (int) (u % 10);
while ((u /= 10) != 0);
if (((struct mtop *) argument)->mt_count < 0)
*--p = '-';
/* MTIOCTOP is the easy one. Nothing is transferred in binary. */
sprintf (command_buffer, "I%d\n%s\n",
((struct mtop *) argument)->mt_op, p);
if (do_command (handle, command_buffer) == -1)
return -1;
return get_status (handle);
}
#endif /* MTIOCTOP */
#ifdef MTIOCGET
case MTIOCGET:
{
ssize_t status;
size_t counter;
/* Grab the status and read it directly into the structure. This
assumes that the status buffer is not padded and that 2 shorts
fit in a long without any word alignment problems; i.e., the
whole struct is contiguous. NOTE - this is probably NOT a good
assumption. */
if (do_command (handle, "S") == -1
|| (status = get_status (handle), status == -1))
return -1;
for (; status > 0; status -= counter, argument += counter)
{
counter = safe_read (READ_SIDE (handle), argument, status);
if (counter == SAFE_READ_ERROR || counter == 0)
{
_rmt_shutdown (handle, EIO);
return -1;
}
}
/* Check for byte position. mt_type (or mt_model) is a small integer
field (normally) so we will check its magnitude. If it is larger
than 256, we will assume that the bytes are swapped and go through
and reverse all the bytes. */
if (((struct mtget *) argument)->MTIO_CHECK_FIELD < 256)
return 0;
for (counter = 0; counter < status; counter += 2)
{
char copy = argument[counter];
argument[counter] = argument[counter + 1];
argument[counter + 1] = copy;
}
return 0;
}
#endif /* MTIOCGET */
}
}

View File

@@ -16,7 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <quotearg.h>
#include "common.h"
@@ -189,7 +189,7 @@ sparse_scan_file (struct tar_sparse_file *file)
return false;
clear_block (buffer);
file->stat_info->sparse_map_size = 0;
file->stat_info->sparse_map_avail = 0;
file->stat_info->archive_file_size = 0;
if (!tar_sparse_scan (file, scan_begin, NULL))
@@ -626,7 +626,7 @@ oldgnu_get_sparse_info (struct tar_sparse_file *file)
int ext_p;
static enum oldgnu_add_status rc;
file->stat_info->sparse_map_size = 0;
file->stat_info->sparse_map_avail = 0;
for (i = 0; i < SPARSES_IN_OLDGNU_HEADER; i++)
{
rc = oldgnu_add_sparse (file, &h->oldgnu_header.sp[i]);
@@ -752,7 +752,7 @@ star_get_sparse_info (struct tar_sparse_file *file)
int ext_p;
static enum oldgnu_add_status rc;
file->stat_info->sparse_map_size = 0;
file->stat_info->sparse_map_avail = 0;
if (h->star_in_header.prefix[0] == '\0'
&& h->star_in_header.sp[0].offset[10] != '\0')

View File

@@ -16,10 +16,10 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include "common.h"
#include "rmt.h"
#include <rmt.h>
#include <signal.h>
void
@@ -118,11 +118,6 @@ sys_truncate (int fd)
return write (fd, "", 0);
}
void
sys_reset_uid_gid (void)
{
}
size_t
sys_write_archive_buffer (void)
{
@@ -281,13 +276,6 @@ sys_truncate (int fd)
return pos < 0 ? -1 : ftruncate (fd, pos);
}
void
sys_reset_uid_gid (void)
{
setuid (getuid ());
setgid (getgid ());
}
/* Return nonzero if NAME is the name of a regular file, or if the file
does not exist (so it would be created as a regular file). */
static int
@@ -517,7 +505,6 @@ sys_child_open_for_uncompress (void)
{
/* The parent tar is still here! Just clean up. */
read_full_records_option = true;
archive = parent_pipe[PREAD];
xclose (parent_pipe[PWRITE]);
return child_pid;

View File

@@ -1,523 +0,0 @@
/* System dependent definitions for GNU tar.
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <alloca.h>
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(Spec) /* empty */
# endif
#endif
#include <sys/types.h>
#include <ctype.h>
/* IN_CTYPE_DOMAIN (C) is nonzero if the unsigned char C can safely be given
as an argument to <ctype.h> macros like `isspace'. */
#if STDC_HEADERS
# define IN_CTYPE_DOMAIN(c) 1
#else
# define IN_CTYPE_DOMAIN(c) ((unsigned) (c) <= 0177)
#endif
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#define ISODIGIT(c) ((unsigned) (c) - '0' <= 7)
#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
/* Declare string and memory handling routines. Take care that an ANSI
string.h and pre-ANSI memory.h might conflict, and that memory.h and
strings.h conflict on some systems. */
#if STDC_HEADERS || HAVE_STRING_H
# include <string.h>
# if !STDC_HEADERS && HAVE_MEMORY_H
# include <memory.h>
# endif
#else
# include <strings.h>
# ifndef strchr
# define strchr index
# endif
# ifndef strrchr
# define strrchr rindex
# endif
# ifndef memcpy
# define memcpy(d, s, n) bcopy ((char const *) (s), (char *) (d), n)
# endif
# ifndef memcmp
# define memcmp(a, b, n) bcmp ((char const *) (a), (char const *) (b), n)
# endif
#endif
/* Declare errno. */
#include <errno.h>
#ifndef errno
extern int errno;
#endif
/* Declare open parameters. */
#if HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/file.h>
#endif
/* Pick only one of the next three: */
#ifndef O_RDONLY
# define O_RDONLY 0 /* only allow read */
#endif
#ifndef O_WRONLY
# define O_WRONLY 1 /* only allow write */
#endif
#ifndef O_RDWR
# define O_RDWR 2 /* both are allowed */
#endif
#ifndef O_ACCMODE
# define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY)
#endif
/* The rest can be OR-ed in to the above: */
#ifndef O_CREAT
# define O_CREAT 8 /* create file if needed */
#endif
#ifndef O_EXCL
# define O_EXCL 16 /* file cannot already exist */
#endif
#ifndef O_TRUNC
# define O_TRUNC 32 /* truncate file on open */
#endif
/* MS-DOG forever, with my love! */
#ifndef O_BINARY
# define O_BINARY 0
#endif
/* Declare file status routines and bits. */
#include <sys/stat.h>
#if !HAVE_LSTAT && !defined lstat
# define lstat stat
#endif
#if STX_HIDDEN && !_LARGE_FILES /* AIX */
# ifdef stat
# undef stat
# endif
# define stat(path, buf) statx (path, buf, STATSIZE, STX_HIDDEN)
# ifdef lstat
# undef lstat
# endif
# define lstat(path, buf) statx (path, buf, STATSIZE, STX_HIDDEN | STX_LINK)
#endif
#if STAT_MACROS_BROKEN
# undef S_ISBLK
# undef S_ISCHR
# undef S_ISCTG
# undef S_ISDIR
# undef S_ISFIFO
# undef S_ISLNK
# undef S_ISREG
# undef S_ISSOCK
#endif
/* On MSDOS, there are missing things from <sys/stat.h>. */
#if MSDOS
# define S_ISUID 0
# define S_ISGID 0
# define S_ISVTX 0
#endif
#ifndef S_ISDIR
# define S_ISDIR(Mode) (((Mode) & S_IFMT) == S_IFDIR)
#endif
#ifndef S_ISREG
# define S_ISREG(Mode) (((Mode) & S_IFMT) == S_IFREG)
#endif
#ifndef S_ISBLK
# ifdef S_IFBLK
# define S_ISBLK(Mode) (((Mode) & S_IFMT) == S_IFBLK)
# else
# define S_ISBLK(Mode) 0
# endif
#endif
#ifndef S_ISCHR
# ifdef S_IFCHR
# define S_ISCHR(Mode) (((Mode) & S_IFMT) == S_IFCHR)
# else
# define S_ISCHR(Mode) 0
# endif
#endif
#ifndef S_ISCTG
# ifdef S_IFCTG
# define S_ISCTG(Mode) (((Mode) & S_IFMT) == S_IFCTG)
# else
# define S_ISCTG(Mode) 0
# endif
#endif
#ifndef S_ISDOOR
# define S_ISDOOR(Mode) 0
#endif
#ifndef S_ISFIFO
# ifdef S_IFIFO
# define S_ISFIFO(Mode) (((Mode) & S_IFMT) == S_IFIFO)
# else
# define S_ISFIFO(Mode) 0
# endif
#endif
#ifndef S_ISLNK
# ifdef S_IFLNK
# define S_ISLNK(Mode) (((Mode) & S_IFMT) == S_IFLNK)
# else
# define S_ISLNK(Mode) 0
# endif
#endif
#ifndef S_ISSOCK
# ifdef S_IFSOCK
# define S_ISSOCK(Mode) (((Mode) & S_IFMT) == S_IFSOCK)
# else
# define S_ISSOCK(Mode) 0
# endif
#endif
#if !HAVE_MKFIFO && !defined mkfifo && defined S_IFIFO
# define mkfifo(Path, Mode) (mknod (Path, (Mode) | S_IFIFO, 0))
#endif
#ifndef S_ISUID
# define S_ISUID 0004000
#endif
#ifndef S_ISGID
# define S_ISGID 0002000
#endif
#ifndef S_ISVTX
# define S_ISVTX 0001000
#endif
#ifndef S_IRUSR
# define S_IRUSR 0000400
#endif
#ifndef S_IWUSR
# define S_IWUSR 0000200
#endif
#ifndef S_IXUSR
# define S_IXUSR 0000100
#endif
#ifndef S_IRGRP
# define S_IRGRP 0000040
#endif
#ifndef S_IWGRP
# define S_IWGRP 0000020
#endif
#ifndef S_IXGRP
# define S_IXGRP 0000010
#endif
#ifndef S_IROTH
# define S_IROTH 0000004
#endif
#ifndef S_IWOTH
# define S_IWOTH 0000002
#endif
#ifndef S_IXOTH
# define S_IXOTH 0000001
#endif
#define MODE_WXUSR (S_IWUSR | S_IXUSR)
#define MODE_R (S_IRUSR | S_IRGRP | S_IROTH)
#define MODE_RW (S_IWUSR | S_IWGRP | S_IWOTH | MODE_R)
#define MODE_RWX (S_IXUSR | S_IXGRP | S_IXOTH | MODE_RW)
#define MODE_ALL (S_ISUID | S_ISGID | S_ISVTX | MODE_RWX)
/* Include <unistd.h> before any preprocessor test of _POSIX_VERSION. */
#if HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifndef SEEK_SET
# define SEEK_SET 0
#endif
#ifndef SEEK_CUR
# define SEEK_CUR 1
#endif
#ifndef SEEK_END
# define SEEK_END 2
#endif
#ifndef STDIN_FILENO
# define STDIN_FILENO 0
#endif
#ifndef STDOUT_FILENO
# define STDOUT_FILENO 1
#endif
#ifndef STDERR_FILENO
# define STDERR_FILENO 2
#endif
/* Declare make device, major and minor. Since major is a function on
SVR4, we have to resort to GOT_MAJOR instead of just testing if
major is #define'd. */
#if MAJOR_IN_MKDEV
# include <sys/mkdev.h>
# define GOT_MAJOR
#endif
#if MAJOR_IN_SYSMACROS
# include <sys/sysmacros.h>
# define GOT_MAJOR
#endif
/* Some <sys/types.h> defines the macros. */
#ifdef major
# define GOT_MAJOR
#endif
#ifndef GOT_MAJOR
# if MSDOS
# define major(Device) (Device)
# define minor(Device) (Device)
# define makedev(Major, Minor) (((Major) << 8) | (Minor))
# define GOT_MAJOR
# endif
#endif
/* For HP-UX before HP-UX 8, major/minor are not in <sys/sysmacros.h>. */
#ifndef GOT_MAJOR
# if defined(hpux) || defined(__hpux__) || defined(__hpux)
# include <sys/mknod.h>
# define GOT_MAJOR
# endif
#endif
#ifndef GOT_MAJOR
# define major(Device) (((Device) >> 8) & 0xff)
# define minor(Device) ((Device) & 0xff)
# define makedev(Major, Minor) (((Major) << 8) | (Minor))
#endif
#undef GOT_MAJOR
/* Declare wait status. */
#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifndef WEXITSTATUS
# define WEXITSTATUS(s) (((s) >> 8) & 0xff)
#endif
#ifndef WIFSIGNALED
# define WIFSIGNALED(s) (((s) & 0xffff) - 1 < (unsigned) 0xff)
#endif
#ifndef WTERMSIG
# define WTERMSIG(s) ((s) & 0x7f)
#endif
/* FIXME: It is wrong to use BLOCKSIZE for buffers when the logical block
size is greater than 512 bytes; so ST_BLKSIZE code below, in preparation
for some cleanup in this area, later. */
/* Extract or fake data from a `struct stat'. ST_BLKSIZE gives the
optimal I/O blocksize for the file, in bytes. Some systems, like
Sequents, return st_blksize of 0 on pipes. */
#define DEFAULT_ST_BLKSIZE 512
#if !HAVE_ST_BLKSIZE
# define ST_BLKSIZE(Statbuf) DEFAULT_ST_BLKSIZE
#else
# define ST_BLKSIZE(Statbuf) \
((Statbuf).st_blksize > 0 ? (Statbuf).st_blksize : DEFAULT_ST_BLKSIZE)
#endif
/* Extract or fake data from a `struct stat'. ST_NBLOCKS gives the
number of ST_NBLOCKSIZE-byte blocks in the file (including indirect blocks).
HP-UX counts st_blocks in 1024-byte units,
this loses when mixing HP-UX and BSD filesystems with NFS. AIX PS/2
counts st_blocks in 4K units. */
#if !HAVE_ST_BLOCKS
# if defined(_POSIX_SOURCE) || !defined(BSIZE)
# define ST_NBLOCKS(Statbuf) ((Statbuf).st_size / ST_NBLOCKSIZE + ((Statbuf).st_size % ST_NBLOCKSIZE != 0))
# else
off_t st_blocks ();
# define ST_NBLOCKS(Statbuf) (st_blocks ((Statbuf).st_size))
# endif
#else
# define ST_NBLOCKS(Statbuf) ((Statbuf).st_blocks)
# if defined(hpux) || defined(__hpux__) || defined(__hpux)
# define ST_NBLOCKSIZE 1024
# else
# if defined(_AIX) && defined(_I386)
# define ST_NBLOCKSIZE (4 * 1024)
# endif
# endif
#endif
#ifndef ST_NBLOCKSIZE
#define ST_NBLOCKSIZE 512
#endif
/* This is a real challenge to properly get MTIO* symbols :-(. ISC uses
<sys/gentape.h>. SCO and BSDi uses <sys/tape.h>; BSDi also requires
<sys/tprintf.h> and <sys/device.h> for defining tp_dev and tpr_t. It
seems that the rest use <sys/mtio.h>, which itself requires other files,
depending on systems. Pyramid defines _IOW in <sgtty.h>, for example. */
#if HAVE_SYS_GENTAPE_H
# include <sys/gentape.h>
#else
# if HAVE_SYS_TAPE_H
# if HAVE_SYS_DEVICE_H
# include <sys/device.h>
# endif
# if HAVE_SYS_PARAM_H
# include <sys/param.h>
# endif
# if HAVE_SYS_BUF_H
# include <sys/buf.h>
# endif
# if HAVE_SYS_TPRINTF_H
# include <sys/tprintf.h>
# endif
# include <sys/tape.h>
# else
# if HAVE_SYS_MTIO_H
# include <sys/ioctl.h>
# if HAVE_SGTTY_H
# include <sgtty.h>
# endif
# if HAVE_SYS_IO_TRIOCTL_H
# include <sys/io/trioctl.h>
# endif
# include <sys/mtio.h>
# endif
# endif
#endif
/* Declare standard functions. */
#if STDC_HEADERS
# include <stdlib.h>
#else
void *malloc ();
char *getenv ();
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
#if !defined _POSIX_VERSION && MSDOS
# include <io.h>
#endif
#if WITH_DMALLOC
# undef HAVE_DECL_VALLOC
# define DMALLOC_FUNC_CHECK
# include <dmalloc.h>
#endif
#include <limits.h>
#ifndef MB_LEN_MAX
# define MB_LEN_MAX 1
#endif
#if HAVE_INTTYPES_H
# include <inttypes.h>
#endif
/* These macros work even on ones'-complement hosts (!).
The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#define TYPE_MINIMUM(t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
: (t) 0)
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
/* Bound on length of the string representing an integer value of type t.
Subtract one for the sign bit if t is signed;
302 / 1000 is log10 (2) rounded up;
add one for integer division truncation;
add one more for a minus sign if t is signed. */
#define INT_STRLEN_BOUND(t) \
((sizeof (t) * CHAR_BIT - TYPE_SIGNED (t)) * 302 / 1000 \
+ 1 + TYPE_SIGNED (t))
#define UINTMAX_STRSIZE_BOUND (INT_STRLEN_BOUND (uintmax_t) + 1)
/* Prototypes for external functions. */
#if HAVE_LOCALE_H
# include <locale.h>
#endif
#if !HAVE_SETLOCALE
# define setlocale(Category, Locale) /* empty */
#endif
#include <time.h>
#if defined(HAVE_SYS_TIME_H) && defined(TIME_WITH_SYS_TIME)
# include <sys/time.h>
#endif
#if ! HAVE_DECL_TIME
time_t time ();
#endif
#ifdef HAVE_UTIME_H
# include <utime.h>
#endif
/* Library modules. */
#include <dirname.h>
#include <error.h>
#include <savedir.h>
#include <unlocked-io.h>
#include <xalloc.h>
#include <gettext.h>
#define _(msgid) gettext (msgid)
#define N_(msgid) msgid
#if ! defined valloc && ! HAVE_DECL_VALLOC
# define valloc(Size) malloc (Size)
#endif
#if MSDOS
# include <process.h>
# define SET_BINARY_MODE(arc) setmode(arc, O_BINARY)
# define ERRNO_IS_EACCES errno == EACCES
# define mkdir(file, mode) (mkdir) (file)
#else
# include <pwd.h>
# include <grp.h>
# define SET_BINARY_MODE(arc)
# define ERRNO_IS_EACCES 0
#endif
#if XENIX
# include <sys/inode.h>
#endif

2086
src/tar.c

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,7 @@
of the archive. No attempt is made to record the reads from the args; if
they're on raw tape or something like that, it'll probably lose... */
#include "system.h"
#include <system.h>
#include <quotearg.h>
#include "common.h"
@@ -42,22 +42,22 @@ bool time_to_start_writing;
first part of the record. */
char *output_start;
/* Catenate file PATH to the archive without creating a header for it.
/* Catenate file FILE_NAME to the archive without creating a header for it.
It had better be a tar file or the archive is screwed. */
static void
append_file (char *path)
append_file (char *file_name)
{
int handle = open (path, O_RDONLY | O_BINARY);
int handle = open (file_name, O_RDONLY | O_BINARY);
struct stat stat_data;
if (handle < 0)
{
open_error (path);
open_error (file_name);
return;
}
if (fstat (handle, &stat_data) != 0)
stat_error (path);
stat_error (file_name);
else
{
off_t bytes_left = stat_data.st_size;
@@ -79,14 +79,14 @@ append_file (char *path)
status = safe_read (handle, start->buffer, buffer_size);
if (status == SAFE_READ_ERROR)
read_fatal_details (path, stat_data.st_size - bytes_left,
read_fatal_details (file_name, stat_data.st_size - bytes_left,
buffer_size);
if (status == 0)
FATAL_ERROR ((0, 0,
ngettext ("%s: File shrank by %s byte",
"%s: File shrank by %s bytes",
bytes_left),
quotearg_colon (path),
quotearg_colon (file_name),
STRINGIFY_BIGINT (bytes_left, buf)));
bytes_left -= status;
@@ -96,7 +96,7 @@ append_file (char *path)
}
if (close (handle) != 0)
close_error (path);
close_error (file_name);
}
/* Implement the 'r' (add files to end of archive), and 'u' (add files
@@ -106,7 +106,7 @@ void
update_archive (void)
{
enum read_header previous_status = HEADER_STILL_UNREAD;
int found_end = 0;
bool found_end = false;
name_gather ();
open_archive (ACCESS_UPDATE);
@@ -126,30 +126,33 @@ update_archive (void)
{
struct name *name;
decode_header (current_header, &current_stat_info,
&current_format, 0);
archive_format = current_format;
if (subcommand_option == UPDATE_SUBCOMMAND
&& (name = name_scan (current_stat_info.file_name)) != NULL)
{
struct stat s;
enum archive_format unused;
decode_header (current_header, &current_stat_info, &unused, 0);
chdir_do (name->change_dir);
if (deref_stat (dereference_option,
current_stat_info.file_name, &s) == 0
&& s.st_mtime <= current_stat_info.stat.st_mtime)
add_avoided_name (current_stat_info.file_name);
}
skip_member ();
break;
}
case HEADER_ZERO_BLOCK:
current_block = current_header;
found_end = 1;
found_end = true;
break;
case HEADER_END_OF_FILE:
found_end = 1;
found_end = true;
break;
case HEADER_FAILURE:
@@ -175,6 +178,8 @@ update_archive (void)
break;
}
tar_stat_destroy (&current_stat_info);
xheader_destroy (&extended_header);
previous_status = status;
}
@@ -183,18 +188,18 @@ update_archive (void)
output_start = current_block->buffer;
{
char *path;
char *file_name;
while ((path = name_from_list ()) != NULL)
while ((file_name = name_from_list ()) != NULL)
{
if (excluded_name (path))
if (excluded_name (file_name))
continue;
if (interactive_option && !confirm ("add", path))
if (interactive_option && !confirm ("add", file_name))
continue;
if (subcommand_option == CAT_SUBCOMMAND)
append_file (path);
append_file (file_name);
else
dump_file (path, 1, (dev_t) 0);
dump_file (file_name, 1, (dev_t) 0);
}
}

View File

@@ -16,8 +16,9 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <quotearg.h>
#include <localcharset.h>
#include "common.h"
#ifdef HAVE_ICONV_H
# include <iconv.h>
@@ -27,254 +28,7 @@
# define ICONV_CONST
#endif
#ifdef HAVE_LIBICONV
struct langtab
{
char const *lang; /* Language code */
char const *terr; /* Territory code */
char const *charset; /* Corresponding charset */
};
/* The list of language codes defined in ISO 639 with the corresponding
default character sets.
NOTES:
1) The list must be ordered by:
a) lang field in ascending order
b) terr field in descending order.
NULL fields are considered less than non-null ones.
2) Many entries have NULL charset fields. Please help fill them!
3) The "default" character set for a given language is a matter
of preference. Possibly the table should contain a *list* of
possible character sets.
4) LC_ALL "modifier" field is not taken into account */
static struct langtab langtab[] = {
{ "C", NULL, "ASCII"},
{ "POSIX", NULL, "ASCII" },
{ "aa", NULL, NULL}, /* Afar */
{ "ab", NULL, NULL}, /* Abkhazian */
{ "ae", NULL, NULL}, /* Avestan */
{ "af", NULL, "iso-8859-1"}, /* Afrikaans */
{ "am", NULL, "UTF-8"}, /* Amharic */
{ "ar", NULL, "iso-8859-6"}, /* Arabic */
{ "as", NULL, NULL}, /* Assamese */
{ "ay", NULL, "iso-8859-1"}, /* Aymara */
{ "az", NULL, NULL}, /* Azerbaijani */
{ "ba", NULL, NULL}, /* Bashkir */
{ "be", NULL, "UTF-8"}, /* Byelorussian; Belarusian */
{ "bg", NULL, "iso-8859-5"}, /* Bulgarian */
{ "bh", NULL, NULL}, /* Bihari */
{ "bi", NULL, NULL}, /* Bislama */
{ "bn", NULL, NULL}, /* Bengali; Bangla */
{ "bo", NULL, NULL}, /* Tibetan */
{ "br", NULL, "iso-8859-1"}, /* Breton: 1,5,8,9 */
{ "bs", NULL, NULL}, /* Bosnian */
{ "ca", NULL, "iso-8859-1"}, /* Catalan: 1,5,8,9 */
{ "ce", NULL, NULL}, /* Chechen */
{ "ch", NULL, NULL}, /* Chamorro */
{ "co", NULL, "iso-8859-1"}, /* Corsican */
{ "cs", NULL, "iso-8859-2"}, /* Czech */
{ "cu", NULL, NULL }, /* Church Slavic */
{ "cv", NULL, NULL}, /* Chuvash */
{ "cy", NULL, "iso-8859-1"}, /* Welsh */
{ "da", NULL, "iso-8859-1"}, /* Danish: 4-9 */
{ "de", NULL, "iso-8859-1"}, /* German */
{ "dz", NULL, NULL }, /* Dzongkha; Bhutani */
{ "el", NULL, "iso-8859-7"}, /* Greek */
{ "en", NULL, "iso-8859-1"}, /* English */
{ "eo", NULL, "iso-8859-3"}, /* Esperanto */
{ "es", NULL, "iso-8859-1"}, /* Spanish */
{ "et", NULL, "iso-8859-15"}, /* Estonian: 6,7,9 */
{ "eu", NULL, "iso-8859-1"}, /* Basque: 5,8,9 */
{ "fa", NULL, "UTF-8"}, /* Persian */
{ "fi", NULL, "iso-8859-15"}, /* Finnish */
{ "fj", NULL, NULL }, /* Fijian; Fiji */
{ "fo", NULL, "iso-8859-1"}, /* Faroese: 6,9 */
{ "fr", NULL, "iso-8859-1"}, /* French */
{ "fy", NULL, "iso-8859-1"}, /* Frisian */
{ "ga", NULL, "iso-8859-14"}, /* Irish */
{ "gd", NULL, "iso-8859-14" }, /* Scots; Gaelic */
{ "gl", NULL, NULL }, /* Gallegan; Galician */
{ "gn", NULL, NULL}, /* Guarani */
{ "gu", NULL, NULL}, /* Gujarati */
{ "gv", NULL, "iso-8859-14"}, /* Manx */
{ "ha", NULL, NULL }, /* Hausa (?) */
{ "he", NULL, "iso-8859-8" }, /* Hebrew */
{ "hi", NULL, NULL}, /* Hindi */
{ "ho", NULL, NULL}, /* Hiri Motu */
{ "hr", NULL, "iso-8859-2"}, /* Croatian: 10 */
{ "hu", NULL, "iso-8859-2"}, /* Hungarian */
{ "hy", NULL, NULL}, /* Armenian */
{ "hz", NULL, NULL}, /* Herero */
{ "id", NULL, "iso-8859-1"}, /* Indonesian (formerly in) */
{ "ia", NULL, NULL}, /* Interlingua */
{ "ie", NULL, NULL}, /* Interlingue */
{ "ik", NULL, NULL}, /* Inupiak */
{ "io", NULL, NULL}, /* Ido */
{ "is", NULL, "iso-8859-1"}, /* Icelandic */
{ "it", NULL, "iso-8859-1"}, /* Italian */
{ "iu", NULL, NULL}, /* Inuktitut */
{ "ja", NULL, "EUC-JP"}, /* Japanese */
{ "jv", NULL, NULL}, /* Javanese */
{ "ka", NULL, NULL}, /* Georgian */
{ "ki", NULL, NULL}, /* Kikuyu */
{ "kj", NULL, NULL}, /* Kuanyama */
{ "kk", NULL, NULL}, /* Kazakh */
{ "kl", NULL, "iso-8859-1"}, /* Kalaallisut; Greenlandic */
{ "km", NULL, NULL}, /* Khmer; Cambodian */
{ "kn", NULL, NULL}, /* Kannada */
{ "ko", NULL, "EUC-KR"}, /* Korean */
{ "ks", NULL, NULL}, /* Kashmiri */
{ "ku", NULL, NULL}, /* Kurdish */
{ "kv", NULL, NULL}, /* Komi */
{ "kw", NULL, "iso-8859-14"}, /* Cornish: 1,5,8 */
{ "ky", NULL, NULL}, /* Kirghiz */
{ "la", NULL, "iso-8859-1"}, /* Latin */
{ "lb", NULL, "iso-8859-1"}, /* Letzeburgesch */
{ "ln", NULL, NULL}, /* Lingala */
{ "lo", NULL, NULL}, /* Lao; Laotian */
{ "lt", NULL, "iso-8859-4"}, /* Lithuanian */
{ "lv", NULL, "iso-8859-4"}, /* Latvian; Lettish */
{ "mg", NULL, NULL}, /* Malagasy */
{ "mh", NULL, NULL}, /* Marshall */
{ "mi", NULL, NULL}, /* Maori */
{ "mk", NULL, NULL}, /* Macedonian */
{ "ml", NULL, NULL}, /* Malayalam */
{ "mn", NULL, NULL}, /* Mongolian */
{ "mo", NULL, "iso-8859-2"}, /* Moldavian */
{ "mr", NULL, NULL}, /* Marathi */
{ "ms", NULL, NULL}, /* Malay */
{ "mt", NULL, "iso-8859-3"}, /* Maltese */
{ "my", NULL, NULL}, /* Burmese */
{ "na", NULL, NULL}, /* Nauru */
{ "nb", NULL, "iso-8859-1"}, /* Norwegian Bokm<6B>l; Bokm@aa{}l */
{ "nd", NULL, NULL}, /* Ndebele, North */
{ "ne", NULL, NULL}, /* Nepali */
{ "ng", NULL, NULL}, /* Ndonga */
{ "nl", NULL, "iso-8859-1"}, /* Dutch: 5,9 */
{ "nn", NULL, "iso-8859-1"}, /* Norwegian Nynorsk */
{ "no", NULL, "iso-8859-1"}, /* Norwegian */
{ "nr", NULL, NULL}, /* Ndebele, South */
{ "nv", NULL, NULL}, /* Navajo */
{ "ny", NULL, NULL}, /* Chichewa; Nyanja */
{ "oc", NULL, NULL}, /* Occitan; Proven<65>al; Proven@,{c}al */
{ "om", NULL, NULL}, /* (Afan) Oromo */
{ "or", NULL, NULL}, /* Oriya */
{ "os", NULL, NULL}, /* Ossetian; Ossetic */
{ "pa", NULL, NULL}, /* Panjabi; Punjabi */
{ "pi", NULL, NULL}, /* Pali */
{ "pl", NULL, "iso-8859-2"}, /* Polish */
{ "ps", NULL, NULL}, /* Pashto, Pushto */
{ "pt", NULL, "iso-8859-1"}, /* Portuguese */
{ "qu", NULL, "iso-8859-1"}, /* Quechua */
{ "rm", NULL, "iso-8859-1"}, /* Rhaeto-Romance */
{ "rn", NULL, NULL }, /* Rundi; Kirundi */
{ "ro", NULL, "iso-8859-2"}, /* Romanian */
{ "ru", NULL, "koi8-r"}, /* Russian */
{ "rw", NULL, NULL}, /* Kinyarwanda */
{ "sa", NULL, NULL}, /* Sanskrit */
{ "sc", NULL, "iso-8859-1"}, /* Sardinian */
{ "sd", NULL, NULL}, /* Sindhi */
{ "se", NULL, "iso-8859-10"}, /* Northern Sami */
{ "sg", NULL, NULL}, /* Sango; Sangro */
{ "si", NULL, NULL}, /* Sinhalese */
{ "sk", NULL, "iso-8859-2"}, /* Slovak */
{ "sl", NULL, "iso-8859-1"}, /* Slovenian */
{ "sm", NULL, NULL}, /* Samoan */
{ "sn", NULL, NULL}, /* Shona */
{ "so", NULL, NULL}, /* Somali */
{ "sq", NULL, "iso-8859-1"}, /* Albanian: 2,5,8,9,10 */
{ "sr", NULL, "iso-8859-2"}, /* Serbian */
{ "ss", NULL, NULL}, /* Swati; Siswati */
{ "st", NULL, NULL}, /* Sesotho; Sotho, Southern */
{ "su", NULL, NULL}, /* Sundanese */
{ "sv", NULL, "iso-8859-1"}, /* Swedish */
{ "sw", NULL, NULL}, /* Swahili */
{ "ta", NULL, NULL}, /* Tamil */
{ "te", NULL, NULL}, /* Telugu */
{ "tg", NULL, NULL}, /* Tajik */
{ "th", NULL, "iso-8859-11"}, /* Thai */
{ "ti", NULL, NULL}, /* Tigrinya */
{ "tk", NULL, NULL}, /* Turkmen */
{ "tl", NULL, "iso-8859-1"}, /* Tagalog */
{ "tn", NULL, NULL}, /* Tswana; Setswana */
{ "to", NULL, NULL}, /* Tonga (?) */
{ "tr", NULL, "iso-8859-9"}, /* Turkish */
{ "ts", NULL, NULL}, /* Tsonga */
{ "tt", NULL, NULL}, /* Tatar */
{ "tw", NULL, NULL}, /* Twi */
{ "ty", NULL, NULL}, /* Tahitian */
{ "ug", NULL, NULL}, /* Uighur */
{ "uk", NULL, "koi8-u"}, /* Ukrainian */
{ "ur", NULL, NULL}, /* Urdu */
{ "uz", NULL, NULL}, /* Uzbek */
{ "vi", NULL, NULL}, /* Vietnamese */
{ "vo", NULL, NULL}, /* Volap<61>k; Volap@"{u}k; Volapuk */
{ "wa", NULL, "iso-8859-1"}, /* Walloon */
{ "wo", NULL, NULL}, /* Wolof */
{ "xh", NULL, NULL}, /* Xhosa */
{ "yi", NULL, "iso-8859-8"}, /* Yiddish (formerly ji) */
{ "yo", NULL, NULL}, /* Yoruba */
{ "za", NULL, NULL}, /* Zhuang */
{ "zh", "TW", "big5"}, /* Chinese */
{ "zh", NULL, "gb2312"}, /* Chinese */
{ "zu", NULL, NULL}, /* Zulu */
{ NULL, NULL, NULL}
};
/* Given the language and (optionally) territory code, return the
default character set for that language. See notes above. */
static char const *
charset_lookup (char const *lang, char const *terr)
{
struct langtab const *p;
if (!lang)
return NULL;
for (p = langtab; p->lang; p++)
if (strcasecmp (p->lang, lang) == 0
&& (terr == NULL
|| p->terr == NULL
|| !strcasecmp (p->terr, terr) == 0))
return p->charset;
return NULL;
}
static const char *
get_input_charset (void)
{
const char *charset = NULL;
char *tmp;
/* Try to deduce the charset from LC_ALL or LANG variables */
tmp = getenv ("LC_ALL");
if (!tmp)
tmp = getenv ("LANG");
if (tmp)
{
char *lang;
char *terr;
lang = strtok (tmp, "_");
terr = strtok (NULL, ".");
charset = strtok (NULL, "@");
if (!charset)
charset = charset_lookup (lang, terr);
}
if (!charset)
charset = "iso-8859-1";
return charset;
}
#else /* !defined HAVE_LIBICONV */
#ifndef HAVE_ICONV
# undef iconv_open
# define iconv_open(tocode, fromcode) ((iconv_t) -1)
@@ -285,7 +39,7 @@ get_input_charset (void)
# undef iconv_close
# define iconv_close(cd) 0
#endif /* !defined HAVE_LIBICONV */
#endif
@@ -298,9 +52,9 @@ utf8_init (bool to_utf)
if (conv_desc[(int) to_utf] == (iconv_t) -1)
{
if (to_utf)
conv_desc[(int) to_utf] = iconv_open ("UTF-8", get_input_charset ());
conv_desc[(int) to_utf] = iconv_open ("UTF-8", locale_charset ());
else
conv_desc[(int) to_utf] = iconv_open (get_input_charset (), "UTF-8");
conv_desc[(int) to_utf] = iconv_open (locale_charset (), "UTF-8");
}
return conv_desc[(int) to_utf];
}

View File

@@ -16,7 +16,7 @@
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "system.h"
#include <system.h>
#include <fnmatch.h>
#include <hash.h>
@@ -220,10 +220,10 @@ to_decimal (uintmax_t value, char *where, size_t size)
%d The directory name of the file,
equivalent to the result of the
dirname utility on the translated
pathname.
file name.
%f The filename of the file, equivalent
to the result of the basename
utility on the translated pathname.
utility on the translated file name.
%p The process ID of the pax process.
%% A '%' character. */

View File

@@ -1,9 +1,11 @@
Makefile.in
Makefile
preset
.deps
genfile
mksparse
tmp-*
directory
archive
atconfig
atlocal
testsuite
genfile.c
testsuite.dir
testsuite.log
package.m4

View File

@@ -1,9 +1,10 @@
# Makefile for GNU tar regression tests.
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003 Free Software
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004 Free Software
# Foundation, Inc.
# François Pinard <pinard@iro.umontreal.ca>, 1988.
# Sergey Poznyakoff <gray@mirddin.farlep.net>, 2004.
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
@@ -20,52 +21,100 @@
## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
## 02111-1307, USA.
check_PROGRAMS = genfile mksparse
BUILT_SOURCES = preset
EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 star/README star/quicktest.sh
DISTCLEANFILES = atconfig $(check_SCRIPTS)
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
TESTS = \
version.sh\
append.sh\
delete01.sh\
delete02.sh\
delete03.sh\
delete04.sh\
extrac01.sh\
extrac02.sh\
extrac03.sh\
extrac04.sh\
gzip.sh\
incremen.sh\
ignfail.sh\
listed01.sh\
longv7.sh\
multiv01.sh\
multiv02.sh\
old.sh\
options.sh\
same-order01.sh\
same-order02.sh\
volume.sh\
recurse.sh\
sparse01.sh\
star/gtarfail.sh\
star/gtarfail2.sh\
star/multi-fail.sh\
star/ustar-big-2g.sh\
star/ustar-big-8g.sh\
star/pax-big-10g.sh\
star/qucktest.sh
## ------------ ##
## package.m4. ##
## ------------ ##
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
} >$(srcdir)/package.m4
#
## ------------ ##
## Test suite. ##
## ------------ ##
TESTSUITE_AT = \
testsuite.at\
delete01.at\
delete02.at\
delete03.at\
delete04.at\
delete05.at\
extrac01.at\
extrac02.at\
extrac03.at\
extrac04.at\
extrac05.at\
gzip.at\
incremental.at\
ignfail.at\
link01.at\
listed01.at\
listed02.at\
longv7.at\
multiv01.at\
multiv02.at\
multiv03.at\
old.at\
options.at\
recurse.at\
same-order01.at\
same-order02.at\
sparse01.at\
volume.at\
version.at\
star/gtarfail.at\
star/gtarfail2.at\
star/multi-fail.at\
star/ustar-big-2g.at\
star/ustar-big-8g.at\
star/pax-big-10g.at
TESTSUITE = $(srcdir)/testsuite
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
mv $@.tmp $@
atconfig: $(top_builddir)/config.status
cd $(top_builddir) && ./config.status tests/$@
clean-local:
$(SHELL) $(TESTSUITE) --clean
check-local: atconfig atlocal $(TESTSUITE)
$(SHELL) $(TESTSUITE)
#check_SCRIPTS = tar
# Run the test suite on the *installed* tree.
installcheck-local:
$(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
## ------------ ##
## genfile ##
## ------------ ##
check_PROGRAMS = genfile
genfile_SOURCES = genfile.c
mksparse_SOURCES = mksparse.c
EXTRA_DIST = after before preset.in $(TESTS) star/README
localedir = $(datadir)/locale
INCLUDES = -I$(top_srcdir)/lib -I../lib -I$(top_srcdir)/src
LDADD = ../lib/libtar.a $(LIBINTL)
mostlyclean:
rm -rf tmp-*
$(TESTS): genfile mksparse

View File

@@ -1,55 +0,0 @@
#! /bin/sh
# Do common operations after a particular test.
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
cd ..
exec 1> /dev/null
exec 2> /dev/null
compare() {
eval tempfile=tmp-$$/std${1}
eval echo \""\${$1}"\" | sed '$d' > ${tempfile}0
sedscript=tmp-$$/${1}.sed
if eval test \".\${${1}_ignore}\" = .; then
:
else
eval echo \"\${${1}_ignore}\" | sed 's,^.*$,/&/d,;' > $sedscript
sed -f $sedscript ${tempfile} > ${tempfile}.1
mv ${tempfile}.1 ${tempfile}
fi
if eval test -z \"\${${1}_regex}\" ; then
cmp -s ${tempfile}0 ${tempfile} || exit 1
else
awk '{print NR " " $0}' ${tempfile}0 > ${tempfile}.1
awk '{print NR " " $0}' ${tempfile} | join ${tempfile}.1 - |
while read NUM RE LINE
do
echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
done
fi
}
compare out
compare err
rm -rf tmp-$$

34
tests/append.at Normal file
View File

@@ -0,0 +1,34 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
AT_SETUP([append])
AT_KEYWORDS([append])
AT_TAR_CHECK([touch file1
touch file2
tar cf archive file1
tar rf archive file2
tar tf archive],
[0],
[file1
file2
])
AT_CLEANUP

6
tests/atlocal.in Normal file
View File

@@ -0,0 +1,6 @@
# @configure_input@ -*- shell-script -*-
# Configurable variable values for tar test suite.
# Copyright (C) 2004 Free Software Foundation, Inc.
PATH=@abs_builddir@:@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH

View File

@@ -1,53 +0,0 @@
#! /bin/sh
# Do common operations before a particular test.
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
case $# in
0) TAR_ARCHIVE_FORMATS="${TAR_ARCHIVE_FORMATS:-v7 oldgnu ustar posix gnu}"
for format in $TAR_ARCHIVE_FORMATS
do
$0 $format
R=$?
test $R -eq 0 || exit $R
done
exit 0;;
1) if test "x$1" = xauto; then
TAR_OPTIONS=
else
TAR_OPTIONS="--format=$1"
fi;;
*) echo "Too many arguments" >&2
exit 2;;
esac
mkdir tmp-$$
cd tmp-$$
out=
err=
export TAR_OPTIONS
#echo "$0 $1"
echo "$0 $1" > checking
exec 1> stdout
exec 2> stderr

31
tests/delete01.sh → tests/delete01.at Executable file → Normal file
View File

@@ -1,37 +1,36 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Deleting a member after a big one was destroying the archive.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Deleting a member after a big one was destroying the archive.
set -e
AT_SETUP([deleting a member after a big one])
AT_KEYWORDS([delete01])
AT_TAR_CHECK([
genfile -l 50000 > file1
genfile -l 1024 > file2
tar cf archive file1 file2
tar f archive --delete file2
tar tf archive
tar tf archive],
[0],
[file1
])
out="\
file1
"
. $srcdir/after
AT_CLEANUP

35
tests/delete02.sh → tests/delete02.at Executable file → Normal file
View File

@@ -1,45 +1,44 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Deleting a member with the archive from stdin was not working correctly.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Deleting a member with the archive from stdin was not working correctly.
set -e
AT_SETUP([deleting a member from stdin archive])
AT_KEYWORDS([delete02])
AT_TAR_CHECK([
genfile -l 3073 -p zeros > 1
cp 1 2
cp 2 3
tar cf archive 1 2 3
tar tf archive
cat archive | tar f - --delete 2 > archive2
echo -----
tar tf archive2
out="\
1
echo separator
tar tf archive2],
[0],
[1
2
3
-----
separator
1
3
"
])
. $srcdir/after
AT_CLEANUP

54
tests/delete03.sh → tests/delete03.at Executable file → Normal file
View File

@@ -1,46 +1,48 @@
#! /bin/sh
# Deleting members with long file names.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# Copyright (C) 2001 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu posix"
. $srcdir/before
AT_SETUP([deleting members with long names])
AT_KEYWORDS([delete03])
set -e
prefix=This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_file_names_that_run_into_a_limit_of_the_posix_tar_formatXX
m4_define([PREFIX],[This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_file_names_that_run_into_a_limit_of_the_posix_tar_formatXX])
AT_TAR_CHECK([
prefix=PREFIX
rm -f $prefix*
for i in 1 2 3 4 5 6 7 8 9
do touch $prefix$i
done
tar -cf archive ./$prefix*
tar --delete -f archive ./${prefix}5
tar -tf archive
tar -cf archive ./$prefix* &&
tar --delete -f archive ./${prefix}5 &&
tar -tf archive
],
[0],
[./PREFIX[]1
./PREFIX[]2
./PREFIX[]3
./PREFIX[]4
./PREFIX[]6
./PREFIX[]7
./PREFIX[]8
./PREFIX[]9
],[],[],[],[gnu, oldgnu, posix])
out="\
./${prefix}1
./${prefix}2
./${prefix}3
./${prefix}4
./${prefix}6
./${prefix}7
./${prefix}8
./${prefix}9
"
. $srcdir/after
AT_CLEANUP

30
tests/delete04.sh → tests/delete04.at Executable file → Normal file
View File

@@ -1,29 +1,29 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Deleting a large last member was destroying earlier members.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Deleting a large last member was destroying earlier members.
set -e
AT_SETUP([deleting a large last member])
AT_KEYWORDS([delete04])
AT_TAR_CHECK([
genfile -l 3 >file1
genfile -l 5 >file2
genfile -l 3 >file3
@@ -37,9 +37,9 @@ genfile -l 256000 >file10
tar cf archive file1 file2 file3 file4 file5 file6 file7 file8 file9 file10
tar f archive --delete file10
tar tf archive
out="\
file1
],
[0],
[file1
file2
file3
file4
@@ -48,6 +48,6 @@ file6
file7
file8
file9
"
])
. $srcdir/after
AT_CLEANUP

48
tests/delete05.at Normal file
View File

@@ -0,0 +1,48 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# When attempted to delete a non-existing member, tar used to destroy
# last blocking_factor blocks.
# References:
# <Pine.LNX.4.10.10412160956460.30933-100000@electra.znyx.com>
# http://lists.gnu.org/archive/html/bug-tar/2004-12/msg00016.html
AT_SETUP([deleting non-existing member])
AT_KEYWORDS([delete05])
AT_TAR_CHECK([
genfile -l 1024 > en
genfile -l 1024 > to
tar cf archive en to
# Make sure we don't use bogus blocking factor.
# GNU tar up to and including 1.14.91 produced an empty archive this way:
tar --file archive --blocking-factor=20 --delete tre
tar tf archive
],
[0],
[en
to
],
[tar: tre: Not found in archive
tar: Error exit delayed from previous errors
])
AT_CLEANUP

23
tests/extrac01.sh → tests/extrac01.at Executable file → Normal file
View File

@@ -1,32 +1,33 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# There was a diagnostic when directory already exists.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# There was a diagnostic when directory already exists.
set -e
AT_SETUP([extract01])
AT_KEYWORDS([extract01])
AT_TAR_CHECK([
mkdir directory
touch directory/file
tar cf archive directory || exit 1
tar xf archive || exit 1
])
. $srcdir/after
AT_CLEANUP

25
tests/extrac02.sh → tests/extrac02.at Executable file → Normal file
View File

@@ -1,34 +1,37 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Could not extract symlinks over an existing file.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Could not extract symlinks over an existing file.
set -e
AT_SETUP([extracting symlinks over an existing file])
AT_KEYWORDS([extract02])
# FIXME: Skip if symlinks are not supported on the system
AT_TAR_CHECK([
touch file
ln -s file link 2> /dev/null || ln file link
tar cf archive link
rm link
touch link
tar xf archive
])
. $srcdir/after
AT_CLEANUP

35
tests/extrac03.sh → tests/extrac03.at Executable file → Normal file
View File

@@ -1,38 +1,37 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Paths going up and down were inducing extraction loops.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Paths going up and down were inducing extraction loops.
set -e
AT_SETUP([extraction loops])
AT_KEYWORDS([extract03])
AT_TAR_CHECK([
mkdir directory
tar -cPvf archive directory/../directory
echo -----
tar -xPvf archive
out="\
echo separator
tar -xPvf archive],
[0],
[directory/../directory/
separator
directory/../directory/
-----
directory/../directory/
"
])
. $srcdir/after
AT_CLEANUP

30
tests/extrac04.sh → tests/extrac04.at Executable file → Normal file
View File

@@ -1,29 +1,29 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Check for fnmatch problems in glibc 2.1.95.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Check for fnmatch problems in glibc 2.1.95.
set -e
AT_SETUP([extract + fnmatch])
AT_KEYWORDS([extract04])
AT_TAR_CHECK([
touch file1
mkdir directory
mkdir directory/subdirectory
@@ -36,11 +36,11 @@ tar -tf archive \
--exclude='./*1' \
--exclude='d*/*1' \
--exclude='d*/s*/*2' | sort
out="\
directory/
],
[0],
[directory/
directory/file2
directory/subdirectory/
"
])
. $srcdir/after
AT_CLEANUP

61
tests/extrac05.at Normal file
View File

@@ -0,0 +1,61 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Problem: when extracting selected members from a PAX archive,
# tar 1.14 incorrectly deemed all members to be sparse and
# therefore was not able to properly skip them.
#
# Reported by: Luca Fibbi <fibbi@lamma.rete.toscana.it>
#
# References: <3.0.6.32.20040809113727.00a30e50@localhost>
# http://lists.gnu.org/archive/html/bug-tar/2004-08/msg00008.html
AT_SETUP([extracting selected members from pax])
AT_KEYWORDS([extract05])
AT_DATA([list],
[jeden
cztery
])
AT_TAR_CHECK([
genfile --length 118 > jeden
genfile --length 223 > dwa
genfile --length 517 > trzy
genfile --sparse --file sparsefile 0 ABCD 1M EFGH 2000K IJKL
genfile --length 110 > cztery
tar cf archive jeden dwa trzy cztery || exit 1
mkdir dir
cd dir
tar xvfT ../archive ../../list || exit 1
cd ..
],
[0],
[jeden
cztery
],
[],[],[],
[posix])
AT_CLEANUP

View File

@@ -1,171 +0,0 @@
/* Generate a file containing some preset patterns.
Copyright (C) 1995, 1996, 1997, 2001, 2003, 2004 Free Software
Foundation, Inc.
François Pinard <pinard@iro.umontreal.ca>, 1995.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "system.h"
#include <argmatch.h>
#include <getopt.h>
#ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
#endif
enum pattern
{
DEFAULT_PATTERN,
ZEROS_PATTERN
};
/* The name this program was run with. */
const char *program_name;
/* If nonzero, display usage information and exit. */
static int show_help = 0;
/* If nonzero, print the version on standard output and exit. */
static int show_version = 0;
/* Length of file to generate. */
static int file_length = 0;
/* Pattern to generate. */
static enum pattern pattern = DEFAULT_PATTERN;
/* Explain how to use the program, then get out. */
static void usage (int) __attribute__ ((noreturn));
static void
usage (int status)
{
if (status != EXIT_SUCCESS)
fprintf (stderr, _("Try `%s --help' for more information.\n"),
program_name);
else
{
printf (_("Generate data files for GNU tar test suite.\n"));
printf (_("\
\n\
Usage: %s [OPTION]...\n"), program_name);
fputs (_("\
If a long option shows an argument as mandatory, then it is mandatory\n\
for the equivalent short option also.\n\
\n\
-l, --file-length=LENGTH LENGTH of generated file\n\
-p, --pattern=PATTERN PATTERN is `default' or `zeros'\n\
--help display this help and exit\n\
--version output version information and exit\n"),
stdout);
}
exit (status);
}
/* Main program. Decode ARGC arguments passed through the ARGV array
of strings, then launch execution. */
/* Long options equivalences. */
static const struct option long_options[] =
{
{"help", no_argument, &show_help, 1},
{"length", required_argument, NULL, 'l'},
{"pattern", required_argument, NULL, 'p'},
{"version", no_argument, &show_version, 1},
{0, 0, 0, 0},
};
static char const * const pattern_args[] = { "default", "zeros", 0 };
static enum pattern const pattern_types[] = {DEFAULT_PATTERN, ZEROS_PATTERN};
int
main (int argc, char *const *argv)
{
int option_char; /* option character */
int counter; /* general purpose counter */
/* Decode command options. */
program_name = argv[0];
setlocale (LC_ALL, "");
while (option_char = getopt_long (argc, argv, "l:p:", long_options, NULL),
option_char != EOF)
switch (option_char)
{
default:
usage (EXIT_FAILURE);
case '\0':
break;
case 'l':
file_length = atoi (optarg);
break;
case 'p':
pattern = XARGMATCH ("--pattern", optarg,
pattern_args, pattern_types);
break;
}
/* Process trivial options. */
if (show_version)
{
printf ("genfile (GNU %s) %s\n", PACKAGE, VERSION);
printf (_("Copyright (C) %d Free Software Foundation, Inc.\n"), 2003);
puts (_("\
This program comes with NO WARRANTY, to the extent permitted by law.\n\
You may redistribute it under the terms of the GNU General Public License;\n\
see the file named COPYING for details."));
/* Note to translator: Please translate "F. Pinard" to "François
Pinard" if "ç" (c-with-cedilla) is available in the
translation's character set and encoding. */
puts (_("Written by F. Pinard."));
exit (EXIT_SUCCESS);
}
if (show_help)
usage (EXIT_SUCCESS);
if (optind < argc)
usage (EXIT_FAILURE);
/* Generate file. */
switch (pattern)
{
case DEFAULT_PATTERN:
for (counter = 0; counter < file_length; counter++)
putchar (counter & 255);
break;
case ZEROS_PATTERN:
for (counter = 0; counter < file_length; counter++)
putchar (0);
break;
}
exit (0);
}

34
tests/gzip.sh → tests/gzip.at Executable file → Normal file
View File

@@ -1,37 +1,41 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# tar should detect that its gzip child failed.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
# tar should detect that its gzip child failed.
AT_SETUP([gzip])
AT_KEYWORDS([gzip])
unset TAR_OPTIONS
AT_CHECK([
tar xfvz /dev/null
test $? = 2 || exit 1
err="\
],
[0],
[],
[
gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error exit delayed from previous errors
"
],
[],[])
. $srcdir/after
AT_CLEANUP

98
tests/ignfail.sh → tests/ignfail.at Executable file → Normal file
View File

@@ -1,73 +1,69 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Unreadable directories yielded error despite --ignore-failed-read.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Unreadable directories yielded error despite --ignore-failed-read.
> check-uid
set - x`ls -l check-uid`
uid_name="$3"
set - x`ls -ln check-uid`
uid_number="$3"
if test "$uid_name" = root || test "$uid_number" = 0; then
# The test is meaningless for super-user.
rm check-uid
AT_SETUP([ignfail])
AT_KEYWORDS([ignfail])
AT_TAR_CHECK([
if test -w / ; then
# The test is meaningless for super-user.
AT_SKIP_TEST
else
touch file
mkdir directory
touch directory/file
touch file
mkdir directory
touch directory/file
echo 1>&2 -----
chmod 000 file
tar cf archive file
status=$?
chmod 600 file
test $status = 2 || exit 1
echo 1>&2 -----
chmod 000 file
tar cf archive file
status=$?
chmod 600 file
test $status = 2 || exit 1
echo 1>&2 -----
chmod 000 file
tar cf archive --ignore-failed-read file || exit 1
status=$?
chmod 600 file
test $status = 0 || exit 1
echo 1>&2 -----
chmod 000 file
tar cf archive --ignore-failed-read file || exit 1
status=$?
chmod 600 file
test $status = 0 || exit 1
echo 1>&2 -----
chmod 000 directory
tar cf archive directory
status=$?
chmod 700 directory
test $status = 2 || exit 1
echo 1>&2 -----
chmod 000 directory
tar cf archive directory
status=$?
chmod 700 directory
test $status = 2 || exit 1
echo 1>&2 -----
chmod 000 directory
tar cf archive --ignore-failed-read directory || exit 1
status=$?
chmod 700 directory
test $status = 0 || exit 1
err="\
echo 1>&2 -----
chmod 000 directory
tar cf archive --ignore-failed-read directory || exit 1
status=$?
chmod 700 directory
test $status = 0
fi
],
[0],
[],
[
-----
tar: file: Cannot open: Permission denied
tar: Error exit delayed from previous errors
@@ -78,8 +74,6 @@ tar: directory: Cannot savedir: Permission denied
tar: Error exit delayed from previous errors
-----
tar: directory: Warning: Cannot savedir: Permission denied
"
])
fi
. $srcdir/after
AT_CLEANUP

35
tests/incremen.sh → tests/incremental.at Executable file → Normal file
View File

@@ -1,30 +1,29 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# A directory older than the listed entry was skipped completely.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu"
. $srcdir/before
# A directory older than the listed entry was skipped completely.
set -e
AT_SETUP([incremental])
AT_KEYWORDS([incremental])
AT_TAR_CHECK([
mkdir structure
echo x >structure/file
@@ -44,16 +43,18 @@ sleep 1
tar cf archive --listed=list structure
tar cfv archive --listed=list structure
echo -----
echo separator
sleep 1
echo y >structure/file
tar cfv archive --listed=list structure
out="\
],
[0],
[
structure/
-----
separator
structure/
structure/file
"
],
[],[],[],[gnu,oldgnu])
. $srcdir/after
AT_CLEANUP

55
tests/link01.at Normal file
View File

@@ -0,0 +1,55 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Problem: If a member with link count > 2 was stored in the archive twice,
# previous versions of tar were not able to extract it, since they
# were trying to link the file to itself, which always failed and
# lead to removing the already extracted copy. This script tests
# the workaround by Paul Eggert that leaves the extracted copy
# untouched.
#
# Reported by: Toby Peterson <toby@apple.com>
#
# References: <2330D503-D20A-11D8-A0CF-00039391EECE@apple.com>
# http://lists.gnu.org/archive/html/bug-tar/2004-07/msg00009.html
AT_SETUP([link count gt 2])
AT_KEYWORDS([link01])
AT_TAR_CHECK([
mkdir directory
mkdir directory/test1
mkdir directory/test2
echo TEST > directory/test1/test.txt
ln directory/test1/test.txt directory/test2/test.txt
tar cf archive directory/test1/test.txt directory/test1/test.txt
rm -r directory
tar xf archive
ls directory/test1
],
[0],
[test.txt
])
AT_CLEANUP

44
tests/listed01.sh → tests/listed01.at Executable file → Normal file
View File

@@ -1,30 +1,32 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Check if listed-incremental backups work for individual files.
# Script proposed by Andreas Schuldei <andreas@schuldei.org>
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu"
. $srcdir/before
# Check if listed-incremental backups work for individual files.
# Script proposed by Andreas Schuldei <andreas@schuldei.org>
# References: <20040215014223.GA9699@lukas.schuldei.com>
# http://lists.gnu.org/archive/html/bug-tar/2004-02/msg00011.html
AT_SETUP([--listed for individual files])
AT_KEYWORDS([listed01])
AT_TAR_CHECK([
mkdir directory
genfile --length 10240 --pattern zeros > directory/file1
# Let the things settle
@@ -35,23 +37,25 @@ tar --create \
--listed-incremental=listing \
directory/file*
tar tf archive.1
tar tf archive.1 || exit 1
dd if=/dev/zero of=directory/file2 bs=1024 count=20 2>/dev/null
genfile --length 10240 --pattern zeros > directory/file2
echo "separator"
tar --create \
--file=archive.2 \
--listed-incremental=listing \
directory/file*
directory/file* || exit 1
tar tf archive.2
out="\
directory/file1
tar tf archive.2 || exit 1
],
[0],
[directory/file1
separator
directory/file2
"
],
[],[],[],[gnu, oldgnu])
AT_CLEANUP
. $srcdir/after

150
tests/listed02.at Normal file
View File

@@ -0,0 +1,150 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Check if listed-incremental backups work for files moved from one directory
# to another.
# Based on a script by Martin Simmons <ZYHYLCRMZPRP@spammotel.com>
# References:
# <20040626230315.163AA1D148@cpc5-cmbg1-6-0-cust208.cmbg.cable.ntl.com>
# http://lists.gnu.org/archive/html/bug-tar/2004-06/msg00028.html
AT_SETUP([working --listed])
AT_KEYWORDS([listed02])
AT_TAR_CHECK([
mkdir directory
echo Create directories
mkdir tart
sleep 1
mkdir tart/c0
sleep 1
mkdir tart/c1
sleep 1
for file in tart/a1 tart/b1 tart/c0/cq1 tart/c0/cq2 tart/c1/ca1 tart/c1/ca2
do
echo File $file > $file
sleep 1
done
sleep 1
echo Creating main archive
tar -c -v --listed-incremental=tart.incr1 -f archive.1 tart || exit 1
sleep 1
echo Modifying filesystem
rm tart/a1
mv tart/b1 tart/b2
mv tart/c1 tart/c2
touch tart/c2/ca3
echo Directory contents
find tart|sort
sleep 1
echo Creating incremental archive
cp -p tart.incr1 tart.incr2
tar -c -v --listed-incremental=tart.incr2 -f archive.2 tart || exit 1
sleep 1
rm -rf tart/*
echo Extracting main archive
tar -x -v --listed-incremental=tart.incr1 -f archive.1 || exit 1
echo Extracting incremental archive
# This command should produce three messages about deletion
# of the existing files, that may appear in any order. Piping
# to sort makes sure we don't depend on any particular ordering.
tar -x -v --listed-incremental=tart.incr2 -f archive.2 | sort
echo Final files:
find tart|sort
],
[0],
[Create directories
Creating main archive
tart/
tart/c0/
tart/c1/
tart/a1
tart/b1
tart/c0/cq1
tart/c0/cq2
tart/c1/ca1
tart/c1/ca2
Modifying filesystem
Directory contents
tart
tart/b2
tart/c0
tart/c0/cq1
tart/c0/cq2
tart/c2
tart/c2/ca1
tart/c2/ca2
tart/c2/ca3
Creating incremental archive
tart/
tart/c0/
tart/c2/
tart/b2
tart/c2/ca1
tart/c2/ca2
tart/c2/ca3
Extracting main archive
tart/
tart/c0/
tart/c1/
tart/a1
tart/b1
tart/c0/cq1
tart/c0/cq2
tart/c1/ca1
tart/c1/ca2
Extracting incremental archive
tar: Deleting `tart/a1'
tar: Deleting `tart/b1'
tar: Deleting `tart/c1'
tart/
tart/b2
tart/c0/
tart/c2/
tart/c2/ca1
tart/c2/ca2
tart/c2/ca3
Final files:
tart
tart/b2
tart/c0
tart/c0/cq1
tart/c0/cq2
tart/c2
tart/c2/ca1
tart/c2/ca2
tart/c2/ca3
],
[tar: tart/c0: Directory is new
tar: tart/c1: Directory is new
tar: tart/c2: Directory is new
],
[],[],[gnu, oldgnu])
AT_CLEANUP

51
tests/longv7.sh → tests/longv7.at Executable file → Normal file
View File

@@ -1,47 +1,48 @@
#! /bin/sh
# Old format (V7) archives should not accept file names longer than
# 99 characters
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="v7"
. $srcdir/before
# Old format (V7) archives should not accept file names longer than
# 99 characters
DIR=this_is_a_very_long_name_for_a_directory_which_causes_problems
FILE=this_is_a_very_long_file_name_which_raises_issues.c
mkdir $DIR
touch $DIR/$FILE
AT_SETUP([V7 and long names])
AT_KEYWORDS([longv7])
tar cf archive $DIR
m4_define([DIR],[this_is_a_very_long_name_for_a_directory_which_causes_problems])
m4_define([FILE],[this_is_a_very_long_file_name_which_raises_issues.c])
AT_TAR_CHECK([
mkdir DIR
touch DIR/FILE
tar cf archive DIR
echo separator
tar tf archive
err="\
tar: $DIR/$FILE: file name is too long (max 99); not dumped
],
[0],
[separator
DIR/
],
[tar: DIR/FILE: file name is too long (max 99); not dumped
tar: Error exit delayed from previous errors
"
],
[],[],[v7])
out="\
separator
$DIR/
"
. $srcdir/after
AT_CLEANUP

View File

@@ -1,161 +0,0 @@
/* This file is part of GNU tar test suite
Copyright (C) 2004 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <fcntl.h>
#include <string.h>
char *progname;
char *buffer;
size_t buffer_size;
static void die (char const *, ...) __attribute__ ((noreturn,
format (printf, 1, 2)));
static void
die (char const *fmt, ...)
{
va_list ap;
fprintf (stderr, "%s: ", progname);
va_start (ap, fmt);
vfprintf (stderr, fmt, ap);
va_end (ap);
fprintf (stderr, "\n");
exit (1);
}
static void
mkhole (int fd, off_t displ)
{
if (lseek (fd, displ, SEEK_CUR) == -1)
{
perror ("lseek");
exit (1);
}
ftruncate (fd, lseek (fd, 0, SEEK_CUR));
}
static void
mksparse (int fd, off_t displ, char *marks)
{
for (; *marks; marks++)
{
memset (buffer, *marks, buffer_size);
if (write(fd, buffer, buffer_size) != buffer_size)
{
perror ("write");
exit (1);
}
if (lseek (fd, displ, SEEK_CUR) == -1)
{
perror ("lseek");
exit (1);
}
}
}
static void usage (void) __attribute__ ((noreturn));
static void
usage (void)
{
printf ("Usage: mksparse filename blocksize disp letters [disp letters...] [disp]\n");
exit (1);
}
static int
xlat_suffix (off_t *vp, char *p)
{
if (p[1])
return 1;
switch (p[0])
{
case 'g':
case 'G':
*vp *= 1024;
case 'm':
case 'M':
*vp *= 1024;
case 'k':
case 'K':
*vp *= 1024;
break;
default:
return 1;
}
return 0;
}
int
main (int argc, char **argv)
{
int i;
int fd;
char *p;
off_t n;
progname = strrchr (argv[0], '/');
if (progname)
progname++;
else
progname = argv[0];
if (argc < 4)
usage ();
fd = open (argv[1], O_CREAT|O_TRUNC|O_RDWR, 0644);
if (fd < 0)
die ("cannot open %s", argv[1]);
n = strtoul (argv[2], &p, 0);
if (n <= 0 || (*p && xlat_suffix (&n, p)))
die ("Invalid buffer size: %s", argv[2]);
buffer_size = n;
buffer = malloc (buffer_size);
if (!buffer)
die ("Not enough memory");
for (i = 3; i < argc; i += 2)
{
off_t displ;
displ = strtoul (argv[i], &p, 0);
if (displ < 0 || (*p && xlat_suffix (&displ, p)))
die ("Invalid displacement: %s", argv[i]);
if (i == argc-1)
{
mkhole (fd, displ);
break;
}
else
mksparse (fd, displ, argv[i+1]);
}
close(fd);
return 0;
}

33
tests/multiv01.sh → tests/multiv01.at Executable file → Normal file
View File

@@ -1,34 +1,33 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test multivolume dumps from pipes.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu"
. $srcdir/before
# Test multivolume dumps from pipes.
AT_SETUP([multivolume dumps from pipes])
AT_KEYWORDS([multiv01])
# Fixme: should be configurable
# TRUSS=truss -o /tmp/tr
# TRUSS=strace
set -e
AT_TAR_CHECK([
genfile --length 7168 > file1
for block in " 1" " 2" " 3" " 4" " 5" " 6" " 7" " 8" \
@@ -41,18 +40,20 @@ done >file2
tar -c --multi-volume --tape-length=10 \
--listed-incremental=t.snar \
-f t1-pipe.tar -f t2-pipe.tar ./file1 ./file2
-f t1-pipe.tar -f t2-pipe.tar ./file1 ./file2 || exit 1
mkdir extract-dir-pipe
dd bs=4096 count=10 if=t2-pipe.tar 2>/dev/null |
PATH=$PATH ${TRUSS} tar -f t1-pipe.tar -f - \
-C extract-dir-pipe -x --multi-volume \
--tape-length=10 --read-full-records
--tape-length=10 --read-full-records || exit 1
cmp file1 extract-dir-pipe/file1
cmp file2 extract-dir-pipe/file2
],
[0],
[],[],[],[],[gnu, oldgnu])
AT_CLEANUP
out="\
"
. $srcdir/after

42
tests/multiv02.sh → tests/multiv02.at Executable file → Normal file
View File

@@ -1,43 +1,47 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Previous versions of tar were not able to skip a member straddling
# the multivolume archive boundary. Reported by Mads Martin Joergensen
# <mmj@suse.de>
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu"
. $srcdir/before
# Previous versions of tar were not able to skip a member straddling
# the multivolume archive boundary. Reported by Mads Martin Joergensen
# <mmj@suse.de>
#
# References: <20040402144254.GC4409@suse.de>
# http://lists.gnu.org/archive/html/bug-tar/2004-04/msg00002.html
AT_SETUP([skipping a straddling member])
AT_KEYWORDS([multiv02])
AT_TAR_CHECK([
genfile --length 10240 > en
genfile --length 20000 > to
genfile --length 20000 > tre
genfile --length 10240 > fire
tar -c -f A.tar -f B.tar -f C.tar -M -L 30 en to tre fire
tar -c -f A.tar -f B.tar -f C.tar -M -L 30 en to tre fire || exit 1
echo separator
tar -v -x -f A.tar -f B.tar -f C.tar -M en
out="\
separator
tar -v -x -f A.tar -f B.tar -f C.tar -M en || exit 1
],
[0],
[separator
en
"
],
[],[],[],[gnu, oldgnu])
. $srcdir/after
AT_CLEANUP

61
tests/multiv03.at Normal file
View File

@@ -0,0 +1,61 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Problem: GNU multivolume archives are not able to continue on members
# with filenames longer than 100 characters. Versions of tar <= 1.14
# were not checking filename lengths and produced malformed multivolume
# headers.
# References: <20040809214854.GB32706@suse.de>
# http://lists.gnu.org/archive/html/bug-tar/2004-08/msg00012.html
AT_SETUP([MV archive & long filenames])
AT_KEYWORDS([multiv03])
AT_TAR_CHECK([
AFILE=`awk 'BEGIN { for (i = 0; i < 100; i++) printf "a"; exit; }'`
BFILE=`awk 'BEGIN { for (i = 0; i < 101; i++) printf "b"; exit; }'`
cat > ../experr <<EOF
tar: $BFILE: file name too long to be stored in a GNU multivolume header
tar: Error is not recoverable: exiting now
EOF
cat > ../expout <<EOF
$AFILE
separator
EOF
genfile --length 15360 > $AFILE
tar -M -L 10 -c -f arch.1 -f arch.2 $AFILE || exit 1
tar -tM -f arch.1 -f arch.2 || exit 1
echo separator
genfile --length 15360 > $BFILE
tar -M -L 10 -c -f arch.1 -f arch.2 $BFILE
],
[2],
[expout],
[experr],
[],[],[gnu, oldgnu])
AT_CLEANUP

34
tests/old.sh → tests/old.at Executable file → Normal file
View File

@@ -1,37 +1,37 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# An old archive was not receiving directories.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
# An old archive was not receiving directories.
set -e
AT_SETUP([old archives])
AT_KEYWORDS([old])
unset TAR_OPTIONS
AT_CHECK([
mkdir directory
tar cfvo archive directory
tar cfvo archive directory || exit 1
tar tf archive
out="\
],
[0],
[directory/
directory/
directory/
"
])
. $srcdir/after
AT_CLEANUP

31
tests/options.sh → tests/options.at Executable file → Normal file
View File

@@ -1,36 +1,37 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Ensure that TAR_OPTIONS works in conjunction with old-style options.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
# Ensure that TAR_OPTIONS works in conjunction with old-style options.
set -e
unset TAR_OPTIONS
AT_SETUP([options])
AT_KEYWORDS([options])
AT_CHECK([
echo > file1
TAR_OPTIONS=--numeric-owner tar chof archive file1
tar tf archive
],
[0],
[file1
])
out="\
file1
"
AT_CLEANUP
. $srcdir/after

View File

@@ -1,41 +0,0 @@
#! /bin/sh
# Set the testing environment.
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
PACKAGE=@PACKAGE@
VERSION=@VERSION@
top_srcdir=@abs_top_srcdir@
srcdir=@abs_srcdir@
PATH=@abs_builddir@:@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH
export LANGUAGE
LANGUAGE=
export LC_ALL
LC_ALL="C"
skiptest() {
exit 77
}
star_prereq() {
test -z "$STAR_TESTSCRIPTS" && skiptest
test -r "$STAR_TESTSCRIPTS/$1" || skiptest
}

25
tests/recurse.sh → tests/recurse.at Executable file → Normal file
View File

@@ -1,33 +1,34 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
AT_SETUP([recurse])
AT_KEYWORDS([recurse])
set -e
AT_TAR_CHECK([
mkdir directory
touch directory/file
tar --create --file archive --no-recursion directory || exit 1
tar tf archive
],
[0],
[directory/
])
out="directory/
"
. $srcdir/after
AT_CLEANUP

37
tests/same-order01.sh → tests/same-order01.at Executable file → Normal file
View File

@@ -1,42 +1,45 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# -C dir did not work with --same-order
# Bug reported by Karl-Michael Schneider <schneide@phil.uni-passau.de>
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# Problem: -C dir did not work with --same-order
# Reported by: Karl-Michael Schneider <schneide@phil.uni-passau.de>
# References: <20040507122613.GB12457@pike.phil.uni-passau.de>
# http://lists.gnu.org/archive/html/bug-tar/2004-05/msg00008.html
set -e
AT_SETUP([same-order01])
AT_KEYWORDS([same-order01])
AT_TAR_CHECK([
genfile -l 1024 > file1
genfile -l 1024 > file2
tar cf archive file1 file2
mkdir directory
tar -xf archive --same-order -C directory
tar -xf archive --same-order -C directory || exit 1
ls directory
out="\
file1
],
[0],
[file1
file2
"
])
AT_CLEANUP
. $srcdir/after

36
tests/same-order02.sh → tests/same-order02.at Executable file → Normal file
View File

@@ -1,31 +1,31 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# In previous versions a single -C option did not work with --same-order
# (see same-order01.sh). However, multiple -C options worked OK.
# Test if we did not break the correct behavior.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
# In previous versions a single -C option did not work with --same-order
# (see same-order01.sh). However, multiple -C options worked OK.
# Test if we did not break the correct behavior.
set -e
AT_SETUP([same-order02])
AT_KEYWORDS([same-order02])
AT_TAR_CHECK([
genfile -l 1024 > file1
genfile -l 1024 > file2
tar cf archive file1 file2
@@ -34,16 +34,16 @@ mkdir en
mkdir to
HERE=`pwd`
tar -xf archive --same-order -C $HERE/en file1 -C $HERE/to file2
tar -xf archive --same-order -C $HERE/en file1 -C $HERE/to file2 || exit 1
ls en
echo separator
ls to
out="\
file1
],
[0],
[file1
separator
file2
"
])
. $srcdir/after
AT_CLEANUP

35
tests/sparse01.sh → tests/sparse01.at Executable file → Normal file
View File

@@ -1,42 +1,45 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Check sparse file handling.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu posix"
. $srcdir/before
AT_SETUP([sparse01])
AT_KEYWORDS([sparse01])
AT_TAR_CHECK([
genfile --length 1000 > begin
genfile --length 1000 > end
mksparse sparsefile 512 0 ABCD 1M EFGH 2000K IJKL
tar -c -f archive --sparse begin sparsefile end
genfile --sparse --file sparsefile --block-size 512 0 ABCD 1M EFGH 2000K IJKL
tar -c -f archive --sparse begin sparsefile end || exit 1
echo separator
tar tfv archive
],
[0],
[stdout],
[],[],[],[gnu, oldgnu])
out_regex="\
separator
RE_CHECK([stdout],
[separator
-rw-r--r-- [^ ][^ ]* *1000 [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] begin
-rw-r--r-- [^ ][^ ]* *10344448[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] sparsefile
-rw-r--r-- [^ ][^ ]* *1000 [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9] end
"
])
AT_CLEANUP
. $srcdir/after

View File

@@ -7,45 +7,59 @@ is set and points to the directory where the test archives reside.
Sample usage:
make STAR_TESTSCRIPTS=testdir check
or
make TESTS_ENVIRONMENT='STAR_TESTSCRIPTS=testdir' check
The following is a short description of the tests:
The file `quicktest.sh' is a separate test. It is never executed
within `make check' command, you will need to run it manually.
Please, carefully read section `quicktest.sh' below before running
it.
Following is a short description of the tests:
* gtarfail.sh and gtarfile2.tar
* gtarfail.at and gtarfail2.at
These tests require gtarfile.tar and gtarfile2.tar, respectively.
These files are POSIX compliant tar archives that were not accepted
by previous versions of GNU tar.
* multi-fail.sh
* multi-fail.at
Requires gnu-multi-fail-volume1.gtar and gnu-multi-fail-volume2.gtar.
These are two parts of a multi-volume archive that previous versions
of tar refused to read (at least, without -B option).
* ustar-big-2g.sh
* ustar-big-2g.at
Requires ustar-big-2g.tar.bz2. It is a tar archive containing a file with
the largest size that a historic tar implementation is able to understand.
* ustar-big-8g.sh
* ustar-big-8g.at
Requires ustar-big-8g.tar.bz2. This is a test for reading an archive containing
files with the largest size that may be used with ustar (POSIX.1-1990)
format.
* pax-big-10g.sh
* pax-big-10g.at
Requires pax-big-10g.tar.bz2. It tests handling pax (POSIX.1-2001) archves
containing very large files (in this case -- 10 GB).
* qucktest.sh
* quicktest.sh
A test for compliance to POSIX.1-1990 tar specification. It requires
the files ustar-all-quicktest.tar and quicktest.filelist. Apart
from them, the `tartest' program from 'star' package is needed.
The test may be run only with root privileges, so it is a good
idea to test the contents of ustar-all-quicktest.tar before running
it.
This is a test for compliance to POSIX.1-1990 tar specification. It
requires two files: ustar-all-quicktest.tar and quicktest.filelist,
(they usually reside in star/tartest directory), and `tartest' program
(also part of star distribution). The test must be run only with root
privileges, so it is a good idea to test contents of
ustar-all-quicktest.tar before running it.
If `tartest' is not in your PATH, use TARTEST variable to specify its
full file name. You may pass both STAR_TESTSCRIPTS and TARTEST
variables as command line arguments to quicktest.sh, as shown in
the example below:
./quicktest.sh STAR_TESTSCRIPTS=testdir TARTEST=/path/to/tartest
Local variables:

33
tests/star/gtarfail.sh → tests/star/gtarfail.at Executable file → Normal file
View File

@@ -1,35 +1,40 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq gtarfail.tar
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([gtarfail])
AT_KEYWORDS([gtarfail])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([gtarfail.tar])
tar --utc -tvf $STAR_TESTSCRIPTS/gtarfail.tar
out="\
-rw-r--r-- jes/glone 518 2001-05-25 14:41:06 vedpowered.gif
],
[0],
[-rw-r--r-- jes/glone 518 2001-05-25 14:41:06 vedpowered.gif
-rw-r--r-- jes/glone 6825 1997-04-29 00:19:16 cd.gif
-rw-r--r-- jes/glone 33354 1999-06-22 12:17:38 DSCN0049c.JPG
-rw-r--r-- jes/glone 86159 2001-06-05 18:16:04 Window1.jpg
-rw-r--r-- jes/glone 1310 2001-05-25 13:05:41 vipower.gif
-rw-rw-rw- jes/glone 148753 1998-09-15 13:08:15 billyboy.jpg
"
. $srcdir/after
])
AT_CLEANUP

33
tests/star/gtarfail2.sh → tests/star/gtarfail2.at Executable file → Normal file
View File

@@ -1,31 +1,34 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq gtarfail2.tar
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([gtarfail2])
AT_KEYWORDS([gtarfail2])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([gtarfail2.tar])
tar --utc -tvf $STAR_TESTSCRIPTS/gtarfail2.tar
out="\
-rwxr-xr-x jes/glone 214 2001-09-21 14:08:36 .clean
],
[0],
[-rwxr-xr-x jes/glone 214 2001-09-21 14:08:36 .clean
lrwxrwxrwx jes/cats 0 1998-05-07 12:39:00 RULES -> makefiles/RULES
drwxr-sr-x jes/glone 0 2001-12-10 00:00:58 build/
-rw-r--r-- jes/glone 312019 2001-12-10 00:00:20 build/smake-1.2.tar.gz
@@ -35,6 +38,8 @@ drwxr-sr-x jes/glone 0 2001-11-09 18:20:33 build/psmake/
-rw-r--r-- jes/glone 647 2001-02-25 23:50:06 build/psmake/Makefile
lrwxrwxrwx jes/glone 0 2001-08-29 10:53:53 build/psmake/archconf.c -> ../archconf.c
lrwxrwxrwx jes/glone 0 2001-08-29 10:54:00 build/psmake/astoi.c -> ../../lib/astoi.c
"
])
AT_CLEANUP
. $srcdir/after

34
tests/star/multi-fail.sh → tests/star/multi-fail.at Executable file → Normal file
View File

@@ -1,33 +1,37 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq gnu-multi-fail-volume1.gtar
star_prereq gnu-multi-fail-volume2.gtar
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([multi-fail])
AT_KEYWORDS([multi-fail])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([gnu-multi-fail-volume1.gtar])
AT_STAR_PREREQ([gnu-multi-fail-volume2.gtar])
tar --utc -tvM -f $STAR_TESTSCRIPTS/gnu-multi-fail-volume1.gtar \
-f $STAR_TESTSCRIPTS/gnu-multi-fail-volume2.gtar
out="\
drwxrwsr-x joerg/bs 0 2003-10-11 14:32:43 OBJ/i386-sunos5-gcc/
],
[0],
[drwxrwsr-x joerg/bs 0 2003-10-11 14:32:43 OBJ/i386-sunos5-gcc/
-rw-r--r-- joerg/bs 1 2003-10-11 14:32:50 OBJ/i386-sunos5-gcc/Dnull
-rw-r--r-- joerg/bs 1743 2003-10-10 18:06:58 OBJ/i386-sunos5-gcc/star.d
-rw-r--r-- joerg/bs 1460 2003-10-11 11:53:36 OBJ/i386-sunos5-gcc/header.d
@@ -79,5 +83,7 @@ drwxrwsr-x joerg/bs 0 2003-10-11 14:32:43 OBJ/i386-sunos5-gcc/
-rw-r--r-- joerg/bs 2576 2003-10-10 18:07:10 OBJ/i386-sunos5-gcc/names.o
-rw-r--r-- joerg/bs 952 2003-10-10 18:07:10 OBJ/i386-sunos5-gcc/movearch.o
-rw-r--r-- joerg/bs 2756 2003-10-07 17:53:59 OBJ/i386-sunos5-gcc/table.o
"
])
AT_CLEANUP

40
tests/star/pax-big-10g.sh → tests/star/pax-big-10g.at Executable file → Normal file
View File

@@ -1,36 +1,42 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq pax-big-10g.tar.bz2
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([pax-big-10g])
AT_KEYWORDS([pax-big-10g])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([pax-big-10g.tar.bz2])
tar --utc -tvjf $STAR_TESTSCRIPTS/pax-big-10g.tar.bz2
out="\
-rw------- jes/glone 10737418240 2002-06-15 21:18:47 10g
],
[0],
[-rw------- jes/glone 10737418240 2002-06-15 21:18:47 10g
-rw-r--r-- jes/glone 0 2002-06-15 14:53:32 file
"
],
[stderr])
RE_CHECK([stderr],[tar: Record size = .*
])
AT_CLEANUP
err_regex="\
tar: Record size = .*
"
. $srcdir/after

View File

@@ -1,55 +0,0 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq ustar-all-quicktest.tar
star_prereq quicktest.filelist
# Only root may perform this test
test -w / || skiptest
TAR_ARCHIVE_FORMATS=ustar
. $srcdir/before
mkdir directory
cd directory
save_TAR_OPTIONS=$TAR_OPTIONS
TAR_OPTIONS="" tar xf $STAR_TESTSCRIPTS/ustar-all-quicktest.tar
TAR_OPTIONS=$save_TAR_OPTIONS
echo separator
echo separator >&2
tar cfT ../archive $STAR_TESTSCRIPTS/quicktest.filelist
cd ..
${TARTEST:-tartest} -v < $STAR_TESTSCRIPTS/ustar-all-quicktest.tar > old.out
${TARTEST:-tartest} -v < archive > new.out
cmp old.out new.out
out="\
separator
"
err_ignore="tar: Extracting contiguous files as regular files"
err="\
separator
"
. $srcdir/after

100
tests/star/quicktest.sh Executable file
View File

@@ -0,0 +1,100 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# Usage: quicktest FILELIST ARCHIVE-NAME
quicktest() {
DIR=quicktest.$$
mkdir $DIR
cd $DIR
TAR_OPTIONS=""
export TAR_OPTIONS
tar xf $2
tar -cf ../archive -H ustar -T $1
cd ..
${TARTEST:-tartest} -v < $2 > $DIR/old.out
${TARTEST:-tartest} -v < archive > $DIR/new.out
if cmp $DIR/old.out $DIR/new.out; then
echo "PASS"
rm -r $DIR
exit 0
else
echo "FAIL. Examine $DIR for details"
exit 1
fi
}
test_access() {
if [ -r $1 ]; then
:
else
echo "$1 does not exist or is unreadable"
echo 77
fi
}
check_environ() {
if [ "$STAR_TESTSCRIPTS" = "" ]; then
echo "STAR_TESTSCRIPTS not set"
exit 77
fi
if [ -d $STAR_TESTSCRIPTS ]; then
:
else
echo "STAR_TESTSCRIPTS is not a directory"
exit 77
fi
ARCHIVE=$STAR_TESTSCRIPTS/ustar-all-quicktest.tar
test_access $ARCHIVE
FILELIST=$STAR_TESTSCRIPTS/quicktest.filelist
test_access $FILELIST
${TARTEST:-tartest} < /dev/null > /dev/null 2>&1
if [ $? -eq 127 ]; then
echo "tartest not in your path"
exit 77
fi
}
getargs() {
for option
do
case $option in
*=*) eval $option;;
*) echo "Unknown option: $option" >&2
exit 77;;
esac
done
}
if [ -w / ]; then
getargs $*
check_environ
quicktest $FILELIST $ARCHIVE
else
echo "You need to be root to run this test"
exit 77
fi
# End of quicktest.sh

View File

@@ -1,36 +1,41 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq ustar-big-2g.tar.bz2
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([ustar-big-2g])
AT_KEYWORDS([ustar-big-2g])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([ustar-big-2g.tar.bz2])
tar --utc -tvjf $STAR_TESTSCRIPTS/ustar-big-2g.tar.bz2
out="\
-rw------- jes/glone 2147483647 2002-06-15 14:53:23 big
],
[0],
[-rw------- jes/glone 2147483647 2002-06-15 14:53:23 big
-rw-r--r-- jes/glone 0 2002-06-15 14:53:32 file
"
],
[stderr])
err_regex="\
tar: Record size = .*
"
RE_CHECK([stderr],[tar: Record size = .*
])
AT_CLEANUP
. $srcdir/after

View File

@@ -1,36 +1,41 @@
#! /bin/sh
# This file is part of GNU tar testsuite.
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
star_prereq ustar-big-8g.tar.bz2
TAR_ARCHIVE_FORMATS=auto
. $srcdir/before
AT_SETUP([ustar-big-8g])
AT_KEYWORDS([ustar-big-8g])
unset TAR_OPTIONS
AT_CHECK([
AT_STAR_PREREQ([ustar-big-8g.tar.bz2])
tar --utc -tvjf $STAR_TESTSCRIPTS/ustar-big-8g.tar.bz2
out="\
-rw------- jes/glone 8589934591 2002-06-15 15:08:33 8gb-1
],
[0],
[-rw------- jes/glone 8589934591 2002-06-15 15:08:33 8gb-1
-rw-r--r-- jes/glone 0 2002-06-15 14:53:32 file
"
],
[stderr])
err_regex="\
tar: Record size = .*
"
RE_CHECK([stderr],[tar: Record size = .*
])
AT_CLEANUP
. $srcdir/after

112
tests/testsuite.at Normal file
View File

@@ -0,0 +1,112 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
# We need a recent Autotest.
m4_version_prereq([2.52g])
m4_define([AT_TAR_CHECK],[
m4_foreach([FMT],
[m4_if([$7],[],[v7,oldgnu,ustar,posix,gnu],[$7])],
[AT_CHECK([
mkdir FMT
(cd FMT
TAR_OPTIONS="-H FMT"
export TAR_OPTIONS
rm -rf *
$1)],$2,$3,$4,$5,$6)])
])
m4_define([RE_CHECK],[
AT_DATA([$1.re],[$2])
awk '{print NR " " $[]0}' $1.re > $[]$.1
awk '{print NR " " $[]0}' $1 | join $[]$.1 - |
while read NUM RE LINE
do
echo "$LINE" | grep -- "$RE" >/dev/null || exit 1
done
])
m4_define([AT_SKIP_TEST],[exit 77])
m4_define([AT_STAR_PREREQ],[
test -z "$STAR_TESTSCRIPTS" && AT_SKIP_TEST
test -r "$STAR_TESTSCRIPTS/$1" || AT_SKIP_TEST
])
AT_INIT
AT_TESTED([tar])
m4_include([version.at])
m4_include([options.at])
m4_include([append.at])
m4_include([delete01.at])
m4_include([delete02.at])
m4_include([delete03.at])
m4_include([delete04.at])
m4_include([delete05.at])
m4_include([extrac01.at])
m4_include([extrac02.at])
m4_include([extrac03.at])
m4_include([extrac04.at])
m4_include([extrac05.at])
m4_include([gzip.at])
m4_include([incremental.at])
m4_include([ignfail.at])
m4_include([link01.at])
m4_include([listed01.at])
m4_include([listed02.at])
m4_include([longv7.at])
m4_include([multiv01.at])
m4_include([multiv02.at])
m4_include([multiv03.at])
m4_include([old.at])
m4_include([recurse.at])
m4_include([same-order01.at])
m4_include([same-order02.at])
m4_include([sparse01.at])
m4_include([volume.at])
m4_include([star/gtarfail.at])
m4_include([star/gtarfail2.at])
m4_include([star/multi-fail.at])
m4_include([star/ustar-big-2g.at])
m4_include([star/ustar-big-8g.at])
m4_include([star/pax-big-10g.at])

33
tests/append.sh → tests/version.at Executable file → Normal file
View File

@@ -1,38 +1,27 @@
#! /bin/sh
# Append was just not working.
# This file is part of GNU tar testsuite.
# Checking tar version -*- Autotest -*-
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
. $srcdir/before
AT_SETUP([tar version])
set -e
touch file1
touch file2
tar cf archive file1
tar rf archive file2
tar tf archive
AT_CHECK([tar --version],
[0],
[AT_PACKAGE_TARNAME (AT_PACKAGE_NAME) AT_PACKAGE_VERSION
])
out="\
file1
file2
"
. $srcdir/after
AT_CLEANUP

View File

@@ -1,36 +0,0 @@
#! /bin/sh
# Check if the proper version is being tested.
# This file is part of GNU tar testsuite.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
if test -n "`$PACKAGE --version | sed -n s/$PACKAGE.*$VERSION/OK/p`"; then
banner="Regression testing for GNU $PACKAGE, version $VERSION"
dashes=`echo $banner | sed s/./=/g`
echo $dashes
echo $banner
echo $dashes
else
echo '=============================================================='
echo 'WARNING: Not using the proper version, *all* checks dubious...'
echo '=============================================================='
exit 1
fi

49
tests/volume.sh → tests/volume.at Executable file → Normal file
View File

@@ -1,29 +1,29 @@
#! /bin/sh
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Volume labels are checked on read by fnmatch.
# This file is part of GNU tar testsuite.
# Test suite for GNU tar.
# Copyright (C) 2004 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
. ./preset
TAR_ARCHIVE_FORMATS="gnu oldgnu"
. $srcdir/before
# Volume labels are checked on read by fnmatch.
AT_SETUP([volume])
AT_KEYWORDS([volume])
AT_TAR_CHECK([
tar -cf archive -V label -T /dev/null || exit 1
tar xfV archive label || exit 1
@@ -38,18 +38,21 @@ tar xfV archive bel
test $? = 2 || exit 1
echo 1>&2 -----
tar xfV archive babel
test $? = 2 || exit 1
test $? = 2
],
[0],
[],
[-----
tar: Volume `label' does not match `lab'
tar: Error is not recoverable: exiting now
-----
tar: Volume `label' does not match `bel'
tar: Error is not recoverable: exiting now
-----
tar: Volume `label' does not match `babel'
tar: Error is not recoverable: exiting now
],
[],[],[gnu, oldgnu])
err="\
-----
tar: Volume \`label' does not match \`lab'
tar: Error is not recoverable: exiting now
-----
tar: Volume \`label' does not match \`bel'
tar: Error is not recoverable: exiting now
-----
tar: Volume \`label' does not match \`babel'
tar: Error is not recoverable: exiting now
"
AT_CLEANUP
. $srcdir/after