aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/tar
Commit message (Collapse)AuthorAgeFilesLines
* Include more detailed explanation of this case, since it's prettyTim Kientzle2008-11-101-5/+34
| | | | | | | | | | | | | | | | | | subtle why it comes out the way it does. Once you realize that it depends on the archiving order, it's also important to realize that filesystem differences aren't going to break this case. (Some of the other tests have had to be extensively rewritten to make them independent of the order in which a particular filesystem returns file entries.) (This commit also serves to note the PR number that I accidentally omitted from the previous commit.) PR: bin/128562 MFC after: 30 days Notes: svn path=/head/; revision=184808
* Test --strip-components and fix it to actually work. Jaakko did aTim Kientzle2008-11-103-16/+116
| | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=184807
* New command-line parser for bsdtar.Tim Kientzle2008-11-086-356/+455
| | | | | | | | | | | | | This replaces the getopt()/getopt_long() wrapper, the old-style argument rewriter and the associated configuration glue with a more straightforward custom command parser. In particular, this ensures that bsdtar will have consistent option parsing on every platform, regardless of whether the platform supports getopt_long(). MFC after: 30 days Notes: svn path=/head/; revision=184761
* When comparing, cast to the larger size, off_t in this case.Tim Kientzle2008-11-051-1/+1
| | | | | | | | | | Once we know which one is smaller, then we cast to the smaller size. Thanks to Xin Li (delphij@) Pointy hat: /me Notes: svn path=/head/; revision=184669
* Fix compile warnings building on amd64. This is modified slightlyTim Kientzle2008-11-051-4/+5
| | | | | | | | | | | | | from Jaakko's original patch: I have misgivings about the portability of the 'z' printf modifier so opted to cast the arguments to (int) instead. PR: bin/128561 Submitted by: Jaakko Heinonen MFC after: 30 days Notes: svn path=/head/; revision=184668
* Clean up flags support just a tad: FreeBSD support depends onTim Kientzle2008-09-142-28/+30
| | | | | | | | | | HAVE_STRUCT_STAT_ST_FLAGS, Linux support depends on the existence of the appropriate ioctl() options. In particular, this should fix some nagging compile errors on Linux platforms that don't have e2fsprogs-devel installed. Notes: svn path=/head/; revision=183010
* Test handling of restores relative to symlinks.Tim Kientzle2008-09-142-0/+173
| | | | | | | | | | In particular: * tar -x -P follows symlinks to existing dirs, but not without -P * symlinks to files are always replaced * broken symlinks are always replaced Notes: svn path=/head/; revision=183009
* Minor cleanup of the -q test: Assert that stdout/stderr are empty for eachTim Kientzle2008-08-221-3/+9
| | | | | | | extraction. Notes: svn path=/head/; revision=181985
* Don't clean before running tests.Tim Kientzle2008-08-221-1/+1
| | | | Notes: svn path=/head/; revision=181984
* Explain how the test_option_q test works.Tim Kientzle2008-08-221-0/+15
| | | | Notes: svn path=/head/; revision=181981
* Test for -q (aka --fast-read).Tim Kientzle2008-08-223-1/+106
| | | | | | | Fix the error uncovered by this test. Notes: svn path=/head/; revision=181979
* The results for test 2 here are short enough to just be included inline.Tim Kientzle2008-08-212-8/+3
| | | | | | | | There's no need to go through the hassle of having a checked-in uuencoded reference file for comparison. Notes: svn path=/head/; revision=181971
* Add some more tests to verify that "./foo" matches "foo" but "/foo" does not.Tim Kientzle2008-08-214-1/+76
| | | | Notes: svn path=/head/; revision=181959
* Always display the unedited pathname in -t output.Tim Kientzle2008-08-214-21/+12
| | | | | | | | | | I would like to provide a way to preview the effects of pathname edits, but pattern selection has to happen against the unedited path, so it seems that we have to show people the unedited path to help in designing selection patterns. Notes: svn path=/head/; revision=181958
* Better comment the pattern tests; adjust the filenames for theTim Kientzle2008-08-204-12/+22
| | | | | | | | | reference files to match the corresponding source. MFC after: 3 days Notes: svn path=/head/; revision=181904
* Fix SVN r181821 by not using FNM_LEADING_DIR whereTim Kientzle2008-08-181-1/+1
| | | | | | | it shouldn't be used. Notes: svn path=/head/; revision=181845
* Strip leading "./" or ".//" from patterns and filenamesTim Kientzle2008-08-181-3/+39
| | | | | | | | | | | | so that "./foo" matches "foo" (and vice versa). This is related to PR bin/119141. PR: bin/119141 MFC after: 4 days Notes: svn path=/head/; revision=181821
* Don't strip a leading '/' from a pattern to be matched.Tim Kientzle2008-08-171-2/+0
| | | | | | | | | | | This aligns the pattern-matching behavior with GNU tar and restores the behavior of bsdtar prior to FreeBSD 6.3. PR: bin/117909 MFC after: 3 days Notes: svn path=/head/; revision=181801
* Test updates: Handling of patterns on command line, error messages.Tim Kientzle2008-08-156-1/+40
| | | | Notes: svn path=/head/; revision=181750
* Mark functions as __dead2 in order to help the LLVM static checkerColin Percival2008-08-041-1/+1
| | | | | | | | | | understand which code paths aren't possible. This commit eliminates 117 false positive bug reports of the form "allocate memory; error out if pointer is NULL; use pointer". Notes: svn path=/head/; revision=181269
* - Fix mtree example so it works.Simon L. B. Nielsen2008-07-261-0/+7
| | | | | | | | | | - Document --version. Reviewed by: kientzle MFC after: 1 week Notes: svn path=/head/; revision=180827
* Move duplicated code from tar_mode_[cru] into archive_write.Colin Percival2008-07-051-32/+15
| | | | | | | | Fix a bug I introduced 7 minutes ago: clean up properly from archive_write if we exit the argv-handling loop due to -C not having an argument. Notes: svn path=/head/; revision=180284
* Use malloc in write_archive to allocate a 64kB buffer for holding file dataColin Percival2008-07-052-12/+21
| | | | | | | instead of using 64kB of stack space in copy_file_data and write_file_data. Notes: svn path=/head/; revision=180283
* Clean up write_entry by eliminating fd except in the #ifdef __linux blockColin Percival2008-07-051-13/+14
| | | | | | | | | | | | where it is used. [1] Don't leak file descriptors in write_entry_backend if archive_write_header returns ARCHIVE_FAILED. Found by: Coverity Prevent [1] Notes: svn path=/head/; revision=180281
* Revert CVS revision 1.68; it is now possible for entry to be NULL at the endColin Percival2008-07-051-1/+2
| | | | | | | | of write_entry. (This was perfectly safe, since archive_entry_free(NULL) is a no-op, but adding the check back makes the style more consistent.) Notes: svn path=/head/; revision=180277
* FreeBSD-CURRENT bsdtar is synched up with libarchive-portable 2.5.5.Tim Kientzle2008-07-051-1/+1
| | | | Notes: svn path=/head/; revision=180276
* Remove HAVE_STRUCT_STAT_ST_RDEV, as it's not used anywhere.Tim Kientzle2008-07-051-1/+0
| | | | Notes: svn path=/head/; revision=180275
* Stop using the deprecated linux/ext2_fs.h.Tim Kientzle2008-07-051-3/+0
| | | | Notes: svn path=/head/; revision=180274
* Use %H:%M for strftime() time formatting instead of the non-portable %R.Tim Kientzle2008-07-051-1/+1
| | | | Notes: svn path=/head/; revision=180273
* Pass the entry down into the core write loop, so weTim Kientzle2008-06-251-4/+6
| | | | | | | | | can include the filename when reporting errors. Thanks to: Dan Nelson Notes: svn path=/head/; revision=179988
* MfP4: Minor portability fix.Tim Kientzle2008-06-151-1/+9
| | | | Notes: svn path=/head/; revision=179796
* MfP4: test harness cleanup.Tim Kientzle2008-06-152-19/+21
| | | | Notes: svn path=/head/; revision=179795
* Make one-bit fields unsigned instead of signed. This has no effect,Colin Percival2008-06-091-1/+1
| | | | | | | | | | since they are only tested for zero/nonzero; but it's arguably a bad idea to set a {-1, 0} variable to 1 (as happens in this code). Found by: Coverity Prevent Notes: svn path=/head/; revision=179678
* Rework code to avoid using a pointer after freeing it. Aside from theColin Percival2008-06-091-2/+4
| | | | | | | | | | possibility of memory becoming undereferenceable when it is freed, this change should have no effect on bsdtar behaviour. Found by: Coverity Prevent Notes: svn path=/head/; revision=179677
* Compatibility fix: define REG_BASIC if it isn't already. In particular,Tim Kientzle2008-05-271-0/+4
| | | | | | | | | | glibc has a suitable regex implementation, but doesn't define this constant. Thanks to: Diego "Flameeyes" Pettenò Notes: svn path=/head/; revision=179350
* MFp4: bsdtar 2.5.4bTim Kientzle2008-05-2614-316/+695
| | | | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=179322
* The value le->name cannot be NULL when we're freeing an entry in theColin Percival2008-05-231-2/+1
| | | | | | | | | | | | | | | | hardlink table for two reasons: 1. If le->name is set to NULL, the structure le won't be inserted into the table; 2. Even if le somehow did manage to get into the table with le->name equal to NULL, we would die when we dereferenced le->null before we could get to the point of freeing the entry. Remove the unnecessary "if (le->name != NULL)" test and just free the pointer. Found by: Coverity Prevent Notes: svn path=/head/; revision=179236
* Improve portability via s/struct siginfo/struct siginfo_data/. This wasColin Percival2008-05-222-3/+3
| | | | | | | running into a namespace collision on an avian operating system. Notes: svn path=/head/; revision=179213
* Detect if argv[1] is "" and avoid calling malloc(0). Prior to this commit,Colin Percival2008-05-191-2/+2
| | | | | | | | | running 'tar ""' would print 'No memory' instead of the correct error message, 'Must specify one of -c, -r, -t, -u, -x' if malloc is set to System V mode (malloc(0) == NULL). Notes: svn path=/head/; revision=179131
* There's no way for entry to possibly be NULL at the end of write_entryColin Percival2008-05-191-2/+1
| | | | | | | | | | | (in fact, there has never been any way for it to be NULL, going all the way back to revision 1.1 of this file), so remove the check and unconditionally free entry. Found by: Coverity Prevent Notes: svn path=/head/; revision=179126
* Add SIGINFO (and for portability to SIGINFO-lacking systems, SIGUSR1)Colin Percival2008-05-185-1/+205
| | | | | | | | | | | | | | handling to bsdtar. When writing archives (including copying via the @archive directive) a line is output to stderr indicating what is being done (adding or copying), the path, and how far through the file we are; extracting currently does not report progress within each file, but this is likely to happen eventually. Discussed with: kientzle Obtained from: tarsnap Notes: svn path=/head/; revision=179083
* Add --keep-newer-files option (as in GNU tar: When in -x mode, ignoreColin Percival2008-05-172-0/+9
| | | | | | | | | | | | | | files if the existing file is newer than the archive entry). Currently if any files are ignored, bsdtar will exit with a non-zero exit status; this is likely to change in the future, but requires some API changes in libarchive. Discussed with: kientzle Obtained from: tarsnap Notes: svn path=/head/; revision=179072
* Documentation updates:Tim Kientzle2008-05-022-3/+9
| | | | | | | | | * --format can be used with -r or -u * -o is a synonym for --format=ustar when used with -c, -r, or -u Also, fix the erroneous sanity check that suppressed --format with -r or -u. Notes: svn path=/head/; revision=178717
* bsdtar --version should succeed.Tim Kientzle2008-05-021-1/+1
| | | | Notes: svn path=/head/; revision=178716
* New bsdtar test harness. Still rather skimpy, but a lot easierTim Kientzle2008-05-0211-0/+2203
| | | | | | | to run and maintain than the old scripts that used to be here. Notes: svn path=/head/; revision=178715
* Allow -r with -T even if there are no files on the command line.Tim Kientzle2008-05-021-1/+1
| | | | | | | | PR: bin/123246 MFC after: 3 days Notes: svn path=/head/; revision=178714
* Fix --fast-read by decrementing the remaining patterns to be matched,Tim Kientzle2008-03-182-2/+2
| | | | | | | | | | | instead of incrementing. Pointy hat: me Thanks to: Tomasz Przygoda MFC after: 3 days Notes: svn path=/head/; revision=177341
* style(9) fix to add whitespace around an '=' sign and restoreTim Kientzle2008-03-151-1/+2
| | | | | | | a comment that got accidentally dropped. Notes: svn path=/head/; revision=177214
* Support NetBSD's --insecure as a synonym for -P.Tim Kientzle2008-03-151-0/+1
| | | | Notes: svn path=/head/; revision=177211
* Document --chroot.Tim Kientzle2008-03-151-0/+6
| | | | Notes: svn path=/head/; revision=177210