Commit Graph

349 Commits

Author SHA1 Message Date
kientzle
eadec7015b If -b is specified, then force full padding for the last block. 2004-06-07 03:19:57 +00:00
kientzle
299fedaaae Per style(9), don't use double spaces in expressions.
Pointed out by: njl, des.
2004-06-07 03:16:18 +00:00
kientzle
4cb95ee702 Pointy hat: sticky bit 't' or 'T' is shown over IXOTH bit, not IXGRP. <sigh> 2004-06-03 23:43:40 +00:00
kientzle
44e8bf5a41 Improve help handling:
* --help produces long help message on systems with getopt_long
   * -h with no other options also produces long help message
     (If a mode is specified, -h has its usual meaning.)
2004-06-02 21:01:27 +00:00
kientzle
3ffc90b560 Both "foo/" and "foo" should match "foo/bar", so strip
trailing '/' characters on include patterns for extraction.

Pointed out by: games/quakeforge port (thanks to Kris!)
2004-06-02 07:23:54 +00:00
kientzle
f939002db3 Correction: -h should be a synonym for -L, not -H.
(as specified by Linux Standards Base, GNU tar, and 4.4BSD documentation)
2004-05-31 20:22:41 +00:00
kientzle
b1210dbf1b Permit (but ignore) -Z with -x or -t, now that libarchive
recognizes and decompresses .Z format.
2004-05-30 00:09:43 +00:00
kientzle
cd6cc0b3f2 Minor corrections to error handling and user notifications:
* Move format/compression reporting to end of output, since
  we don't always know the input format until then.
* Set bsdtar exit value to 1 if any file could not be restored.
* Generate gtar-style warning when stripping leading '/' characters.
* Warn when removing symlinks.
2004-05-27 04:35:36 +00:00
kientzle
7d4928cd75 Provide framework for exiting with non-zero value on non-critical errors. 2004-05-27 04:30:59 +00:00
kientzle
cedda3bff2 Add --no-same-owner as a synonym for -o.
Note that bsdtar's -o (which follows SUSv2) is not the same as GNU tar's -o.
In GNU tar, -o and --no-same-owner are not synonyms.

Pointed out by: Kris Kennaway (required by xpenguins port)
2004-05-22 17:49:54 +00:00
kientzle
9da5e919aa Add --dereference as a synonym for -H
Pointed out by: Kris Kennaway (unbreaks nspr port build)
2004-05-21 18:40:32 +00:00
kientzle
e3a31f8a6e Default is to restore timestamps, even when operating as root. <sigh> 2004-05-19 01:21:11 +00:00
kientzle
2ccbdbb7fe Fix a segfault when looking up a non-existent group. 2004-05-18 23:40:25 +00:00
kientzle
014551a39f Accept (but ignore) GNU tar's -B option. bsdtar never
needs it, but it does no harm for people to specify it.
2004-05-18 17:16:55 +00:00
kientzle
75a7f5bd6e Set errno to 0 before calling getpwuid/getgrgid, so that error
messages will be displayed only when there is, in fact, an error.
2004-05-17 18:29:12 +00:00
kientzle
cf027fa3ed Speed up safe_fprintf by copying to a temp buffer, then writing
blocks at a time, rather than using putc().
2004-05-17 07:35:52 +00:00
kientzle
7ac80717ef Propagate struct bsdtar down into a lot more places.
Move global progname variable into struct bsdtar.
2004-05-17 05:44:53 +00:00
kientzle
7590026eae Refactor name caching to use a common piece of code for uname_cache and
gname_cache.  Cache negative lookups to dramatically improve performance
building archives containing nonexistent uid/gid.
2004-05-17 05:02:39 +00:00
kientzle
87b26a4b19 Make symlink protection a bit more useful:
* Remove terminal symlinks so they can be replaced.
  * If -U, remove intermediate symlinks as well
  * Otherwise, refuse the extraction
2004-05-17 03:33:06 +00:00
kientzle
91a38a30fb Update manpage to track new security features. 2004-05-17 03:19:31 +00:00
kientzle
0e6668dd2e Add --unlink and --unlink-first synonyms for -U
Make indentation of tar_longopts array more consistent.
2004-05-05 21:06:37 +00:00
kientzle
34a7b89d37 Contrariwise, Linux sys/stat.h doesn't define mode_t and friends,
even though POSIX requires it.  <sigh>
2004-05-04 21:40:09 +00:00
kientzle
7a80636e7f Include local copies of fts.c and fts.h to be used ONLY on non-FreeBSD
systems.  The fts.h here is an exact copy of include/fts.h (except for
an initial explanatory comment and the revision tags, of course).  The
fts.c here is slightly modified from lib/libc/gen/fts.c so it can
compile correctly on non-FreeBSD systems.
2004-05-04 17:21:01 +00:00
kientzle
cc93bc17a0 For portability, don't rely on libc's strmode(3). <sigh> 2004-05-03 21:05:59 +00:00
kientzle
79697f7186 Correct copy/paste error in Linux nodump support.
Thanks to: Juergen Lock for his continuing patience
while I botch his patches.
2004-05-03 16:56:42 +00:00
kientzle
490330a22a Style: Use single tab after #define 2004-05-02 22:58:18 +00:00
kientzle
a33004e479 More of Juergen Lock's patches for Linux.
(fflags support on Linux, nanosecond timestamp portability, enable
64-bit file offsets)
2004-05-02 18:10:35 +00:00
kientzle
e3af2353c4 A security issue: An archive containing a symlink to another
directory, then a file with that symlink as a prefix can drop a file
outside of the current directory, which can be a security hole.

