Commit Graph

346 Commits

Author SHA1 Message Date
Tim Kientzle
8eccad56d9 Test updates: Handling of patterns on command line, error messages. 2008-08-15 06:12:02 +00:00
Colin Percival
f9bcf9cabf Mark functions as __dead2 in order to help the LLVM static checker
understand which code paths aren't possible.

This commit eliminates 117 false positive bug reports of the form
"allocate memory; error out if pointer is NULL; use pointer".
2008-08-04 01:25:48 +00:00
Simon L. B. Nielsen
1640935f0b - Fix mtree example so it works.
- Document --version.

Reviewed by:	kientzle
MFC after:	1 week
2008-07-26 17:22:40 +00:00
Colin Percival
a6d7fc3469 Move duplicated code from tar_mode_[cru] into archive_write.
Fix a bug I introduced 7 minutes ago: clean up properly from archive_write
if we exit the argv-handling loop due to -C not having an argument.
2008-07-05 08:10:55 +00:00
Colin Percival
d47b2ddb21 Use malloc in write_archive to allocate a 64kB buffer for holding file data
instead of using 64kB of stack space in copy_file_data and write_file_data.
2008-07-05 08:03:08 +00:00
Colin Percival
85f32b2087 Clean up write_entry by eliminating fd except in the #ifdef __linux block
where it is used. [1]

Don't leak file descriptors in write_entry_backend if archive_write_header
returns ARCHIVE_FAILED.

Found by:	Coverity Prevent [1]
2008-07-05 06:05:34 +00:00
Colin Percival
9af6e14a8c Revert CVS revision 1.68; it is now possible for entry to be NULL at the end
of write_entry.  (This was perfectly safe, since archive_entry_free(NULL) is
a no-op, but adding the check back makes the style more consistent.)
2008-07-05 02:21:51 +00:00
Tim Kientzle
6481fd43de FreeBSD-CURRENT bsdtar is synched up with libarchive-portable 2.5.5. 2008-07-05 02:09:54 +00:00
Tim Kientzle
aec34fd22e Remove HAVE_STRUCT_STAT_ST_RDEV, as it's not used anywhere. 2008-07-05 02:09:13 +00:00
Tim Kientzle
f12440da1e Stop using the deprecated linux/ext2_fs.h. 2008-07-05 02:06:55 +00:00
Tim Kientzle
fe8c1d9768 Use %H:%M for strftime() time formatting instead of the non-portable %R. 2008-07-05 02:05:55 +00:00
Tim Kientzle
634d062e6a Pass the entry down into the core write loop, so we
can include the filename when reporting errors.

Thanks to: Dan Nelson
2008-06-25 05:01:02 +00:00
Tim Kientzle
48ee9a828d MfP4: Minor portability fix. 2008-06-15 10:08:16 +00:00
Tim Kientzle
669a9b2e92 MfP4: test harness cleanup. 2008-06-15 10:07:54 +00:00
Colin Percival
f6dd73207f Make one-bit fields unsigned instead of signed. This has no effect,
since they are only tested for zero/nonzero; but it's arguably a bad
idea to set a {-1, 0} variable to 1 (as happens in this code).

Found by:	Coverity Prevent
2008-06-09 14:41:28 +00:00
Colin Percival
af58f6feff Rework code to avoid using a pointer after freeing it. Aside from the
possibility of memory becoming undereferenceable when it is freed, this
change should have no effect on bsdtar behaviour.

Found by:	Coverity Prevent
2008-06-09 14:03:55 +00:00
Tim Kientzle
aabccf4a0d Compatibility fix: define REG_BASIC if it isn't already. In particular,
glibc has a suitable regex implementation, but doesn't define this
constant.

Thanks to: Diego "Flameeyes" Pettenò
2008-05-27 04:44:07 +00:00
Tim Kientzle
eb36031906 MFp4: bsdtar 2.5.4b
In addition to a number of bug fixes and minor changes:
 * --numeric-owner (ignore user/group names on create and extract)
 * -S (sparsify files on extraction)
 * -s (regex filename substitutions)
 * Use new libarchive 'linkify' to get correct hardlink handling for
   both old and new cpio formats
 * Rework 'copy' test to be insensitive to readdir() filename ordering

Most of the credit for this work goes to Joerg Sonnenberger, who
has been duplicating features from NetBSD's 'pax' program.
2008-05-26 17:10:10 +00:00
Colin Percival
29d10c76f9 The value le->name cannot be NULL when we're freeing an entry in the
hardlink table for two reasons: 1. If le->name is set to NULL, the
structure le won't be inserted into the table; 2. Even if le somehow
did manage to get into the table with le->name equal to NULL, we would
die when we dereferenced le->null before we could get to the point of
freeing the entry.

