Commit Graph

16 Commits

Author SHA1 Message Date
Tim Kientzle
d21d99e07e Reading an mtree file is supposed to provide
access to the file data (if the file exists on
disk).  This was broken for the first regular
file; fix it and add a test so it won't break again.

In particular, this fixes the following idiom for creating
a tar archive in which every file is owned by root:

tar cf - --format=mtree . 	\
    | sed -e 's/uname=[a-z]*/uname=root/' -e 's/uid=[0-9]*/uid=0/' \
    | tar cf - @-
2009-04-26 18:57:50 +00:00
Tim Kientzle
c190973e9d Fix a memory leak: Release the current list of /set keywords
even when we exit on an error.
2009-04-17 01:02:56 +00:00
Tim Kientzle
21bbe086cb Merge r511,r513,r607 from libarchive.googlecode.com: Mtree reader
tweaks:  Support nanosecond timestamps, handle attributes broken
across multiple lines.
2009-03-07 02:58:15 +00:00
Tim Kientzle
eee9002fb2 Merge r552,r559 from libarchive.googlecode.com: Support high-resolution
timestamps on Tru64, AIX, and GNU Hurd.  Thanks to Björn Jacke.
2009-03-07 00:52:02 +00:00
Tim Kientzle
634fb9dd48 Merge r491,493,500,507,510,530,543 from libarchive.googlecode.com:
This implements the new generic options framework that provides a way
to override format- and compression-specific parameters.
2009-03-06 05:58:56 +00:00
Tim Kientzle
b1ff9c25b8 MfP4: Big read filter refactoring.
This is an attempt to eliminate a lot of redundant
code from the read ("decompression") filters by
changing them to juggle arbitrary-sized blocks
and consolidate reblocking code at a single point
in archive_read.c.

Along the way, I've changed the internal read/consume
API used by the format handlers to a slightly
different style originally suggested by des@.  It
does seem to simplify a lot of common cases.

The most dramatic change is, of course, to
archive_read_support_compression_none(), which
has just evaporated into a no-op as the blocking
code this used to hold has all been moved up
a level.

There's at least one more big round of refactoring
yet to come before the individual filters are as
straightforward as I think they should be...
2008-12-06 06:45:15 +00:00
Tim Kientzle
a370f3ca73 Trying to distinguish different "versions" of mtree files was a silly idea.
Submitted by:	Joerg Sonnenberger
2008-09-18 04:13:36 +00:00
Tim Kientzle
8a4ce0fb38 MfP4: Joerg Sonnenberg's extensions to the mtree support for more
complete quoting.  In particular, this handles escaped newlines
and common C-style escapes.
2008-06-21 19:06:37 +00:00
Tim Kientzle
dff2641a67 Be a little more careful about closing file descriptors that may not exist. 2008-06-15 10:43:59 +00:00
Colin Percival
7254457b50 Don't store a pointer in "next" if we're never going to use it.
Fix typo in checking results of strchr.

Found by:	Coverity Prevent
2008-06-09 14:44:56 +00:00
Tim Kientzle
fa07de5eeb MFp4: libarchive 2.5.4b. (Still 'b' until I get a bit more
feedback, but the 2.5 branch is shaping up nicely.)

In addition to many small bug fixes and code improvements:
 * Another iteration of versioning; I think I've got it right now.
 * Portability:  A lot of progress on Windows support (though I'm
   not committing all of the Windows support files to FreeBSD CVS)
 * Explicit tracking of MBS, WCS, and UTF-8 versions of strings
   in archive_entry; the archive_entry routines now correctly return
   NULL only when something is unset, setting NULL properly clears
   string values.  Most charset conversions have been pushed down to
   archive_string.
 * Better handling of charset conversion failure when writing or
   reading UTF-8 headers in pax archives
 * archive_entry_linkify() provides multiple strategies for
   hardlink matching to suit different format expectations
 * More accurate bzip2 format detection
 * Joerg Sonnenberger's extensive improvements to mtree support
 * Rough support for self-extracting ZIP archives.  Not an ideal
   approach, but it works for the archives I've tried.
 * New "sparsify" option in archive_write_disk converts blocks of nulls
   into seeks.
 * Better default behavior for the test harness; it now reports
   all failures by default instead of coredumping at the first one.
2008-05-26 17:00:24 +00:00
Colin Percival
ee99deabac Return ARCHIVE_FATAL if we can't allocate memory instead of going ahead and
dereferencing NULL.

Found by:	Coverity Prevent
2008-05-19 18:06:48 +00:00
Tim Kientzle
c43d294189 Correct a sign mismatch that only showed up on 64-bit systems.
Pointy hat: me
2008-03-15 11:02:47 +00:00
Tim Kientzle
3010219939 Refactor the mtree code a bit to make the layering clearer: Each
"file" is described by multiple "lines" each possibly containing
multiple "keywords."  Incorporate some additions from Joerg Sonnenberger
to handle linked files and correctly deal with backing files on disk.
2008-03-15 07:10:24 +00:00
Tim Kientzle
b3fa7a9568 Include O_BINARY in open() calls on platforms that support it. 2008-02-19 06:10:48 +00:00
Tim Kientzle
9dd49f960f Update libarchive to 2.4.10. This includes a number of improvements
that I've been working on but put off committing until after the
RELENG_7 branch, including:

* New manpages: cpio.5 mtree.5
* New archive_entry_strmode()
* New archive_entry_link_resolver()
* New read support: mtree format
* Internal API change:  read format auction only runs once
* Running the auction only once allowed simplifying a lot of bid logic.
* Cpio robustness:  search for next header after a sync error
* Support device nodes on ISO9660 images
* Eliminate a lot of unnecessary copies for uncompressed archives
* Corrected handling of new GNU --sparse --posix formats
* Correctly handle a zero-byte write to a compressed archive
* Fixed memory leaks

Many of these improvements were motivated by the upcoming bsdcpio
front-end.

There have also been extensive improvements to the libarchive_test
test harness, which I'll commit separately.
2007-12-30 04:58:22 +00:00