Commit Graph

70 Commits

Author SHA1 Message Date
Ruslan Ermilov
6a3e8b0adc Mechanically kill hard sentence breaks. 2004-07-02 22:22:35 +00:00
Tim Kientzle
77d2ac4af5 Add yet another synonym for -n. 2004-06-28 14:02:22 +00:00
Tim Kientzle
da9cbfaa5d Update -p:
* Don't change the umask; the library now ignores the umask if
    you set EXTRACT_PERM
  * Set the EXTRACT_ACL and EXTRACT_FFLAGS bits (used to be
    controlled by EXTRACT_PERM).
2004-06-27 23:29:44 +00:00
Tim Kientzle
e2fe7499b6 Warn about stripping leading '/' when creating archives. 2004-06-27 18:32:14 +00:00
Tim Kientzle
d3d1a208cb Augment the -T handling:
* Add --null option (sort #defines here)
 * Add process_lines function to util.c that reads newline-terminated
   or null-terminated lines (with self-sizing buffers, etc) and iteratively
   invokes a provided function.  Use this to dramatically simplify:
   -T handling for -c, --exclude-from-file, and --include-from-file.
 * Add -T handling to -x (via include_from_file)

Hopefully, this will fix the openoffice port and a couple of
others that rely on -T and --null.
2004-06-27 06:29:03 +00:00
Tim Kientzle
d24e5e453e Fix "@-" which has apparently been broken for some time. <sigh>
While I'm here, add in a lot more error-checking around append_archive.
2004-06-27 03:28:13 +00:00
Tim Kientzle
4049589b28 Don't abort immediately on directory change errors.
Instead, display a warning, clean up, and let main() return the error.
In particular, this means that chdir() problems won't leave broken
archives, though they will prompt an error exit value.
2004-06-27 01:08:54 +00:00
Tim Kientzle
f758d316c0 Document the -W convention for accessing long options.
Also correct an old error: there was no tar command in Sixth Edition.
2004-06-26 22:58:29 +00:00
Tim Kientzle
0674dded37 Rename C=dir to -C dir, which is what people expect.
This requires some non-trivial surgery to the options parsing.

While here, let people who only have getopt() access long options
through the -W longopt=value convention.
2004-06-26 22:49:51 +00:00
Tim Kientzle
d18eca7d48 Update some internal comments about the --no-same-permissions option.
Thanks to: Kris Kennaway for doing some gtar research for me.
2004-06-15 07:16:44 +00:00
Tim Kientzle
4150562c7b As near as I can tell, --no-same-permissions is a no-op in
gtar, so that makes it easy to implement.

Required by: audio/timidity port
Thanks to: Kris Kennaway
2004-06-15 06:44:41 +00:00
Tim Kientzle
d2286340c9 Oops. bsdtar's old -X option didn't take an argument; the new
(gtar-compatible) one does require an argument.
2004-06-15 06:24:54 +00:00
Tim Kientzle
b7ec47bb9f Add gtar-compatible -X/--exclude-from 2004-06-15 05:55:41 +00:00
Tim Kientzle
b9d38fa25a Fix build. 2004-06-15 01:51:45 +00:00
Tim Kientzle
24220f2890 Rename -X to --one-file-system, as GNU tar uses -X for
something else.  I would really like a short option for
this, but all of the obvious ones conflict with something else.
2004-06-15 00:28:34 +00:00
Tim Kientzle
5a57a7f095 Clean up usage message(s):
* Usage goes to stderr, not stdout
  * Use correct argument markup
  * bsdtar --help  no longer exits with an error return code
  * ensure that the word "bsdtar" appears in the first
    line output from "bsdtar --help" (even if the program is
    invoked as "tar")

In particular, scripts can now test for the presence of bsdtar.
For example, in /bin/sh:

if (tar --help 2>&1 | grep bsdtar >/dev/null 2>&1) then \
          echo bsdtar; else echo not bsdtar; fi
2004-06-15 00:07:23 +00:00
Tim Kientzle
c066ba2f01 Oops: gtar's --dereference should be a synonym for bsdtar's -L, not -H.
Pointed out by: devel/nspr port
Thanks to: Kris Kennaway
2004-06-11 01:35:56 +00:00
Tim Kientzle
a85e1b56bb Set program exit value to 1 if there are any of various errors when
creating an archive.

Pointed out by: Failure to complain when building certain broken packages
(Thanks again to Kris Kennaway for finding this!)
2004-06-07 07:19:04 +00:00
Tim Kientzle
af2ef563dd Fix the symlink-detection code. Don't squawk if we're just replacing
an existing symlink (as might happen if you extract an archive twice).
Also, if we remove the offending link, then we've removed the problem
and can safely go forward with the extraction.

Pointed out by: print/adobe-cmaps port (whose distfile has
	duplicate entries for the same symlinks)
Thanks to: Kris Kennaway (for using ports as a testbed for bsdtar)
2004-06-07 04:10:43 +00:00
Tim Kientzle
a55bfb25e7 The --include='pattern' option is the natural counterpart to
--exclude='pattern'.

I should have added this a long time ago, since it's so useful for testing.
In particular, it allows me to select a few entries from a troublesome
archive so that I can easily focus my debugging efforts:
   bsdtar -czf new.tgz --include='*foo*' @old.tgz
2004-06-07 03:49:48 +00:00
Tim Kientzle
b5642237fc Ooops! Previous commit added an over-zealous error check.
It is, in fact, perfectly legal to not specify a compression when
writing an archive. <sigh>
2004-06-07 03:38:17 +00:00
Tim Kientzle
e1f5ccf6fb If -b is specified, then force full padding for the last block. 2004-06-07 03:19:57 +00:00
Tim Kientzle
2225b76daf Per style(9), don't use double spaces in expressions.
Pointed out by: njl, des.
2004-06-07 03:16:18 +00:00
Tim Kientzle
5251608d94 Pointy hat: sticky bit 't' or 'T' is shown over IXOTH bit, not IXGRP. <sigh> 2004-06-03 23:43:40 +00:00
Tim Kientzle
755e3f9b2e 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
Tim Kientzle
e47b3d7a25 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
Tim Kientzle
e5572b4b7c 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
Tim Kientzle
de10ed4154 Permit (but ignore) -Z with -x or -t, now that libarchive
recognizes and decompresses .Z format.
2004-05-30 00:09:43 +00:00
Tim Kientzle
f0e6a2b96d 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
Tim Kientzle
8df3c224c0 Provide framework for exiting with non-zero value on non-critical errors. 2004-05-27 04:30:59 +00:00
Tim Kientzle
26eddc7f41 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
Tim Kientzle
c5ce4977e6 Add --dereference as a synonym for -H
Pointed out by: Kris Kennaway (unbreaks nspr port build)
2004-05-21 18:40:32 +00:00
Tim Kientzle
04e2d02e20 Default is to restore timestamps, even when operating as root. <sigh> 2004-05-19 01:21:11 +00:00
Tim Kientzle
873e38290a Fix a segfault when looking up a non-existent group. 2004-05-18 23:40:25 +00:00
Tim Kientzle
656e70b49a 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
Tim Kientzle
a25502627d 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
Tim Kientzle
9d77c5f29c 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
Tim Kientzle
088bdb251d Propagate struct bsdtar down into a lot more places.
Move global progname variable into struct bsdtar.
2004-05-17 05:44:53 +00:00
Tim Kientzle
7283cd6959 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
Tim Kientzle
4a07f42b98 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
Tim Kientzle
dcec34670d Update manpage to track new security features. 2004-05-17 03:19:31 +00:00
Tim Kientzle
81f3488f97 Add --unlink and --unlink-first synonyms for -U
Make indentation of tar_longopts array more consistent.
2004-05-05 21:06:37 +00:00
Tim Kientzle
bf0c356cdf 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
Tim Kientzle
6e8b30b778 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
Tim Kientzle
9644b0783f For portability, don't rely on libc's strmode(3). <sigh> 2004-05-03 21:05:59 +00:00
Tim Kientzle
ce722a01be 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
Tim Kientzle
f1fe72c1cc Style: Use single tab after #define 2004-05-02 22:58:18 +00:00
Tim Kientzle
732db834d2 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
Tim Kientzle
020287607f 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
Tim Kientzle
6c6b3d9aa5 -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