Remove the unnecessary "if (le->name != NULL)" test and just free the
pointer.

Found by:	Coverity Prevent
2008-05-23 05:07:22 +00:00
Colin Percival
990662f170 Improve portability via s/struct siginfo/struct siginfo_data/. This was
running into a namespace collision on an avian operating system.
2008-05-22 21:08:36 +00:00
Colin Percival
2dc4c8e0e5 Detect if argv[1] is "" and avoid calling malloc(0). Prior to this commit,
running 'tar ""' would print 'No memory' instead of the correct error
message, 'Must specify one of -c, -r, -t, -u, -x' if malloc is set to
System V mode (malloc(0) == NULL).
2008-05-19 18:38:01 +00:00
Colin Percival
1eef28bb67 There's no way for entry to possibly be NULL at the end of write_entry
(in fact, there has never been any way for it to be NULL, going all the
way back to revision 1.1 of this file), so remove the check and
unconditionally free entry.

Found by:	Coverity Prevent
2008-05-19 18:09:26 +00:00
Colin Percival
06a047f0f1 Add SIGINFO (and for portability to SIGINFO-lacking systems, SIGUSR1)
handling to bsdtar.  When writing archives (including copying via the
@archive directive) a line is output to stderr indicating what is being
done (adding or copying), the path, and how far through the file we are;
extracting currently does not report progress within each file, but
this is likely to happen eventually.

Discussed with:	kientzle
Obtained from:	tarsnap
2008-05-18 06:24:47 +00:00
Colin Percival
54c81d4f92 Add --keep-newer-files option (as in GNU tar: When in -x mode, ignore
files if the existing file is newer than the archive entry).

Currently if any files are ignored, bsdtar will exit with a non-zero
exit status; this is likely to change in the future, but requires some
API changes in libarchive.

Discussed with:	kientzle
Obtained from:	tarsnap
2008-05-17 15:55:29 +00:00
Tim Kientzle
01770c7983 Documentation updates:
* --format can be used with -r or -u
  * -o is a synonym for --format=ustar when used with -c, -r, or -u
Also, fix the erroneous sanity check that suppressed --format with -r or -u.
2008-05-02 05:40:05 +00:00
Tim Kientzle
2e4e881bef bsdtar --version should succeed. 2008-05-02 05:18:47 +00:00
Tim Kientzle
c40b056519 New bsdtar test harness. Still rather skimpy, but a lot easier
to run and maintain than the old scripts that used to be here.
2008-05-02 05:17:16 +00:00
Tim Kientzle
a0a88a1e98 Allow -r with -T even if there are no files on the command line.
PR: bin/123246
MFC after: 3 days
2008-05-02 05:14:58 +00:00
Tim Kientzle
3b56813eb0 Fix --fast-read by decrementing the remaining patterns to be matched,
instead of incrementing.

Pointy hat: me
Thanks to: Tomasz Przygoda
MFC after: 3 days
2008-03-18 06:18:49 +00:00
Tim Kientzle
9ef493f9c6 style(9) fix to add whitespace around an '=' sign and restore
a comment that got accidentally dropped.
2008-03-15 05:08:21 +00:00
Tim Kientzle
1fd0d1f6de Support NetBSD's --insecure as a synonym for -P. 2008-03-15 03:28:39 +00:00
Tim Kientzle
ef1108fe61 Document --chroot. 2008-03-15 03:25:26 +00:00
Tim Kientzle
8fc7d6f52c Support -q (from NetBSD) as a synonym for --fast-read (the old FreeBSD
extension to GNU tar).

Thanks to: Joerg Sonnenberger
2008-03-15 03:18:24 +00:00
Tim Kientzle
acf18d7a97 Also accept --uncompress as a synonym for -Z.
Thanks to: Joerg Sonnenberger
2008-03-15 03:11:13 +00:00
Tim Kientzle
e1dedd79ed --chroot implementation thanks to Joerg Sonnenberger. 2008-03-15 03:06:46 +00:00
Tim Kientzle
f2e9d875ca Support --compress as a synonym for -Z. 2008-03-15 02:45:57 +00:00
Tim Kientzle
53f3a9d49f Enable and document the -Z option for selecting "compress" compression,
now that libarchive supports it.
2008-03-15 02:41:44 +00:00
Tim Kientzle
2372ae680f Allow appending to archives on block devices as well as
archives in regular files, since both are seekable.

