summaryrefslogtreecommitdiffstats
path: root/usr.bin/tar
Commit message (Collapse)AuthorAgeFilesLines
* Fix multiple -s options.kientzle2009-02-081-1/+1
| | | | MFC after: 7 days
* When copying file data to the archive, don't write morekientzle2009-02-081-1/+1
| | | | | | | | | than was read. This seems to have only affected the shar writer, since other formats proactively truncate output to the originally-advertised size. PR: bin/131244 MFC after: 7 days
* Spell "substitution" correctly.kientzle2008-12-151-3/+3
| | | | | | | PR: bin/128616 Submitted by: Jaakko Heinonen Pointy hat: Tim Kientzle MFC after: 30 days
* bsdtar is synced up with 2.5.903akientzle2008-12-061-1/+1
|
* bsdtar always supports long options now, so we can removekientzle2008-12-061-2/+2
| | | | a documentation disclaimer.
* Only use GCC-specific __dead2 marker when building with GCC.kientzle2008-12-062-1/+11
|
* When deciding which characters (of a filename, for instance)kientzle2008-11-292-49/+119
| | | | | | | | | | | | 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
* After visiting a subdirectory, we use chdir("..") orkientzle2008-11-273-19/+57
| | | | | | | | | | fchdir() to return back to the parent. If those fail, we're just dead in the water. Add a new error value TREE_ERROR_FATAL to indicate that directory traversal cannot continue. Have write.c honor that by exiting immediately. MFC after: 30 days
* If we're unable to chdir() to a directory that we know exists,kientzle2008-11-271-1/+3
| | | | | | | | | | that should result in a non-zero return value. In particular, this should address the issue that David Wolfskill ran into with a somewhat flaky NFS mount resulting in a damaged archive even though tar returned success. MFC after: 4 days
* Include more detailed explanation of this case, since it's prettykientzle2008-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
* Test --strip-components and fix it to actually work. Jaakko did akientzle2008-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
* New command-line parser for bsdtar.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
* When comparing, cast to the larger size, off_t in this case.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
* Fix compile warnings building on amd64. This is modified slightlykientzle2008-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
* Clean up flags support just a tad: FreeBSD support depends onkientzle2008-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.
* Test handling of restores relative to symlinks.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
* Minor cleanup of the -q test: Assert that stdout/stderr are empty for eachkientzle2008-08-221-3/+9
| | | | extraction.
* Don't clean before running tests.kientzle2008-08-221-1/+1
|
* Explain how the test_option_q test works.kientzle2008-08-221-0/+15
|
* Test for -q (aka --fast-read).kientzle2008-08-223-1/+106
| | | | Fix the error uncovered by this test.
* The results for test 2 here are short enough to just be included inline.kientzle2008-08-212-8/+3
| | | | | There's no need to go through the hassle of having a checked-in uuencoded reference file for comparison.
* Add some more tests to verify that "./foo" matches "foo" but "/foo" does not.kientzle2008-08-214-1/+76
|
* Always display the unedited pathname in -t output.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.
* Better comment the pattern tests; adjust the filenames for thekientzle2008-08-204-12/+22
| | | | | | reference files to match the corresponding source. MFC after: 3 days
* Fix SVN r181821 by not using FNM_LEADING_DIR wherekientzle2008-08-181-1/+1
| | | | it shouldn't be used.
* Strip leading "./" or ".//" from patterns and filenameskientzle2008-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
* Don't strip a leading '/' from a pattern to be matched.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
* Test updates: Handling of patterns on command line, error messages.kientzle2008-08-156-1/+40
|
* Mark functions as __dead2 in order to help the LLVM static checkercperciva2008-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".
* - Fix mtree example so it works.simon2008-07-261-0/+7
| | | | | | | - Document --version. Reviewed by: kientzle MFC after: 1 week
* Move duplicated code from tar_mode_[cru] into archive_write.cperciva2008-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.
* Use malloc in write_archive to allocate a 64kB buffer for holding file datacperciva2008-07-052-12/+21
| | | | instead of using 64kB of stack space in copy_file_data and write_file_data.
* Clean up write_entry by eliminating fd except in the #ifdef __linux blockcperciva2008-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]
* Revert CVS revision 1.68; it is now possible for entry to be NULL at the endcperciva2008-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.)
* FreeBSD-CURRENT bsdtar is synched up with libarchive-portable 2.5.5.kientzle2008-07-051-1/+1
|
* Remove HAVE_STRUCT_STAT_ST_RDEV, as it's not used anywhere.kientzle2008-07-051-1/+0
|
* Stop using the deprecated linux/ext2_fs.h.kientzle2008-07-051-3/+0
|
* Use %H:%M for strftime() time formatting instead of the non-portable %R.kientzle2008-07-051-1/+1
|
* Pass the entry down into the core write loop, so wekientzle2008-06-251-4/+6
| | | | | | can include the filename when reporting errors. Thanks to: Dan Nelson
* MfP4: Minor portability fix.kientzle2008-06-151-1/+9
|
* MfP4: test harness cleanup.kientzle2008-06-152-19/+21
|
* Make one-bit fields unsigned instead of signed. This has no effect,cperciva2008-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
* Rework code to avoid using a pointer after freeing it. Aside from thecperciva2008-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
* Compatibility fix: define REG_BASIC if it isn't already. In particular,kientzle2008-05-271-0/+4
| | | | | | | glibc has a suitable regex implementation, but doesn't define this constant. Thanks to: Diego "Flameeyes" Pettenò
* MFp4: bsdtar 2.5.4bkientzle2008-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.
* The value le->name cannot be NULL when we're freeing an entry in thecperciva2008-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
* Improve portability via s/struct siginfo/struct siginfo_data/. This wascperciva2008-05-222-3/+3
| | | | running into a namespace collision on an avian operating system.
* Detect if argv[1] is "" and avoid calling malloc(0). Prior to this commit,cperciva2008-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).
* There's no way for entry to possibly be NULL at the end of write_entrycperciva2008-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
* Add SIGINFO (and for portability to SIGINFO-lacking systems, SIGUSR1)cperciva2008-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
OpenPOWER on IntegriCloud