On Windows test_fuzz sometimes failed by fopen error that it opened image data.
It seems previous close operation did not completely end at that time.
I think it some security soft was grabbing the file handle for its check
of file access. So we should take a wait for a time while the operation
running.
Tim Kientzle [Sat, 26 Mar 2011 05:53:58 +0000 (01:53 -0400)]
Issue 151: clients and filters are now guaranteed to have their
close() function invoked exactly once in all cases.
In particular, this avoids a leak when read_open_filename()
fails because of format errors.
In Zip writer, set bit 11(stored filename charset is UTF-8) to general
purpose flags when the filename has non ASCII code and writing charset
is UTF-8. it is useful for Zip reader not only for ours that that would
help Zip reader know what a filename encoding is. This is the same behaviour
Info-ZIP does.
We should use mbrtowc/mbtowc at archive_wstring_append_from_mbs instead of
mbsrtowcs/mbstowcs because we cannot check the MBS limit specified by
a caller with a parameter 'len', and it is possible that mbsrtowcs/mbstowcs
convert extra MBS when strlen(MBS) > 'len'.
Update comment about the return code of conversion functions.
archive_string_append_from_unicode_to_mbs always returns -1
if the platform have neither wctomb nor wcrtomb.
Remove UTF-8 <===> WCS conversion code, which was highly based on the wrog
assumption that WCS was UNICODE. What format WCS has is deeply dependent on
platform, and WCS must be converted to/from locale dependent MBS on every
platform through mbstowcs/wcstombs or related functions, which the platforms
provide. We should, thus, respect the platform policy about WCS for potability.
Add an mbs version of ACL control functions in order to reduce
extra character conversion.
previous:
Create : Disk -> MBS -> WCS -> MBS -> UTF-8 -> Pax archive file.
Extract: Pax archive file -> UTF-8 -> MBS -> WCS ->MBS -> Disk.
In ZIP archive file, a filename and comments field is UTF-8 when Language
encoding flag (Bit 11 of the general purpose bit flag) is set.
So we should convert filenames from UTF-8 to current locale.
Improve character-set conversion functions on the platform which does not have
iconv.
Even if current locale and specified locale are the same, we should
whether the MBS has all correct bytes, in order to simulate iconv's behavior.
Instead of canConvertCharset(), use archive_read_set_options("charset=xxxx")
to check what a conversion of character-set is supported.
It is better only libarchive knows if a character-set conversion works,
but at this time a use of canConvertCharset() still remains in
test_pax_filename_encoding.
Tim Kientzle [Mon, 21 Mar 2011 00:41:14 +0000 (20:41 -0400)]
Test from Roman Neuhauser for the "raw" format to verify that it
correctly handles read_next_header and read_data_skip. Fix the bug
this uncovers (a second header request should return EOF but didn't).
Add support for charset option to lha format reader.
Automatically convert filenames in a lha archive if a well-known codepage
is specified in its header, but it will not overwrite a character-set
specified by the charset option.
Issue 144: Improve the operation of use-set option of an mtree writer.
Correctly tabulate uid,gid,mode and fflags of files in a directory and
use the most used value of those file attributes for /set keyword while
use-set option specified.
Tim Kientzle [Fri, 18 Mar 2011 05:49:40 +0000 (01:49 -0400)]
From Roman Neuhauser: Rework textual options handling.
* New functions archive_{read,write}_set_{format,filter}_option accept
three strings: module name, option name, value.
This is a better match for C clients of the library, who want
to set one option at a time anyway for better error handling.
* archive_{read,write}_set_options still accept a single string
with possibly multiple options, but are now much simpler internally
because they build on the above.
* New tests for all of the above.
* Update a lot of tests to give good coverage of the new functions.
Do not pass 0 to third parameter of ReadFile(), which parameter specify read bytes,
because ReadFile() will not return if the parameter is 0;
test_archive_read_close_twice_open_filename did not end.
Improve UTF-16BE conversion functions.
- rename archive_string_copy_from_utf16be to archive_strncpy_from_utf16be.
- rename archive_string_copy_to_utf16be to archive_strncpy_to_utf16be and
change its argument from struct archive_string * to a set of const char *
and size_t.
Use ICONV_CONST instead of ICONV_IS_POSIX; switch a detection of iconv to AM_ICONV.
This version needs to solve about config.rpath, which AM_ICONV requires.
Tim Kientzle [Sun, 13 Mar 2011 07:43:36 +0000 (03:43 -0400)]
Fix the handling of multiple Fl options:
.Fl Fl command
used to cause -Fl command but now it generates --command.
In the process, bolding of certain command options is
lost; the logic here needs to be significantly reworked.
Tim Kientzle [Sun, 13 Mar 2011 05:36:55 +0000 (00:36 -0500)]
Issue 141: Detect an unrecognized format earlier, in archive_read_open,
instead of waiting until we try to read the first header.
This just required moving the format detection into archive_read_open.
This in turn required updating a some tests that inadvertently
relied on the old behavior.
While poking around in the truncation tests, I went ahead and
updated them to not use the old "assertA" macro, which is
deprecated.
Tim Kientzle [Sat, 12 Mar 2011 08:26:09 +0000 (03:26 -0500)]
Move the -Werror -Wall switches to the top and set them for try-compiles
as well.
Before this, there were problems with iconv(), which has variants on different
systems that differ only in const usage; the try-compiles would
pass with the wrong const usage and cause the build to fail.
Setting -Werror on the try-compiles ensures that this doesn't happen.
Björn Jacke [Fri, 18 Feb 2011 02:08:33 +0000 (21:08 -0500)]
DO NOT USE C++ style comments like // in C code !
Not all C compilers are happy with them, lxc on AIX for example.
There are much more of them in the testing code but the ones
fixed with this commit make at least the most important things compile.
Björn Jacke [Wed, 16 Feb 2011 19:26:46 +0000 (14:26 -0500)]
on Tru64 use the F_SETTIMES fcntl to restore timestamps.
The advantage is that we will even be able to restore ctimes with that.
We need to run as root however to be able to do that.