Thanks to: Reinoud Zandijk (@netbsd.org)
2008-02-19 05:27:17 +00:00
Tim Kientzle
97f576d0a4 Make -l always have the SUSv2 meaning of "check links."
GNU tar changed -l to match SUSv2 a couple of years ago,
so bsdtar no longer needs to pander to this particular GNUism.

Thanks to: Debian maintainers
MFC after: 7 days
2008-01-22 07:23:44 +00:00
Tim Kientzle
4a1f529a56 Remove the old bsdtar test scripts; something much
better is almost ready to commit.
2008-01-02 00:28:44 +00:00
Tim Kientzle
d671137571 A couple of miscellaneous fixes:
* prototypes for optarg/optind on platforms that don't already have them
  * Disambiguate version number macros
  * Remove unnecessary PACKAGE_NAME macro
  * Hook for forthcoming bsdtar test suite
  * Sync version number up with the portable distribution
2008-01-02 00:27:14 +00:00
Tim Kientzle
ec3df377a1 Fill in the approximate date when tar(1) first appeared. 2008-01-02 00:24:10 +00:00
Tim Kientzle
e3bd5f097c Include a suitable stub definition of __FBSDID() for non-FreeBSD platforms. 2008-01-02 00:23:00 +00:00
Tim Kientzle
fd3fd2a992 Use archive_entry_strmode() instead of a local bsdtar_strmode().
(This does a couple of things that the standard library's strmode()
doesn't; it proved useful in bsdcpio as well, so I pushed it down
into libarchive.)
2008-01-02 00:21:27 +00:00
Tim Kientzle
b47d2925d7 Include Guido's copyright for the fnmatch() code I cribbed from.
(It's in the C source, just wasn't in the COPYING file until now.)
2008-01-02 00:19:49 +00:00
Tim Kientzle
cd41628daf Add --posix as a synonym for --format=pax, for GNU
tar compatibility.

Approved by: re (bmah)
2007-09-09 00:07:18 +00:00
Tim Kientzle
9b93c30d30 Fix for PR bin/115033. This corrects a crash when long options
are specified with the "-W option=arg" syntax and the '=' is omitted.

MFC after: 3 days
Approved by: re (rwatson)
2007-08-01 03:15:35 +00:00
Tim Kientzle
660665be6b Fill in some casts that are needed (according to GCC 4.1)
Thanks to: Joerg Sonnenberger
Approved by: re (hrs)
MFC after: 3 days
2007-07-20 01:27:50 +00:00
Tim Kientzle
7061a01ba7 Don't exit immediately on libarchive warnings, just
set the delayed return value and keep going.

Approved by: re (hrs)
MFC after: 7 days
2007-07-20 01:24:49 +00:00
Tim Kientzle
a38d1d4c8b bsdtar 2.2.3:
* Implement --use-compress-program using new libarchive feature.
  * Minor portability improvement by adjusting casts used to
    print out uids, gids, and device numbers.

Thanks to: Joerg Sonnenberger for the --use-compress-program implementation.
MFC after: 15 days
2007-05-29 05:39:10 +00:00
Tim Kientzle
3b0e49fad9 Mention the formats supported by bsdtar; include an
example that shows how to work with an ISO 9660 image.
2007-05-20 18:23:39 +00:00
Tim Kientzle
6a955a7506 Set the program return value non-zero if we enounter
an error while skipping the body of an entry during
"tar -t" processing.

Thanks to: Spencer Minear
PR: misc/112521
2007-05-08 15:22:21 +00:00
Colin Percival
c85ac10468 If lstat(2) fails, have bsdtar return a non-zero exit code if the
failed path is one which was specified on the command line.

This is a compromise between the situation prior to revision 1.57
(where a race between tar(1) and rm(1) could cause tar(1) to
spuriously report an error) and the situation after revision 1.57
(where "tar -c /no/such/path" prints a warning but returns with
an exit code of zero).

Inspired by:	rafan
MFC after:	1 week
2007-05-03 04:33:11 +00:00
Tim Kientzle
8d36aa79ef Ignore trailing '/' when comparing pathnames, so that
"tar -u" works again.  Otherwise, "tar -u" wants to
treat every dir as new and re-adds it.
2007-04-18 04:36:11 +00:00
Tim Kientzle
007c50304b When testing basic functionality, strip trailing '/' from
dir names, so they match the names generated by 'find'.
2007-04-18 04:35:17 +00:00
Colin Percival
6fc0ea8474 In libarchive: Downgrade ARCHIVE_FATAL and ARCHIVE_FAILED errors which
occur on the write side of extracting a file to ARCHIVE_WARN errors
when returning them from archive_read_extract.