Plug this hole by refusing to extract files if a prefix of the
pathname is a symlink.  The -P option disables this check.
2004-05-02 00:43:02 +00:00
kientzle
867bb40c44 -U is now implemented. (It's been recognized by bsdtar for a while;
now libarchive actually supports the underlying request.)
2004-04-29 05:22:13 +00:00
kientzle
83ecd7781e Refuse to extract entries with '..' in pathname.
Pointed out by: David Schultz
2004-04-28 18:53:07 +00:00
kientzle
927b01d312 Remove information about specific formats; replace with a
reference to libarchive-formats(5).
2004-04-28 04:43:57 +00:00
kientzle
06760f99a1 Update write.c to follow recent API changes to libarchive.
Also, bump up the default copy buffer from 8k to 64k
to improve performance.
2004-04-26 23:39:17 +00:00
kientzle
fe93d4f02e Fix username/groupname cache so it returns a name that
was just looked up by get{pw,gr}id().  Otherwise, it
returns a NULL name unless it's already in the cache.

Credit to Juergen Lock.
2004-04-23 16:33:51 +00:00
kientzle
15ca1ccb2d Eliminate a redundant call to archive_entry_set_pathname() 2004-04-21 05:16:28 +00:00
kientzle
6dec29ccab Allow brave souls to install bsdtar as the
default "tar" command by defining WITH_BSDTAR.

Note: "gtar" and "bsdtar" commands both exist regardless.
2004-04-19 22:09:04 +00:00
kientzle
484ec180f1 --help is only supported if you have getopt_long().
This allows bsdtar to compile on FreeBSD 4.x.
2004-04-16 03:50:04 +00:00
kientzle
2b19543d6c As suggested by Julian Elischer, use a self-sizing hash
table for the hardlink cache.  This dramatically improves
performance when archiving millions of hardlinked files.

While I'm here, clean up some style bugs (per Bruce Evans)
and clarify some comments.
2004-04-15 22:37:54 +00:00
kientzle
58455f9e3f A simple cache of uid->uname lookups and gid->gname lookups eliminates
almost 1/2 of the CPU time required to create an uncompressed archive
and makes a noticable reduction in wallclock time.
2004-04-14 00:40:54 +00:00
kientzle
2d6a22a91d When all the links to a file have been dumped, don't forget
to free() the memory used to store the filename.
2004-04-13 23:50:48 +00:00
kientzle
a67431b09b Eliminate a lot of malloc/free calls by using
a stack-allocated buffer for safe_fprintf formatting.
Only if the result is too large do we resort to malloc.
2004-04-13 23:49:02 +00:00
kientzle
ec9a891664 Manpage changes suggested by Irina Liakh.
Also, add -h as a synonym for -H, for Linux Standards Base compliance.
2004-04-13 19:45:55 +00:00
kientzle
d1f2ebdf42 Style fixes
Pointed out by: bde
2004-04-12 18:06:07 +00:00
kientzle
cd3b6fa4ac Add DPADD to Makefile (thanks to Andrey for pointing this out).
Generally clean up Makefile, remove dmalloc references from source
(there are better ways to do this than pollute the FreeBSD src tree).
2004-04-12 00:13:23 +00:00
kientzle
e5943c5d79 Allow arguments to appear in any order.
While I'm here, add a couple of extra sanity-checks to
the argument parsing (reject -j -z, for instance) and
update the docs a bit.

Requested by: most everyone ;-)
2004-04-08 19:37:01 +00:00
kientzle
72bca63fd4 Document the newly-implemented -T option. 2004-04-08 06:21:03 +00:00
kientzle
1b8aab3f61 Add support for -T option on create.
(Required by pkg_create.)
2004-04-08 06:12:01 +00:00
kientzle
a970bab144 Correct signature in alternative stub implementation of setup_acls() 2004-04-07 17:43:48 +00:00
kientzle
a356af4fc7 Archive both access and default ACLs. 2004-04-06 23:08:31 +00:00
kientzle
2588e5ad7a Initial commit for bsdtar. 2004-04-05 21:32:18 +00:00