When ENOMEM happened in archive_string_append_from_wcs and archive_string_append_from_mbs,
those function should report the error to the caller instead of invoking __archive_errx().
We should report that ENOMEM error as possible as we can and we still need to further
improve reporting ENOEM.
Tim Kientzle [Mon, 23 Jan 2012 03:21:30 +0000 (22:21 -0500)]
Issue 225: Misreading directories in MSDOS Zip files.
These files don't put a POSIX "mode" value in the "external
attributes" field. We used to always assume a regular file if we
didn't see that.
Now, the code leaves the mode set to zero in that case. When we read
the local file header, the fallback heuristics will kick in and
examine the filename to determine whether this is a directory
or a regular file.
Issue 224:Mishandling CD9660 images with RockRidge extensions from FreeBSD makefs.
A file size of the symblic link file in ISO images made by makefs is not zero and
its location is not negative. That makes ISO reader misleading that that file is
a hard like file.
We have to check if the file type is symbolic like or not, if so and its file size
is not zero, reset the file size to zero and also reset the location to -1.
Delete archive_matching_path_excluded and archive_matching_path_excluded_w.
They were not so helpful than I though at archive_read_disk.
Rename archive_matching_path_excluded_ae to archive_matching_path_excluded.
Rename archive_matching_time_excluded_ae to archive_matching_time_excluded.
Rename archive_matching_owner_excluded_ae to archive_matching_owner_excluded.
Rename archive_matching_excluded_ae to archive_matching_excluded.
Cast away archive_read_disk_set_name_filter_callback and add archive_read_disk_set_matching instead
to effectively call archive_matching_*_excluded_ae function in archive_read_disk.
Use archive_matching API at both bsdcpio and bsdtar instead of lafe_exclude functions.
- Remove libarchive_fe/matching.[ch], which are no longer needed.
- Move cpio/test/test_pathmatch.c into libarchive/test/test_archive_pathmatch.c.
Introduce archive_matching APIs. This is a set of utility functions to
find matched archive_entry objects. This is based on libarchive_fe/matching.[ch]
I added serveral interfaces for wchar_t, and matching file stamps and owners.
I also plan to use that at archive_read_disk instead of
archive_read_disk_set_name_filter_callback function, which I recently added.
Tim Kientzle [Thu, 12 Jan 2012 06:20:17 +0000 (01:20 -0500)]
Remove the unused system types from the public headers. We stripped
out almost all of the system-specific ino_t, uid_t, gid_t, etc, types
from the libarchive public API, so these definitions are no longer
needed.
In practice, those types are broken on enough systems that it just
wasn't worth trying to use them.
Brad King [Wed, 11 Jan 2012 13:15:53 +0000 (08:15 -0500)]
Define _XOPEN_SOURCE=500 on HP-UX
The HP-UX <wchar.h> header provides 'mbstate_t' in C89/C90 mode only if
_XOPEN_SOURCE is defined to exactly 500. Type 'mbstate_t' was
introduced in C89/C90 Normative Amendment 1, aka C94/C95, adding support
international character sets. It is part of C99 but not C89/C90.
Brad King [Wed, 11 Jan 2012 13:15:42 +0000 (08:15 -0500)]
Check for 'struct statvfs' member 'f_iosize'
Configure the result as definition HAVE_STRUCT_STATVFS_F_IOSIZE and use
the member only if it exists. At least one platform (IRIX) provides
struct statvfs without this member.
Brad King [Wed, 11 Jan 2012 13:15:25 +0000 (08:15 -0500)]
Fix Windows NT API usage in VS 6
VS 6 warns verbosely when WINVER >= 0x0500. Avoid defining WINVER and
_WIN32_WINNT to higher than 0x0400 on VS 6. Provide missing API
declarations in archive_windows.h when we do not get them from
<windows.h>. Provide GetVolumePathNameW because VS 6 does not declare
it regardless of the API version.
Brad King [Wed, 11 Jan 2012 13:15:20 +0000 (08:15 -0500)]
Cast mode constants to mode_t in case it is signed
At least one compiler (Borland) defines mode_t as just "short" which is
signed. This breaks code like
switch(archive_entry_filetype(e)) {
case AE_IFREG:
...
}
if AE_IFREG and other constants have a longer signed type (int) because
sign extension of the mode_t return type from archive_entry_filetype
changes its value. Avoid the problem by ensuring the type of the
constants matches mode_t.
Brad King [Wed, 11 Jan 2012 13:15:09 +0000 (08:15 -0500)]
Declare mbstate_t and wcrtomb for Borland
The Borland C++ 5.81 runtime library provides wcrtomb but only the C++
header <cwchar> actually declares the API. Since this is C code we
cannot use the header, so declare it ourselves.
Brad King [Wed, 11 Jan 2012 13:15:03 +0000 (08:15 -0500)]
Implement custom lseek for Borland
Restore Windows 64-bit lseek removed by upstream svn revision 3826
(Cast away __la_lseek(), use _lseeki64() instead, 2011-11-21). We
need it on Borland.
Introduce archive_read_disk_disable_mac_copyfile() to eliminate the mac
specific code handling of a resource fork file whose filename has "._" prefix
from bsdtar.
Switch directory traversals code in bsdtar from tar/tree.[ch] to the new one in libarchive library.
This can fix issue 211. This reduce platform specific code in bsdtar, especially a check of
nodump flag, and, of course, a use of Windows APIs.
In the directory traversals on Windows, a unit size of reading data should be a sector size to be able
to use FILE_FLAG_NO_BUFFERING such as POSIX O_DIRECT flag for improving reading performance.