In bsdtar: Use the return code from archive_read_data_into_fd and
archive_read_extract to determine whether we should continue trying to
extract an archive after one of the entries fails.

This commit makes extracting a truncated tarball complain once about
the archive being truncated, instead of complaining twice (once when
trying to extract an entry, and once when trying to seek to the next
entry).

Discussed with:	kientzle
2007-04-16 04:04:50 +00:00
Tim Kientzle
94a2a4ad3d Portability.
Thanks to: Martin Koeppe for testing on Interix
2007-04-13 16:08:23 +00:00
Tim Kientzle
f6df491097 Make it easier to support more platforms.
Thanks to: Joerg Sonnenberger for pointing out the need and the technique.
2007-04-12 04:45:32 +00:00
Colin Percival
35c2dd3d05 Clean up error handling in archive_append to match how errors are
handled in write_hierarchy.

Approved by:	kientzle
2007-04-09 08:22:34 +00:00
Tim Kientzle
c2c19b10c7 Simplify the logic for handling header read
errors.
2007-04-07 05:56:40 +00:00
Colin Percival
17c0c70552 Add test to confirm that piping a tar archive created by bsdtar through
'bsdtar -cf- @-' doesn't alter it.
2007-04-04 03:12:15 +00:00
Colin Percival
a92fcfb26e Add tests for "bsdtar -t". These are useful primarily because they test
the archive_read_data_skip code.
2007-03-31 22:04:36 +00:00
Colin Percival
0260ab4f4e Split the append_archive function (used for processing @<archive> directives)
into separate append_archive and append_archive_filename functions; the first
takes a "struct archive *" as input, while the second takes a filename, opens
the archive, and calls the first.

There should be no changes in behaviour as a result of this commit; it simply
reorganizes code to make more sense.  At some point in the future it may be
possible to share code between append_archive and read_archive, but not yet.

Discussed with:	kientzle
2007-03-31 10:14:03 +00:00
Tim Kientzle
033583fc78 Issue a warning if there's a non-zero exit value. 2007-03-24 03:25:49 +00:00
Colin Percival
fa21517ed8 Remove pathlen argument from write_entry function. It has never been used.
Approved by:	kientzle
MFC after:	3 days
2007-03-17 19:18:29 +00:00
Colin Percival
486641fcc5 Fix logic bug; we want to do_chdir if arg doesn't start with / _and_ it
doesn't start with @/ either.

This unbreaks "tar -c -C /no/such/directory @/path/to/archive".

MFC after:	3 days
2007-03-17 16:17:14 +00:00
Colin Percival
5e85b65e97 Don't consider an lstat(2) failure to be an error (in the sense of
affecting the return value from bsdtar), since (a) it usually occurs
due to a perfectly innocent (and unavoidable) race condition where a
user deletes a file in the window between bsdtar reading a directory
and attempting to read the file; and (b) aside from printing a warning
message, bsdtar behaves exactly as if the file had been deleted prior
to bsdtar reading its parent directory.

Reviewed by:	kientzle
MFC after:	6 days
2007-03-15 10:11:38 +00:00
Colin Percival
4d41b13b4e Reduce the risk of inducing heart attacks, by printing the right path when
complaining about lstat(2) failing.  It's a bit scary to find the message
  tar: /: Cannot stat: No such file or directory
printed while doing a backup.

MFC after:	1 week
2007-03-14 07:30:51 +00:00
Tim Kientzle
1267d00111 Clarify the test comments in test-basic.sh. Have config.sh do a
better job searching for the bsdtar binary to test and the gtar binary
to use for inter-operability testing.  It should now find the built
(but not installed) binary if there is one, then search for an
installed binary in a number of standard locations.
2007-03-11 19:33:45 +00:00
Tim Kientzle
45d4d7ac8c bsdtar 2.0.23:
* New test scripts exercise some basic functionality
   * Most header inclusions are now protected (portability)
   * read.c now relies on security checks in libarchive instead
     of trying to do its own (optimization)
   * -p now enabled by default for root, add --no-same-permissions
     to disable it
   * Comments, minor style fixes.
2007-03-11 10:36:42 +00:00
Tim Kientzle
254cbd1764 Argh. Support for reading ACLs off of disk was inadvertently disabled
as part of an old configuration shuffle.  As a result, although
ACL restore has been working, ACLs haven't been written into archives
for some time.  <sigh>

