Commit Graph

27 Commits

Author SHA1 Message Date
kientzle
a88f72ea58 Minor portability improvement in calls to ctype.h macros. 2009-04-17 03:37:09 +00:00
kientzle
482c4aae45 Merge r709,r710 from libarchive.googlecode.com: More work on
Windows support.
2009-03-08 06:07:35 +00:00
kientzle
9ab299b136 Merger r629-631,633-646,648,654,678,681,682 from libarchive.googlecode.com:
Many changes for Windows compatibility.  bsdtar_test now runs successfully
on both POSIX platforms and Windows.
2009-03-08 05:47:21 +00:00
kientzle
93903defed Merge r622 from libarchive.googlecode.com: Avoid warning on platforms
that lack regex.h.
2009-03-08 05:35:59 +00:00
kientzle
664c3aeb01 Spell "substitution" correctly.
PR:		bin/128616
Submitted by:	Jaakko Heinonen
Pointy hat:	Tim Kientzle
MFC after:	30 days
2008-12-15 06:00:25 +00:00
kientzle
3a229bf1d0 When deciding which characters (of a filename, for instance)
are safe to print, try to take into account the current locale.
This iterates over output strings using mbtowc() to identify
multi-byte sequences.  If iswprint() claims the corresponding
wide character is printable, the original bytes are passed
through.  Otherwise, we expand characters into C-style
\-escape sequences.

Submitted by:	Michihiro NAKAJIMA
MFC after:	30 days
2008-11-29 20:06:53 +00:00
kientzle
19a4817b26 Test --strip-components and fix it to actually work. Jaakko did a
good job writing this test; it exercises a lot of subtle cases.  The
trickiest one is that a hardlink to something that didn't get
extracted should not itself be extracted.  In some sense, this is not
the desired behavior (we'd rather restore the file), but it's the best
you can do in a single-pass restore of a tar archive.

The test here should be extended to exercise cpio and newc formats as
well, since their hardlink models are different, which will lead to
different handling of some of these edge cases.

Submitted by:	Jaakko Heinonen
MFC after:	30 days
2008-11-10 05:04:55 +00:00
cperciva
02aa7dcfd9 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
kientzle
0280e5aa49 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
kientzle
9f949d65f6 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
kientzle
4db8f3e0cc 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
kientzle
7cd084865b 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
kientzle
72f9822584 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
kientzle
2276f34c5f 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
kientzle
6857f1e3f7 A very minor tweak to the handling of leading '/' characters. 2005-04-17 19:46:50 +00:00
kientzle
ec0a4e2bdb 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
kientzle
03cc09682b 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
kientzle
c2fb7a1b2d A bunch of style and security fixes (error checking return values, etc),
mostly from: Tim J Robbins
2004-07-25 04:15:50 +00:00
kientzle
2e75ccba07 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
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
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
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
cc93bc17a0 For portability, don't rely on libc's strmode(3). <sigh> 2004-05-03 21:05:59 +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
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
2588e5ad7a Initial commit for bsdtar. 2004-04-05 21:32:18 +00:00