summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_entry.c
Commit message (Collapse)AuthorAgeFilesLines
* Update libarchive to 2.4.10. This includes a number of improvementskientzle2007-12-301-5/+26
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add archive_entry_copy_gname() and archive_entry_copy_uname()kientzle2007-07-151-0/+12
| | | | | | | functions. Approved by: re (bmah) MFC after: 3 days
* libarchive 2.2.3kientzle2007-05-291-169/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * "compression_program" support uses an external program * Portability: no longer uses "struct stat" as a primary data interchange structure internally * Part of the above: refactor archive_entry to separate out copy_stat() and stat() functions * More complete tests for archive_entry * Finish archive_entry_clone() * Isolate major()/minor()/makedev() in archive_entry; remove these from everywhere else. * Bug fix: properly handle decompression look-ahead at end-of-data * Bug fixes to 'ar' support * Fix memory leak in ZIP reader * Portability: better timegm() emulation in iso9660 reader * New write_disk flags to suppress auto dir creation and not overwrite newer files (for future cpio front-end) * Simplify trailing-'/' fixup when writing tar and pax * Test enhancements: fix various compiler warnings, improve portability, add lots of new tests. * Documentation: document new functions, first draft of libarchive_internals.3 MFC after: 14 days Thanks to: Joerg Sonnenberger (compression_program) Thanks to: Kai Wang (ar) Thanks to: Colin Percival (many small fixes) Thanks to: Many others who sent me various patches and problem reports.
* More portability improvements from Martin Koeppe:kientzle2007-04-141-11/+17
| | | | | | conditionally use utime() when utimes() is not available; allow the most common wide-char functions to be replaced when local alternatives are lacking.
* Style fixes from Joerg Sonnenberger: use correct types,kientzle2007-04-051-5/+7
| | | | spell lint(1) comments correctly.
* Libarchive 2.0.23:kientzle2007-03-111-116/+129
| | | | | | | | | | | | * The ACL formatter was mis-formatting entries which had a user/group ID but no name. Make the parser tolerant of these, so that old archives can be correctly restored; fix the formatter to generate correct entries. * Fix overwrite detection by introducing a new "FAILED" return code that indicates the current entry cannot be continued but the archive as a whole is still sound. * Header cleanup: Remove some unused headers, add some that are required with new Linux systems.
* Distinguish between the end of ACL data and an error in pullingkientzle2007-03-081-1/+1
| | | | | | | ACL data from the archive entry. This doesn't impact archive_read_extract or archive_write_disk since they only check for != ARCHIVE_OK when calling this function. (Though they should be more careful.)
* Because the buffer gets released immediately, I need tokientzle2007-03-011-0/+6
| | | | | | | | copy the symlink target name, not just copy the reference. This problem sometimes caused crashes when extracting symlinks from ISO9660 images. Thanks to: Diego "Flameeyes" Pettenò
* Fix the copyright notice; it was always intended to bekientzle2007-01-091-3/+2
| | | | | | | | | a vanilla 2-clause BSD license, but somehow some confusing extra verbage get copied from somewhere. Also, update the copyright dates to 2007 for all of the files. Prompted by: several questions about what those extra words really mean
* Portability and style fixes:kientzle2006-11-101-16/+26
| | | | | | | | | | | | | | * Actually use the HAVE_<header>_H macros to conditionally include system headers. They've been defined for a long time, but only used in a few places. Now they're used pretty consistently throughout. * Fill in a lot of missing casts for conversions from void*. Although Standard C doesn't require this, some people have been trying to use C++ compilers with this code, and they do require it. Bit-for-bit, the compiled object files are identical, except for one assert() whose line number changed, so I'm pretty confident I didn't break anything. ;-)
* Whitespace cleanup.kientzle2006-05-011-2/+2
|
* POSIX.1e-style Extended Attribute supportkientzle2006-03-211-4/+109
| | | | | | | | | | | This commit implements storing/reading POSIX.1e-style extended attribute information in "pax" format archives. An outline of the storage format is in the tar.5 manpage. The archive_read_extract() function has code to restore those archives to disk for Linux; FreeBSD implementation is forthcoming. Many thanks to Jaakko Heinonen for finding flaws in earlier proposals and doing the bulk of the coding in this work.
* Portability: Use some autoconf magic to include thekientzle2005-11-081-0/+7
| | | | | | | correct headers for major()/minor()/makedev() on various platforms. Thanks to: Darin Broady
* In pax interchange format, use UTF8 for writingkientzle2005-10-121-0/+28
| | | | | | | | | | link names, usernames, or group names that contain non-ASCII characters. In particular, this corrects an inconsistency reported by Ed Maste when archiving symlinks with odd characters: long symlinks would get preserved, short ones would be changed.
* Add a lot of error checks, based on the patches provided by Dan Lukes.kientzle2005-09-211-2/+21
| | | | | | | Also fixes a memory leak reported by Andrew Turner. PR: bin/83476 Thanks to: Dan Lukes, Andrew Turner
* Style issue: Don't include <wchar.h> where it is not actually needed.kientzle2005-09-101-1/+23
| | | | | | | | | (wchar_t is defined in stddef.h, and only two files need more than that.) Portability: Since the wchar requirements are really quite modest, it's easy to define basic replacements for wcslen, wcscmp, wcscpy, etc, for use on systems that lack <wchar.h>. In particular, this allows libarchive to be used on older OpenBSD systems.
* Sort archive_entry_ctime/archive_entry_ctime_nsec correctly.kientzle2005-06-041-13/+13
|
* Provide missing implementations for archive_entry_ctime() andscottl2005-06-011-0/+13
| | | | archive_entry_ctime_nano()
* A minor refinement to "pax" output: Remove suid/sgid/sticky bitskientzle2005-06-011-0/+14
| | | | | | | | from mode before using mode for extended attributes entry, copy mtime/atime/ctime to extended attributes entry so it's a little more clear that it corresponds to the like-named regular entry. MFC after: 14 days
* archive_entry_set_link is supposed to update whichever link fieldkientzle2005-05-081-1/+2
| | | | | | | | | (symlink or hardlink) is already set. Instead, it was always setting the hardlink field. In particular, this caused GNU tar format long symlinks to be interpreted as hardlinks. Thanks to: Brooks Davis MFC after: 7 days
* Support extracting entries with pathnames longer than PATH_MAX. Inkientzle2005-03-131-0/+6
| | | | | testing, I've archived and restored dir trees with ~1MB pathnames. Most formats, of course, have much smaller limits.
* Be more careful about assembling/disassemblingkientzle2004-12-111-2/+2
| | | | | | | | | | device numbers. In particular, this should fix a bug where archiving a device node with a very large minor number would sometimes overflow and corrupt the major number. Thanks to: Ben Mesander MFC after: 7 days
* Add archive_entry_set_mtime()kientzle2004-08-081-0/+7
|
* libarchive now has two complete build systems. The usual "Makefile"kientzle2004-08-071-3/+3
| | | | | | | | | | | | | | is present for FreeBSD. If you "make distfile" on FreeBSD, you will soon have a tar.gz file suitable for deploying to other systems (complete with the expected "configure" script, etc). This latter relies (at least for now) on the GNU auto??? tools. (I like autoconf okay, but someday I hope to write a custom Makefile.in and dispense with automake, which is somewhat odious.) As part of this, I've cleaned up some of the conditional compilation options, added make-foo to construct archive.h dynamically (it now contains some version constants), and added some useful informational files.
* Pass the pointy hat, please: Don't blow away the high-orderkientzle2004-08-071-3/+3
| | | | | | | mode bits when setting permissions from ACL data. Thanks to: David Gilbert for first reporting this and Jimmy Olgeni for noticing that it only occurred on ACL-enabled filesystems.
* Suppress a minor compiler warning if the platform doesn't support hi-reskientzle2004-07-241-0/+2
| | | | timestamps.
* Use "linux" instead of "LINUX" to control Linux-specific code.kientzle2004-07-241-1/+1
| | | | | | | | Thanks to: David O'Brien for pointing this out. Also, add in a few additional portability tweaks and make a few more things conditional on features (HAVE_XXXX macros) rather than platform.
* Add convenience functions to retrieve the atime fields directly,kientzle2004-07-051-0/+12
| | | | without having to first pull the stat structure.
* Add two new convenience functions to query the uid/gid from ankientzle2004-06-271-0/+12
| | | | | | | | | archive_entry. Update the Makefile MLINKS and manpage to bring it up-to-date with the current status of archive_entry. At least the manpage actually lists all of the functions now, even if it doesn't really yet explain them all.
* Clean up some consistent confusion between "dev" and "rdev."kientzle2004-06-271-28/+44
| | | | | | | | Mostly, these were being used correctly even though a lot of variables and function names were mis-named. In the process, I found and fixed a couple of latent bugs and added a guard against adding an archive to itself.
* Ignore file flag bits that we don't support. In particular, thiskientzle2004-06-191-0/+2
| | | | | | | corrects a segfault seen when archiving files from NTFS (which sets bits in st_flags that are not documented in <sys/stat.h>.) Thanks to: Doug Rabson
* GC some no-longer-used constants.kientzle2004-05-271-2/+0
|
* Correct parsing of Solaris default ACLs.kientzle2004-05-211-4/+6
|
* Consistify: #define gets 1 tab character afterwardskientzle2004-05-031-2/+2
| | | | Pointed out by: Simon Nielsen
* Include appropriate flag header on Linux.kientzle2004-05-021-0/+4
|
* Update file flag handling.kientzle2004-04-261-29/+298
| | | | | | | | | | | | | | | | The new fflags support in archive_entry supports Linux and FreeBSD file flags and is a bit more gracious about unrecognized flag names than strtofflags(3). This involves some minor API breakage. The default tar format ("restricted pax") now enables pax extensions when archiving files that have flags. In particular, copying dir heirarchies with 'bsdtar cf - -C src . | bsdtar xpf - -C dest' now preserves file flags. (Note the "p" on extract!) While I'm here, fill in some additional explanation in the archive_entry.3 manpage, fill in some missing MLINKS, mark some overlooked internal functions 'static', and make a few minor style fixes.
* Make clone more aggressive about copying strings to the new entry.kientzle2004-04-231-9/+9
| | | | | | | | | The original might have pointers to user-specified strings; copying the string (instead of just the pointer) protects against the client re-using their own buffers. I'm trying hard to avoid dumping all of the 'set' string functions in favor of slower, but more predictable 'copy' semantics.
* More portability improvements, thanks to Juergen Lock.kientzle2004-04-211-2/+1
| | | | | | High-resolution mtime/ctime/atime is not POSIX-standard, so hide set/get of high-resolution time fields behind easily-mutable macros. That makes it easier to change how those fields are accessed.
* * Plug a buffer overrun in ACL parsing. (archive_entry.c)kientzle2004-04-131-0/+7
| | | | | | | * Re-use a single buffer for shar output formatting rather than hammering the heap. (archive_write_set_format_shar.c) * Fix a handful of minor memory leaks and clean up some of the memory-management code.
* More work on ACLs: fix error in archive_entry's ACL parsing code,kientzle2004-04-121-23/+13
| | | | | | | | | | | | | | try to set ACLs even if fflag restore fails, first cut at reading Solaris tar ACLs Code improvement: merge gnu tar read support into main tar reader; this eliminates a lot of duplicate code and generalizes the tar reader to handle formats with GNU-like extensions. Style: Makefile cleanup, eliminate 'dmalloc' references, remove 'tartype' from archive_entry (this makes archive_entry more format-agnostic) Thanks to: David Magda for providing Solaris tar test files
* Fix some issues with ACL handling:kientzle2004-04-061-35/+49
| | | | | | | | | | * ACL storage is no longer erased before a group of entries are added. * ACL text creation no longer tries to skip over non-existent text. * UTF8 encoder no longer blows up on invalid wide characters. * Fixed ACL state management for default ACLs. Also, publicize function for obtaining text-format ACL in various formats. The interface is now extensible through a "flags" argument that allows you to select a variant format.
* Overhauled ACL support. This makes us compatiblekientzle2004-04-051-51/+696
| | | | | | | | | | | | with 'star' ACL handling, though there's still a bit more work needed in this area. Added 'write_open_fd' and 'read_open_fd' to simplify, e.g., tar's u and r modes. Eliminated old 'write_open_file_position' as a bad idea. (It required closing/reopening files to do updates, which led to unpleasant implications.) Various other minor fixes, API tweaks, etc.
* Many fixes:kientzle2004-03-191-103/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Disabled shared-library building, as some API breakage is still likely. (I didn't realize it was turned on by default.) If you have an existing /usr/lib/libarchive.so.2, I recommend deleting it. * Pax interchange format now correctly stores and reads UTF8 for extended attributes. In particular, pax format can portably handle arbitrarily long pathnames containing arbitrary characters. * Library compiles cleanly at -O2, -O3, and WARNS=6 on all FreeBSD-CURRENT platforms. * Minor portability improvements inspired by Juergen Lock and Greg Lewis. (Less reliance on stdint.h, isolating of various portability-challenged constructs.) * archive_entry transparently converts multi-byte <-> wide character strings, allowing clients and format handlers to deal with either one, as appropriate. * Support for reading 'L' and 'K' entries in standard tar archives for star compatibility. * Recognize (but don't yet handle) ACL entries from Solaris tar. * Pushed format-specific data for format readers down into format-specific storage and out of library-global storage. This should make it easier to maintain individual formats without mucking with the core library management. * Documentation updates to track the above changes. * Updates to tar.5 to correct a few mistakes and add some additional information about GNU tar and Solaris tar formats. Notes: * The basic 'tar' reader is getting more general; there's not much point in keeping the 'gnutar' reader separate. Merging the two would lose a bunch of duplicate code. * The libc ACL support is looking increasingly inadequate for my needs here. I might need to assemble some fairly significant code for parsing and building ACLs. <sigh>
* Many fixes.kientzle2004-03-091-2/+2
| | | | | | | | | | | | | | | | Portability: Thanks to Juergen Lock, libarchive now compiles cleanly on Linux. Along the way, I cleaned up a lot of error return codes and reorganized some code to simplify conditional compilation of certain sections. Bug fixes: * pax format now actually stores filenames that are 101-154 characters long. * pax format now allows newline characters in extended attributes (this fixes a long-standing bug in ACL handling) * mtime/atime are now restored for directories * directory list is now sorted prior to fix-up to permit correct restore of non-writable dir heirarchies
* Initial import of libarchive.kientzle2004-02-091-0/+407
What it is: A library for reading and writing various streaming archive formats, especially tar and cpio. Being a library, it should be easy to incorporate into pkg_* tools, sysinstall, and any other place that needs to read or write such archives. Features: * Full automatic detection of both compression and archive format. * Extensible internal architecture to make it easy to add new formats. * Support for "pax interchange format," a new POSIX-standard tar format that eliminates essentially all of the restrictions of historic formats. * BSD license Thanks to: jkh for pushing me to start this work, gordon for encouraging me to commit it, bde for answering endless style questions, and many others for feedback and encouragement. Status: Pretty good overall, though there are still a few rough edges and the library could always use more testing. Feedback eagerly solicited.
OpenPOWER on IntegriCloud