Commit Graph

218 Commits

Author SHA1 Message Date
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