archive_read_support_filter_lrzip and archive_write_add_filter_lrzip
should return ARCHIVE_WARN instead of ARCHIVE_OK since those filters
always use an external program, lrzip(1) and other filters do so
if they use an external program instead of implemented code with
the library. It is clear that returning ARCHIVE_WARN means the filter
uses an external program.
Apply __attribute__((deprecated)) to archive_read_open_file,
archive_write_open_file, archive_position_compressed,
archive_position_uncompressed, archive_compression_name and
archive_compression.
Revert part of d1be20168 because gunzip is still used in
test_read_filter_program and test_read_filter_program_signature,
which cannot give arguments to the program.
Fix a cause of segmentation fault in case of creating a child
process failed. It occured when archive_write_close() was called
after an opening filter process failed.
Remove unnecessary build condition for a use of
__archive_create_child(). It has worked well on both POSIX
system and non-POSIX system since libarchive 2.7.0.
Fix test_option_older_than failure on linux.
- Use pax format in test_option_older_than and test_option_newer_than
to make sure the nano second of a file time is recorded.
Add --older,--older-than,--older-mtime and --older-mtime-than to bsdtar to
enable only including files and directories older than specified date or file.
Fix a bug that Clang Static Analyzer claimed it is potential insecure
implementation-specific behavior in call 'vfork' and recommended the
use of posix_spawn instead of vfork.
Apply *_CLOEXEC flags to system calls which can be used with
to avoid file descriptor leaks to the child process.
- Pass O_CLOEXEC to open(2) system call if it is defined.
- Use fcntl(2) and F_DUPFD_CLOEXEC instead of dup(2)
if F_DUPFD_CLOEXEC is defined.
- Set FD_CLOEXEC with fcntl(2) if a file descriptor does not have.
Xi Wang [Fri, 28 Sep 2012 07:04:42 +0000 (03:04 -0400)]
Fix signed integer overflow in safe_fprintf()
The following "overflow" check in safe_fprintf() invokes undefined
behavior (signed integer overflow), which is incorrect. Clang will
optimize it away.
int old_length = fmtbuff_length;
fmtbuff_length += fmtbuff_length / 4;
if (old_length > fmtbuff_length) { ... }
The check is in the form:
x > x + x / 4.
As per the C standard, the check is equivalent to:
0 > x / 4,
since x + x / 4 is assumed to not overflow (otherwise undefined).
An earlier check ensures x >= 8192, so this check is always false,
and Clang doesn't emit code for it.
This patch uses unsigned integers to avoid undefined behavior.
Andres Mejia [Sat, 22 Sep 2012 00:23:25 +0000 (20:23 -0400)]
Implement function used to seek within data blocks.
This only implements seeking fully for uncompressed RAR files. Seeking is not
implemented for compressed RAR files and for the other formats (ZIP, TAR, etc.).
Brian Weaver [Wed, 26 Sep 2012 15:45:52 +0000 (11:45 -0400)]
Refactored common code into a single function
The tar_atol8() and tar_atol10() functions were essentially
identical. The code has been refactored to a common function
with tar_atol8() and tar_atol10() calling the commont function
with the radix instead duplicating the code.
The logic was also changed slightly to prevent a pointer
dereference when a zero length character array is passed to
the conversion routine.
Brian Weaver [Tue, 25 Sep 2012 13:51:12 +0000 (09:51 -0400)]
Add tighter checks to avoid reading past end of buffer
The string to base 8/10 conversion routines could read past the
counted end of the buffer if the string is correctly formated.
The number of characters is now checked and decremented for every
character that is consumed for processing.
Minor improvement in the mtree bidder.
- During checking NetBSD mtree -D format, if the first character of
the last filed in an entry line is '/', fail the test bidding mtree
format.
Brian Weaver [Tue, 25 Sep 2012 13:51:12 +0000 (09:51 -0400)]
Add tighter checks to avoid reading past end of buffer
The string to base 8/10 conversion routines could read past the
counted end of the buffer if the string is correctly formated.
The number of characters is now checked and decremented for every
character that is consumed for processing.
Andres Mejia [Wed, 19 Sep 2012 20:42:10 +0000 (16:42 -0400)]
Implement filtering of test cases run using glob pattern matching.
A test case will run if it matches a specified glob pattern. Test cases can
also be filtered out by including a '^' at the beginning of a pattern.
Fix a possibility of memory leaks when realloc fails.
Do not assign the return value of realloc into the variable that has
the original pointer because if realloc failed we will lose the chance
to release the address.
Fix a part of a commit 221f63f2f8.
The double free bug Clang Static Anlyzer(trunk) claimed of was the Clang's bug,
which is currently fixed, and it made a memory leak.
Allan McRae [Sat, 8 Sep 2012 08:59:33 +0000 (18:59 +1000)]
Fix mtree generation
When generating an mtree file, libarchive writes a "Relative" type (entries
that have no /) for files in the base directory. For directories, this causes
the mtree reader to change the parent directory and give subsequent files in
the root directory the wrong path.
Fix this by prefixing entries in the root directory with "./".