Pointy hat: You know.
MFC after: 3 days
2007-03-08 05:52:01 +00:00
Tim Kientzle
baf85fc253 Make the file tests robust against broken symlinks and other
sources of stat()/lstat() failure.
2007-03-03 07:49:08 +00:00
Tim Kientzle
671d7d80a4 If we already have stat() data, we might be able to
determine if this is a physical dir without an lstat().
While I'm in here, try to clarify the comments around
the _is_dir() and _is_physical_dir() tests.
2007-02-21 05:07:43 +00:00
Tim Kientzle
6bf00d8bc7 Andrew and Colin each pointed out to me that truncating the backup
of a growing file should not be considered a "bad thing."

PR: bin/108990
MFC after: 7 days
Pointy hat: /me
2007-02-18 06:23:57 +00:00
Tim Kientzle
effb1b7fcb Correctly handle writes beyond the end of the archive entry
(as determined by the initial size given to the header).
Libarchive recently changed to correctly return the amount
of data actually consumed in this case, which revealed this
bug in bsdtar.
2007-02-14 08:16:08 +00:00
Tim Kientzle
d00914ea85 Update -r handling:
* Create file if it doesn't exist.
  * If archive is "empty", then append to it with pax restricted
  * If user specified a format, use that if it's compatible with
    the existing format.
2007-02-08 07:25:53 +00:00
Tim Kientzle
dbd5adf0d9 Correct the copyright messages: Make this a standard vanilla
2-clause BSD license, update the year to 2007.
2007-01-09 08:12:17 +00:00
Colin Percival
161b2956bb If append_archive fails while writing an archive header, output the error
message from the archive being written (not the message from the archive
being read, where no error has occurred).

MFC after:	3 days
2007-01-05 16:20:21 +00:00
Colin Percival
1b720f2a86 Clean up the struct archive used for reading an archive in the handling
of @archive commands.  This bug should be harmless as long as you don't
use an excessive number of @archive commands.

MFC after:	1 week
2007-01-02 15:03:38 +00:00
Colin Percival
d82088b28f Handle errors which occur during archive_write_data and archive_write_close
by printing an error message and exiting with a non-zero status code.

MFC after:	1 week
2007-01-02 12:24:14 +00:00
Colin Percival
d7102ae53c Fic typo in previous commit.
MFC after:	3 days
2006-12-23 08:16:54 +00:00
Colin Percival
5e522bbc27 Add two checks for inappropriate options: -U only makes sense in "x"
mode, and --strip-components only makes sense in "x" and "t" modes.

MFC after:	3 days
2006-12-23 07:06:37 +00:00
Colin Percival
fe7f4a3aad Correct the names of some options.
MFC after:	3 days
2006-12-23 07:01:59 +00:00
Colin Percival
6d3d33dd7a Remove -F option from getopts string -- this option has never done
anything apart from invoking usage(), and apparently slipped in by
accident.

Approved by:	kientzle
MFC after:	3 days
2006-12-20 06:56:25 +00:00
Tim Kientzle
2bb9582faf Fix "1 day ago", "yesterday" and similar relative-time phrases
when parsing dates.

PR: bin/104934: bug in some date handling of bsdtar
Reported by: Herve Boulouis
MFC after: 3 days
2006-11-02 04:16:15 +00:00
Tim Kientzle
fc1e63e49b Remove two unused variables.
Thanks to: Stefan Farfeleder
2006-07-31 04:57:46 +00:00
Tim Kientzle
902ce6f035 Conditionally include sys/mkdev.h on platforms (such as Solaris) that need it.
While I'm here, correctly alphabetize 't' after 's'.

Thanks to: VMiklos
2006-07-30 18:34:40 +00:00
Tim Kientzle
323b71146a In the examples, use "tar.gz" as the extension for
gzip-compressed tar archives.

Thanks to: Mike Hunter
2006-05-01 01:34:21 +00:00
Tim Kientzle
b8c95d3fe1 If you see a broken symlink, don't try to follow it,
just archive it as a symlink, even if -h was specified.

Thanks to: Jin Guojun
PR: bin/95175
MFC After: 1 week
2006-04-02 07:13:11 +00:00
Tim Kientzle
6b422e20c1 Extended attribute support on write for Linux; FreeBSD hooks are
forthcoming.  This commit also has a number of style(9) fixes and
minor corrections so the code works better with the build system being
used for non-FreeBSD builds.

