summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/test
Commit message (Collapse)AuthorAgeFilesLines
* Add a test to verify compatibility with archives withkientzle2008-01-313-0/+145
| | | | | odd hardlinks. I need to extend this to test pax extended archives with bodies attached to hardlinks and other less-common cases.
* Explain a subtle API change that was made recently.kientzle2008-01-231-0/+21
| | | | | | Even though I believe this is a good change, it does have the potential to break certain clients, so it's good to document the reasoning behind the change.
* Properly pad symlinks when writing cpio "newc" format.kientzle2008-01-231-3/+42
| | | | | Thanks to: Jesse Barker for reporting this. MFC after: 7 days
* The previous commit caused the archive_write_disk interface tokientzle2008-01-181-0/+2
| | | | | start obeying filesize limits; this test wasn't properly setting file sizes before trying to write file data.
* Issues with hardlinks in newc-format files prompted me tokientzle2008-01-182-0/+166
| | | | | | | | | | | | | | | | | | | | | | | | | | | write a new test to exercise the hardlink strategies used by different archive formats (tar, old cpio, new cpio). This uncovered two problems, both fixed by this commit: 1) Enforce file size when writing files to disk. 2) When restoring hardlink entries, if they have data associated, go ahead and open the file so we can write the data. In particular, this fixes bsdtar/bsdcpio extraction of new cpio formats where the "original" is empty and the subsequent "hardlink" entry actually carries the data. It also provides correct behavior for old cpio archives where hardlinked entries have their bodies stored multiple times in the archive; the last body should always be the one that ends up in the final file. The new pax format also permits (but does not require) hardlinks to carry file data; again, the last contents should always win. Note that with any of these, a size of zero on a hardlink simply means that the hardlink carries no data; it does not mean that the file has zero size. A non-zero size on a hardlink does provide the file size. Thanks to: John Baldwin, for reminding me about this long-standing bug and sending me a simple example archive that prompted this test case
* Since the tar bidder can never get called more than once, itkientzle2008-01-131-0/+47
| | | | | | | | | | | | doesn't need to compensate for this situation. While here, fix a minor longstanding bug that empty tar archives (which begin with at least 512 zero bytes) never properly reported their format. In particular, this fixes the output of: bsdtar tvvf /dev/zero And, of course, a new test to verify that libarchive correctly recognizes the format of such files.
* Extensive improvements to the libarchive_test test program thatkientzle2008-01-0129-789/+3321
| | | | | | | | | | | | | | | | | | | | | | exercises and verifies the libarchive APIs: * Improved error reporting; hexdumps are now provided for many file/memory content differences. * Overall status more clearly counts "tests" and "assertions" * Reference files can now be stored on disk instead of having to be compiled into the test program itself. A couple of tests have been converted to this more natural structure. * Several memory leaks corrected so that leaks within libarchive itself can be more easily detected and diagnosed. * New test: GNU tar compatibility * New test: Zip compatibility * New test: Zero-byte writes to a compressed archive entry * New test: archive_entry_strmode() format verification * New test: mtree reader * New test: write/read of large (2G - 1TB) entries to tar archives (thanks to recent performance work, this test only requires a few seconds) * New test: detailed format verification of cpio odc and newc writers * Many minor additions/improvements to existing tests as well.
* Correct the cpio writers to not accept data for non-regular files.kientzle2007-10-121-1/+29
| | | | | | | | | In particular, the previous code led to archives that had non-empty bodies following directory entries. Not a fatal problem, as bsdtar and GNU cpio are both happy to just skip this bogus data, but it still shouldn't be there. MFC after: 3 days
* Fix the archive_write_data() function so it always returnskientzle2007-09-211-1/+76
| | | | | | | | | | | | | number of bytes written, even when used to write files to disk. Extend the test suite to verify the correct return values for archive_write_data() and archive_write_data_block(). Thanks to: Bruce Mah, for stepping in promptly to back out the earlier broken version of this fix Thanks to: Colin Percival, for pointing out the correct fix MFC after: 5 days Approved by: re (ksmith) Pointy hat: \me
* Revert the last commit to libarchive. It introduced some regresssions,bmah2007-09-181-26/+1
| | | | | | | | | | | most noticably the incorrect extraction of files by bsdtar. This commit reverts: src/lib/libarchive/archive_write_disk.c 1.15 src/lib/libarchive/test/test_write_disk.c 1.4 Approved by: re (implicitly)
* Correct the return value from archive_write_data()kientzle2007-09-181-1/+26
| | | | | | | | | | | (when used to restore files to disk) to match: * The documentation * The return values of this function when used to write files into an archive. Approved by: re (bmah) Pointy hat: \me MFC after: 5 days
* This commit updates libarchive to be compatible withkientzle2007-08-181-136/+537
| | | | | | | | | | | | | | | | | | | | | | | | | GNU tar 1.17's implementation of --posix --sparse, at the cost of losing compatibility with GNU tar 1.16. Fortunately, the 1.17 implementation actually makes sense, so the libarchive code is now a bit more straightforward than before. Background: GNU tar 1.16 defined a new way to store sparse files in --posix archives. Unfortunately, the implementation incorrectly inserted several blocks of null padding after each such entry. As a result, non-GNU tar implementations saw the archive as truncated after any sparse entry. This was fixed in GNU tar 1.17 at the cost of losing compatibility with GNU tar 1.16 for this new format (which is not the default, so hopefully rarely used). Libarchive recently gained support for reading the GNU tar 1.16 formats; this commit updates it to read the GNU tar 1.17 variant instead. Approved by: re (ksmith for libarchive portion) Approved by: re (blanket for libarchive_test portion) MFC after: 5 days
* Make suid/sgid restore be "opportunistic" ifkientzle2007-08-121-10/+60
| | | | | | | | | | | | | | | | | | | | | | | | owner restore is not requested. If you ask for permissions to be restored but not owner, you will now get no error if suid/sgid bits cannot be set. (It's a security hole to restore suid/sgid bits if the owner/group aren't restored.) This fixes an obscure problem where a simple "tar -xf" with no other options will sometimes fail gratuitously because of suid/sgid bits. This is causing occasional problems for people using bsdtar as a drop-in replacement for "that other tar program." ;-) Note: If you do ask for owner restore, then suid/sgid restore failures still issue an error. This only suppresses the error in the case where an suid/sgid bit restore fails because of an owner mismatch and owner restore was not requested. Approved by: re (bmah) MFC after: 7 days
* Update the tests for reading the various GNU tar sparse formats.kientzle2007-08-121-75/+267
| | | | | | | | | | | | | | | In particular: * Include a second entry in all of the test archives (to catch errors with intermediate padding) * Test the GNU tar 1.17 version of "posix sparse format 1.0" instead of the GNU tar 1.16 version (the latter is no longer supported by GNU tar). Right now, libarchive fails this test because I originally implemented the GNU tar 1.16 version of "posix sparse format 1.0". I'll fix libarchive shortly. Approved by: re (blanket, libarchive testing)
* Two minor nits:kientzle2007-07-311-0/+7
| | | | | | | | * Allow libarchive_test to compile on Interix again. * Track the test name (not just line number) when counting skipped tests. Thanks to: Joerg Sonnenberger Approved by: re (blanket; libarchive testing)
* Clarify one test.kientzle2007-07-151-1/+1
| | | | Approved by: re (blanket, libarchive testing)
* Use an uncompressed test archive for gtar sparse format 1.0 format,kientzle2007-07-141-20/+6
| | | | | | | as that better exercises some internal read-combining logic than the compressed archive. Approved by: re (blanket, libarchive testing)
* Report each failed test once, but keep a count and report that countkientzle2007-07-143-22/+111
| | | | | | | if there was more than one. In particular, this simplifies test_tar_filenames.c, which has a tendency to be very noisy otherwise. Approved by: re (blanket, libarchive testing)
* Extend the basic tar reading test to exercise most types ofkientzle2007-07-141-49/+388
| | | | | | entries. This doesn't cover everything yet, but it's a big improvement. Approved by: re (blanket, libarchive testing)
* Make the test for reading gtar sparse entries more robust;kientzle2007-07-131-35/+198
| | | | | | | | it now verifies that the returned blocks have the correct data at the correct file offsets, ignoring any null padding that may exist. Approved by: re (blanket, libarchive test suite)
* New test suite test_read_pax_truncated probes libarchivekientzle2007-07-132-0/+282
| | | | | | | behavior with truncated or damaged pax archives. This tests most of the cases covered by the recent security advisory. Approved by: re (blanket, libarchive test suite)
* New file "read_open_memory.c" is a custom variant ofkientzle2007-07-133-1/+153
| | | | | | | | | archive_read_open_memory.c that tries to test border cases. In particular, it copies over each returned block so that formats or decompressors that read past the end of a returned block will break. Approved by: re (blanket, libarchive test suite)
* Fix running individual tests via "libarchive_test <number> <number> ..."kientzle2007-07-131-1/+2
| | | | Approved by: re (blanket)
* Make test suite work with libarchive 1.3.1: Take advantage ofkientzle2007-07-0617-25/+289
| | | | | | | | | | | | | ARCHIVE_VERSION_STAMP to selectively disable tests that don't apply to that version; new "skipping()" function reports skipped tests; modify final summary to report component test failures and skips. Note: I don't currently intend to MFC the test suite itself; anyone interested should just checkout and use this version of the test suite, which should work for any library version. Approved by: re (Ken Smith, blanket)
* Ouch. I partially screwed up the last commit bykientzle2007-06-221-1/+0
| | | | | | | enabling a test that's not ready yet. <sigh> Pointy hat: /me Approved by: re@
* Support for writing the 'newc' cpio format, plus a minimal test harnesskientzle2007-06-222-0/+114
| | | | | | | for the cpio formats. Thanks to: Rudolf Marek Approved by: re@
* Make 'ar' write test a tad more portable.kientzle2007-06-131-3/+3
|
* Read support for the new GNU tar sparse formats added in gtar 1.15 andkientzle2007-06-132-1/+156
| | | | gtar 1.16.
* Add some options to libarchive_test:kientzle2007-06-131-12/+50
| | | | | -k: like make -k, try to keep going after errors. -q: quiet
* Fix a broken function declaration.kientzle2007-06-131-1/+1
|
* Options spring cleanup:sepotvin2007-06-131-1/+0
| | | | | | | | | | - Add and document the KVM and KVM_SUPPORT options that are needed for the ifmcstats(3) makefile - Garbage collect unused variables - Add missing inclusion of bsd.own.mk where needed Approved by: kan (mentor) Reviewed by: ru
* Don't lose leading '/' for pathnames exactly 101 bytes long.kientzle2007-06-111-8/+15
| | | | Also, update the test harness to exercise this case.
* libarchive 2.2.3kientzle2007-05-2927-160/+1076
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * "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.
* Clean up a lot of memory leaks in the libarchive test harness.kientzle2007-04-1512-0/+29
|
* Overhaul of 'ar' support:kientzle2007-04-142-9/+21
| | | | | | | | | | | | | | | | | | | * use "AR_GNU" as the format name instead of AR_SVR4 (it's what everyone is going to call it anyway) * Simplify numeric parsing to unsigned (none of the numeric values should ever be negative); don't run off end of numeric fields. * Finish parsing the common header fields before the next I/O request (which might dump the contents) * Be smarter about format guessing and trimming filenames. * Most of the magic values are only used in one place, so just inline them. * Many more comments. * Be smarter about handling damaged entries; return something reasonable. * Call it a "filename table" instead of a "string table" * Update tests. Enable selection of 'ar', 'arbsd', and 'argnu' formats by name (this allows bsdtar to create ar format archives). The 'ar' writer still needs some work; it should reject entries that aren't regular files and should probably also strip leading paths from filenames.
* Conventionally, tar archives have always included a trailing '/'kientzle2007-04-142-0/+157
| | | | | | | | | | | | | for directories. bsdtar used to add this, but that recently got lost somehow. So now I'm adding it back in libarchive. The only odd part of doing this in libarchive: Adding a directory to a tar archive and then reading it back again can yield a different name. Add a test case to exercise some boundary conditions with tar filenames and ensure that trailing slashes are added to dir names only as necessary. Thanks to: Oliver Lehmann for bringing this regression to my attention.
* Portability: Don't use mkdtemp() when mkdir() will suffice.kientzle2007-04-141-2/+2
| | | | If we can't create the dir, just give up.
* Enable 'ar' support; hook it up to the build andkientzle2007-04-071-1/+3
| | | | enable it with _read_support_format_all().
* 'ar' format support for libarchive, contributed by Kai Wang.kientzle2007-04-032-0/+277
|
* Notice when mkdir() fails.kientzle2007-03-241-1/+56
| | | | | | | | Don't change permissions on an existing dir unless _EXTRACT_PERM is requested. In particular, bsdtar -x should not edit mode of existing dirs now; bsdtar -xp will.
* Libarchive 2.0.23:kientzle2007-03-111-0/+8
| | | | | | | | | | | | * 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.
* New tests for system-independent ACL support.kientzle2007-03-083-0/+744
| | | | | | | | These tests verify that archive_entry objects can store and return ACL data and that pax format archives can read and write ACL information. These do not (yet) test that ACL data is read or written to disk correctly. (And hence would not have caught the recent snafu about ACL read-from-disk being turned off.)
* libarchive 2.0kientzle2007-03-0336-0/+3145
* libarchive_test program exercises many of the core features * Refactored old "read_extract" into new "archive_write_disk", which uses archive_write methods to put entries onto disk. In particular, you can now use archive_write_disk to create objects on disk without having an archive available. * Pushed some security checks from bsdtar down into libarchive, where they can be better optimized. * Rearchitected the logic for creating objects on disk to reduce the number of system calls. Several common cases now use a minimum number of system calls. * Virtualized some internal interfaces to provide a clearer separation of read and write handling and make it simpler to override key methods. * New "empty" format reader. * Corrected return types (this ABI breakage required the "2.0" version bump) * Many bug fixes.
OpenPOWER on IntegriCloud