Many thanks to: Jaakko Heinonen, who proposed a mechanism for extended
attribute support and implemented both the machine-independent portion
and the Linux-specific portion.
2006-03-21 17:03:51 +00:00
Tim Kientzle
6e64751484 Remove non-FreeBSD source from FreeBSD repository. 2006-03-12 19:55:02 +00:00
Tim Kientzle
e11aae440c Remove configure.ac.in and the 'distfile' target from
the FreeBSD makefile.  This is a step towards cleaning
out the non-FreeBSD bits from the FreeBSD source tree.
2006-03-08 02:49:12 +00:00
Tim Kientzle
8682859c8c Add a check for Linux' "libacl" library and headers. 2006-03-07 06:07:41 +00:00
Tim Kientzle
b5b5211732 Change the output of --version to match GNU "gnits" standards.
(I'm not using GPL, but I still think there are good
ideas in the GNU projects. ;-)  Among other things,
this should make it easier for clients of bsdtar to
recognize it automatically:
  bsdtar --version | grep bsdtar
2006-03-07 06:05:38 +00:00
Tim Kientzle
bce43ea96d Fix a format mismatch (%d integer format, platform-dependent
argument type).
2006-03-07 06:02:09 +00:00
Peter Edwards
d12dff713a If opendir(".") fails after descending into a subdirectory via
chdir(), be sure to undo the effects of the chdir before continuing.

Without this, after hitting a directory with mode 0111 (for example),
tar will get lost, and won't add any yet unvisted files to your
archive.  (Or possibly add the wrong files, I suppose...)

Reviewed By: kientzle@
2006-02-22 11:13:07 +00:00
Simon L. B. Nielsen
43614f10a2 Use the .Fx macro.
MFC after:	3 days
2006-01-17 19:37:07 +00:00
Tim Kientzle
6593049efd Remove the -B option from the directory-copying examples. The -B
option is undocumented because it does nothing.  It does nothing
because bsdtar never needs it.  It is accepted because gnutar does
sometimes need it and many scripts use it.

Reported by: Pawel Jakub Dawidek
2005-12-09 05:19:00 +00:00
Tim Kientzle
83b9606050 Portability: remove AC_FUNC_MALLOC from configure.ac.in.
According to Dan Nelson, this fixes the build on AIX 5.2.
2005-11-27 03:17:50 +00:00
Tim Kientzle
b3d17b1474 Edit pathnames for -x but not for -t. Otherwise, people get confused
when list the archive contents, then try to extract selected files
(file selection always works against unedited pathnames).  With this change,
-t always shows the pathnames as they appear in the archive.

Thanks to: Robert Watson
2005-11-06 22:53:51 +00:00
Tim Kientzle
5df2705458 In mode 'u', check for an error return from archive_read_open.
This causes attempts to update a non-existent file to report
an actual error instead of triggering an assertion failure.

PR: bin/87911
Thanks to: roemer.ulrich
MFC after: 3 days

Note: This does not entirely fix bin/87911.  I need to decide on
the "correct" response when someone tries to update a non-existent
archive file.
2005-11-01 06:41:05 +00:00
Tim Kientzle
e8e12ab4e1 Include <sys/param.h> in order to get current __FreeBSD_version
in order to properly set HAVE_NL_LANGINFO.  <whew!>

Thanks to: Andrey Chernov
PR: bin/88013
MFC after: 3 days
2005-11-01 05:53:16 +00:00
Tim Kientzle
a6afb4f5dc Spell "--format" correctly in error message. (It hasn't been
called "-F" for a very long time.)

PR: bin/86915
Thanks to: Gary W. Swearingen
MFC after: 3 days
2005-11-01 05:48:02 +00:00
Tim Kientzle
512c45ef6c Fix -u with absolute paths (e.g., "tar -uf foo.tar /bar") by handling
pathname edits before comparing pathnames on disk to those in the archive.

Thanks to: Gareth Bailey, Lowell Gilbert
2005-09-24 21:19:57 +00:00
Tim Kientzle
2f3b67647f Detect Mac OS X's broken ACL library.
Thanks to: Diego "Flameeyes" Petten?
2005-09-24 21:17:47 +00:00
Tim Kientzle
c114cc6c3f Style fix: Correct a compiler warning from GCC 4
Thanks to: Divacky Roman
PR: bin/84993
2005-09-21 03:21:35 +00:00
Tim Kientzle
5d596ecb25 The bsdtar_warnc() reporting function requires the program name to be
set up before it is called, so move the progname initialization before
the first possible call to bsdtar_warnc().

Thanks to: Stanislav Sedov
PR: bin/83366
MFC after: 7 days
2005-08-02 03:02:55 +00:00
Ruslan Ermilov
ceeb3b43de Fixed troff warnings.
Approved by:	re (blanket manpages)
2005-06-27 07:37:01 +00:00
Tim Kientzle
cf220b45a5 Clarify some error messages. 2005-05-08 06:25:15 +00:00
Tim Kientzle
22ede7639d bsdtar now uses the "tree" package instead of "fts" for walking
directory heirarchies.
2005-04-24 05:53:37 +00:00
Tim Kientzle
6b14892866 Correct autoconf/automake invocation to work with devel/gnu-auto* from
ports.

Thanks to: Dag-Erling Sm?rgrav (des@)
2005-04-23 18:44:25 +00:00
Tim Kientzle
77e0f2287a Minor fix to the configure logic to properly detect ACL support. 2005-04-23 18:41:28 +00:00
Tim Kientzle
ecf6d502eb Overhaul getdate.y. In particular, remove minutes-based logic
(combine with existing seconds-based), treat '-' as punctuation rather
than a negative number indicator (eliminates several special cases),
use a single list of special words instead of several separate lists,
use table-driven abbreviation logic (eliminate duplicate word entries
and special-case abbreviation and plural handling).  The result is
shorter, simpler (judging from comments, earlier maintainers didn't
understand the special handling for "negative years"), handles more
cases (e.g., "tu" is now a recognized abbreviation for "tuesday",
"3rd" is now equivalent to "third") and it has 2 fewer shift/reduce
conflicts.
2005-04-23 18:38:32 +00:00
Murray Stokely
793a2b6ef1 Point users to tcsh(1) for information about shell globbing patterns,
rather than 'XXXX'.

MFC after:	1 week
2005-04-19 16:06:04 +00:00
Tim Kientzle
5450e56ba4 A very minor tweak to the handling of leading '/' characters. 2005-04-17 19:46:50 +00:00
Tim Kientzle
5b923e58db A number of fixes to the autoconf-generated build system. In
particular, acl support is no longer enabled on FreeBSD 4, acl support
should be correctly enabled on Linux, dirent.d_namlen should be
correctly detected on platforms that support it.

Thanks to: Greg Lewis, Juergen Lock, and Jaakko Heinonen
2005-04-17 19:43:37 +00:00
Tim Kientzle
71526784e9 Configure script needs to test for dirent.d_namlen.
Thanks to: Juergen Lock
2005-04-17 17:53:24 +00:00
Tim Kientzle
fec57dbcd5 Update "make distfile" to use newest automake/autoconf from ports.
Thanks to: Juergen Lock
2005-04-17 17:51:05 +00:00
Tim Kientzle
e90e8e4b97 Support path-rewriting options (including --strip-components) for both
extraction and creation.  While I'm here, fix a bug reported by Garrett
Wollman: when stripping the leading '/' from the path "/", don't produce
an entry with an empty name; produce "." instead.
2005-04-17 17:20:54 +00:00
David E. O'Brien
a89017c846 Add directory hierarchy copying example. 2005-03-28 18:18:44 +00:00
Tim Kientzle
1ca479296c Deorbit gtar, step 1: Remove WITH_GTAR knob.
"tar" is now always a synonym for "bsdtar".
  People who need gtar can access it as "gtar."

Approved by:	No objections on arch@
2005-03-20 20:38:46 +00:00
Tim Kientzle
fd51bae501 A handful of minor portability and style improvements. 2005-03-14 00:30:35 +00:00
Tim Kientzle
fbef37980b Style correction: one tab after #define. 2005-03-14 00:29:05 +00:00
Tim Kientzle
bab7b08353 Re-unbreak the distfile target.
Also, reduce the WARNS level to 5 since different build environments
end up using different Yacc skeletons.  The BSD one does not
predeclare yyparse, the FSF one does, so it's not really possible to
consistently enforce both -Wmissing-prototypes and -Wredundant-decls.
2005-03-13 23:49:53 +00:00
Tim Kientzle
0c83e61cd1 Fix a compile warning, fix the build. 2005-03-13 21:36:15 +00:00
Tim Kientzle
6f55523db7 "make depend" with .y files is trickier than it looks. <sigh> 2005-03-13 19:55:53 +00:00
Tim Kientzle
3e41208d6e Brain-o. Missing quote. 2005-03-13 19:44:19 +00:00
Tim Kientzle
d14c1502f0 Add --newer-ctime, --newer-mtime, --newer-ctime-than, and --newer-mtime-than
switches to support selecting files by time of modification.

Special thanks to: Steven M. Bellovin, Rich $alz, and Jim Berets,
	authors of the public-domain getdate.y date-parsing code.
2005-03-13 18:36:24 +00:00
Tim Kientzle
62a2ad1b03 Add --strip-components option, per bin/77666.
Thanks to: Sangwoo Shim
2005-03-13 04:12:30 +00:00
Tim Kientzle
b432e867aa Document the --null, --one-file-system, and -I options.
Clarify that -T can be used in 'x' mode as well as 'c' mode.
2005-02-18 19:19:45 +00:00
Ruslan Ermilov
6c7216df78 Sort sections. 2005-01-18 13:43:56 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Tim Kientzle
225ac9a3dd Add a fallback version of fnmatch() to the bsdtar
source code.  Include configure logic to pick up the
system one when it exists and use the fallback version
when it doesn't exist.  Set the default for FreeBSD
to use the system version.

With this, bsdtar should now be quite portable.
2004-12-22 06:08:04 +00:00
Tim Kientzle
4d7142130b GC an unused #include 2004-12-22 05:54:10 +00:00
Tim Kientzle
882aa4c9cd Fix -W long option handling.
In particular:
  -W excl=text
fails because "excl" is a prefix of both "exclude" and "exclude-from".  But,
  -W exclude=text
is okay because it matches "exclude" exactly.

Thanks to: Jose F Nieves
MFC after: 7 days
2004-12-22 03:38:28 +00:00
Tim Kientzle
e69591ddc3 Portability: the included fts.c should now
compile on many non-FreeBSD systems, including
Linux, Solaris, Darwin, etc.

Thanks to: many people who pointed out the same portability problem
2004-12-22 00:21:28 +00:00
Ruslan Ermilov
2f841e1a7b Use a relative symlinking so that "tar" also works in /stand. 2004-11-12 13:28:42 +00:00
Tim Kientzle
2a44183a72 FreeBSD does have uintmax_t, so it can correctly
print out very large file sizes.

Thanks to: Yar Tikhiy
2004-11-06 18:38:13 +00:00
Tim Kientzle
f52188fc8a Correct error handling on failed writes
to the archive.
2004-11-05 05:39:37 +00:00
Tim Kientzle
9969ea22ef getopt(3) prints an "unrecognized option" warning for me, so I
shouldn't print another.

MFC after: 15 days
2004-10-17 23:58:17 +00:00
Tim Kientzle
ce7691dcad Cosmetic goof: Use two spaces in "Jan 03 2004" but only one in "Jan 03 12:32"
MFC after: 15 days
2004-10-17 23:57:10 +00:00
Tim Kientzle
cb7f04cf39 Make -C and -T work correctly together.
MFC after: 3 days
Thanks to: Guy Helmer
2004-08-28 05:28:19 +00:00
Tim Kientzle
6eb25c6af2 Document the -O option's new behavior in the presence of -t.
MFC after: 3 days
2004-08-27 04:19:28 +00:00
Tim Kientzle
773d437982 Support -t -O as in gtar. Perversely enough, -O means "send to stderr"
when used with -t, "send to stdout" when used with -x.

Thanks to: Ryan Hamilton for pointing out this odd beast
MFC after: 3 days
2004-08-27 04:13:15 +00:00
Tim Kientzle
85c6c73a4d Permit -P to be combined with -t. (It's a no-op then, just as in gtar.) 2004-08-26 06:28:39 +00:00
Tim Kientzle
1ced550de7 Tell getopt to accept the (already-implemented) -I option. 2004-08-26 01:58:14 +00:00
Tim Kientzle
fc1f10af70 Make -I and --files-from be synonyms for -T 2004-08-13 07:23:02 +00:00
Tim Kientzle
b757c8251b gtar uses -F for another purpose, so bsdtar no longer treats it as a
synonym for --format.  Update the man page to reflect this.  While
I'm here, change the man page to document "tar" rather than "bsdtar,"
update some comments about -l compatibility and fix a few grammar nits.
2004-08-08 17:20:23 +00:00
Tim Kientzle
6fc954815f Better low-memory handling: If the link cache runs out of memory, just
throw out the whole thing and stop tracking links entirely.  That will
break all remaining hardlinks, but should free up enough memory to
let everything finish.
2004-08-08 06:36:03 +00:00
Tim Kientzle
991f1d87bb Move the smart chdir logic into a couple of utility functions in util.c.
Then use them to provide consistent -C support throughout the program.
Thanks to: Christoph Mallon
2004-08-08 05:50:10 +00:00