summaryrefslogtreecommitdiff
path: root/archivers/libarchive/files/libarchive
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/libarchive/files/libarchive')
-rw-r--r--archivers/libarchive/files/libarchive/archive.h.in2
-rw-r--r--archivers/libarchive/files/libarchive/archive_endian.h142
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.c37
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.h152
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_link_resolver.c330
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_private.h2
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_strmode.c8
-rw-r--r--archivers/libarchive/files/libarchive/archive_platform.h7
-rw-r--r--archivers/libarchive/files/libarchive/archive_read.c13
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_extract.c12
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_open_filename.c8
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_private.h5
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c4
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c4
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_none.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_all.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_ar.c8
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c13
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c27
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c12
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_tar.c536
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_zip.c258
-rw-r--r--archivers/libarchive/files/libarchive/archive_util.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk.c127
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_open_filename.c8
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c10
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c29
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_none.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_ar.c22
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c2
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c10
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_pax.c197
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c2
-rw-r--r--archivers/libarchive/files/libarchive/config_freebsd.h9
-rw-r--r--archivers/libarchive/files/libarchive/config_windows.h678
-rw-r--r--archivers/libarchive/files/libarchive/cpio.52
-rw-r--r--archivers/libarchive/files/libarchive/filter_fork.c2
-rw-r--r--archivers/libarchive/files/libarchive/libarchive-formats.52
-rw-r--r--archivers/libarchive/files/libarchive/libarchive_internals.32
-rw-r--r--archivers/libarchive/files/libarchive/test/list.h7
-rw-r--r--archivers/libarchive/files/libarchive/test/main.c191
-rw-r--r--archivers/libarchive/files/libarchive/test/read_open_memory.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test.h23
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_gtar.c110
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_gtar_1.tgz.uu9
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c104
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu39
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_zip.c69
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu14
-rw-r--r--archivers/libarchive/files/libarchive/test/test_empty_write.c118
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry.c35
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry_strmode.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_link_resolver.c222
-rw-r--r--archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c132
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c644
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu26
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu26
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu29
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu27
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu27
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu1369
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_mtree.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tar.c49
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_zip.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_filenames.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_large.c12
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk.c25
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c165
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk_perms.c35
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio.c2
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c47
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c2
75 files changed, 4783 insertions, 1481 deletions
diff --git a/archivers/libarchive/files/libarchive/archive.h.in b/archivers/libarchive/files/libarchive/archive.h.in
index e21a7105e7c..d76c85e51bd 100644
--- a/archivers/libarchive/files/libarchive/archive.h.in
+++ b/archivers/libarchive/files/libarchive/archive.h.in
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.46 2007/07/06 15:36:37 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.47 2007/12/30 04:58:21 kientzle Exp $
*/
#ifndef ARCHIVE_H_INCLUDED
diff --git a/archivers/libarchive/files/libarchive/archive_endian.h b/archivers/libarchive/files/libarchive/archive_endian.h
new file mode 100644
index 00000000000..259f5de91ea
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_endian.h
@@ -0,0 +1,142 @@
+/*-
+ * Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD: src/lib/libarchive/archive_endian.h,v 1.2 2008/02/26 07:17:47 kientzle Exp $
+ *
+ * Borrowed from FreeBSD's <sys/endian.h>
+ */
+
+#ifndef ARCHIVE_ENDIAN_H_INCLUDED
+#define ARCHIVE_ENDIAN_H_INCLUDED
+
+/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
+
+static inline uint16_t
+archive_be16dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[0] << 8) | p[1]);
+}
+
+static inline uint32_t
+archive_be32dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+static inline uint64_t
+archive_be64dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return (((uint64_t)archive_be32dec(p) << 32) | archive_be32dec(p + 4));
+}
+
+static inline uint16_t
+archive_le16dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[1] << 8) | p[0]);
+}
+
+static inline uint32_t
+archive_le32dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
+}
+
+static inline uint64_t
+archive_le64dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return (((uint64_t)archive_le32dec(p + 4) << 32) | archive_le32dec(p));
+}
+
+static inline void
+archive_be16enc(void *pp, uint16_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = (u >> 8) & 0xff;
+ p[1] = u & 0xff;
+}
+
+static inline void
+archive_be32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = (u >> 24) & 0xff;
+ p[1] = (u >> 16) & 0xff;
+ p[2] = (u >> 8) & 0xff;
+ p[3] = u & 0xff;
+}
+
+static inline void
+archive_be64enc(void *pp, uint64_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ archive_be32enc(p, u >> 32);
+ archive_be32enc(p + 4, u & 0xffffffff);
+}
+
+static inline void
+archive_le16enc(void *pp, uint16_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+}
+
+static inline void
+archive_le32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+ p[2] = (u >> 16) & 0xff;
+ p[3] = (u >> 24) & 0xff;
+}
+
+static inline void
+archive_le64enc(void *pp, uint64_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ archive_le32enc(p, u & 0xffffffff);
+ archive_le32enc(p + 4, u >> 32);
+}
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_entry.c b/archivers/libarchive/files/libarchive/archive_entry.c
index 5c78c92f111..a6c9b4496c1 100644
--- a/archivers/libarchive/files/libarchive/archive_entry.c
+++ b/archivers/libarchive/files/libarchive/archive_entry.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.44 2007/07/15 19:10:34 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry.c,v 1.45 2007/12/30 04:58:21 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -207,6 +207,8 @@ aes_get_mbs(struct aes *aes)
static const wchar_t *
aes_get_wcs(struct aes *aes)
{
+ int r;
+
if (aes->aes_wcs == NULL && aes->aes_mbs == NULL)
return NULL;
if (aes->aes_wcs == NULL && aes->aes_mbs != NULL) {
@@ -221,8 +223,13 @@ aes_get_wcs(struct aes *aes)
aes->aes_wcs = aes->aes_wcs_alloc;
if (aes->aes_wcs == NULL)
__archive_errx(1, "No memory for aes_get_wcs()");
- mbstowcs(aes->aes_wcs_alloc, aes->aes_mbs, wcs_length);
+ r = mbstowcs(aes->aes_wcs_alloc, aes->aes_mbs, wcs_length);
aes->aes_wcs_alloc[wcs_length] = 0;
+ if (r == -1) {
+ /* Conversion failed, don't lie to our clients. */
+ free(aes->aes_wcs_alloc);
+ aes->aes_wcs = aes->aes_wcs_alloc = NULL;
+ }
}
return (aes->aes_wcs);
}
@@ -307,6 +314,8 @@ aes_copy_wcs_len(struct aes *aes, const wchar_t *wcs, size_t len)
struct archive_entry *
archive_entry_clear(struct archive_entry *entry)
{
+ if (entry == NULL)
+ return (NULL);
aes_clean(&entry->ae_fflags_text);
aes_clean(&entry->ae_gname);
aes_clean(&entry->ae_hardlink);
@@ -752,6 +761,28 @@ archive_entry_set_link(struct archive_entry *entry, const char *target)
aes_set_mbs(&entry->ae_hardlink, target);
}
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_copy_link(struct archive_entry *entry, const char *target)
+{
+ if (entry->ae_symlink.aes_mbs != NULL ||
+ entry->ae_symlink.aes_wcs != NULL)
+ aes_copy_mbs(&entry->ae_symlink, target);
+ else
+ aes_copy_mbs(&entry->ae_hardlink, target);
+}
+
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target)
+{
+ if (entry->ae_symlink.aes_mbs != NULL ||
+ entry->ae_symlink.aes_wcs != NULL)
+ aes_copy_wcs(&entry->ae_symlink, target);
+ else
+ aes_copy_wcs(&entry->ae_hardlink, target);
+}
+
void
archive_entry_set_mode(struct archive_entry *entry, mode_t m)
{
@@ -1143,7 +1174,7 @@ const wchar_t *
archive_entry_acl_text_w(struct archive_entry *entry, int flags)
{
int count;
- int length;
+ size_t length;
const wchar_t *wname;
const wchar_t *prefix;
wchar_t separator;
diff --git a/archivers/libarchive/files/libarchive/archive_entry.h b/archivers/libarchive/files/libarchive/archive_entry.h
index 33c5649a9f1..cebd55ba8ae 100644
--- a/archivers/libarchive/files/libarchive/archive_entry.h
+++ b/archivers/libarchive/files/libarchive/archive_entry.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.23 2007/07/15 19:10:34 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_entry.h,v 1.24 2007/12/30 04:58:21 kientzle Exp $
*/
#ifndef ARCHIVE_ENTRY_H_INCLUDED
@@ -37,7 +37,6 @@
extern "C" {
#endif
-
/*
* Description of an archive entry.
*
@@ -57,7 +56,25 @@ extern "C" {
struct archive_entry;
/*
- * File-type constants. These are returned from archive_entry_filetype().
+ * File-type constants. These are returned from archive_entry_filetype()
+ * and passed to archive_entry_set_filetype().
+ *
+ * These values match S_XXX defines on every platform I've checked,
+ * including Windows, AIX, Linux, Solaris, and BSD. They're
+ * (re)defined here because platforms generally don't define the ones
+ * they don't support. For example, Windows doesn't define S_IFLNK or
+ * S_IFBLK. Instead of having a mass of conditional logic and system
+ * checks to define any S_XXX values that aren't supported locally,
+ * I've just defined a new set of such constants so that
+ * libarchive-based applications can manipulate and identify archive
+ * entries properly even if the hosting platform can't store them on
+ * disk.
+ *
+ * These values are also used directly within some portable formats,
+ * such as cpio. If you find a platform that varies from these, the
+ * correct solution is to leave these alone and translate from these
+ * portable values to platform-native values when entries are read from
+ * or written to disk.
*/
#define AE_IFMT 0170000
#define AE_IFREG 0100000
@@ -91,7 +108,8 @@ dev_t archive_entry_devmajor(struct archive_entry *);
dev_t archive_entry_devminor(struct archive_entry *);
mode_t archive_entry_filetype(struct archive_entry *);
void archive_entry_fflags(struct archive_entry *,
- unsigned long *set, unsigned long *clear);
+ unsigned long * /* set */,
+ unsigned long * /* clear */);
const char *archive_entry_fflags_text(struct archive_entry *);
gid_t archive_entry_gid(struct archive_entry *);
const char *archive_entry_gname(struct archive_entry *);
@@ -130,7 +148,7 @@ void archive_entry_set_devmajor(struct archive_entry *, dev_t);
void archive_entry_set_devminor(struct archive_entry *, dev_t);
void archive_entry_set_filetype(struct archive_entry *, unsigned int);
void archive_entry_set_fflags(struct archive_entry *,
- unsigned long set, unsigned long clear);
+ unsigned long /* set */, unsigned long /* clear */);
/* Returns pointer to start of first invalid token, or NULL if none. */
/* Note that all recognized tokens are processed, regardless. */
const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
@@ -144,6 +162,8 @@ void archive_entry_copy_hardlink(struct archive_entry *, const char *);
void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
void archive_entry_set_ino(struct archive_entry *, unsigned long);
void archive_entry_set_link(struct archive_entry *, const char *);
+void archive_entry_copy_link(struct archive_entry *, const char *);
+void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
void archive_entry_set_mode(struct archive_entry *, mode_t);
void archive_entry_set_mtime(struct archive_entry *, time_t, long);
void archive_entry_set_nlink(struct archive_entry *, unsigned int);
@@ -182,6 +202,13 @@ void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
* = there are many different ACL text formats
* = would like to be able to read/convert archives containing ACLs
* on platforms that lack ACL libraries
+ *
+ * This last point, in particular, forces me to implement a reasonably
+ * complete set of ACL support routines.
+ *
+ * TODO: Extend this to support NFSv4/NTFS permissions. That should
+ * allow full ACL support on Mac OS, in particular, which uses
+ * POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.
*/
/*
@@ -216,21 +243,24 @@ void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
*/
void archive_entry_acl_clear(struct archive_entry *);
void archive_entry_acl_add_entry(struct archive_entry *,
- int type, int permset, int tag, int qual, const char *name);
+ int /* type */, int /* permset */, int /* tag */,
+ int /* qual */, const char * /* name */);
void archive_entry_acl_add_entry_w(struct archive_entry *,
- int type, int permset, int tag, int qual, const wchar_t *name);
+ int /* type */, int /* permset */, int /* tag */,
+ int /* qual */, const wchar_t * /* name */);
/*
* To retrieve the ACL, first "reset", then repeatedly ask for the
* "next" entry. The want_type parameter allows you to request only
* access entries or only default entries.
*/
-int archive_entry_acl_reset(struct archive_entry *, int want_type);
-int archive_entry_acl_next(struct archive_entry *, int want_type,
- int *type, int *permset, int *tag, int *qual, const char **name);
-int archive_entry_acl_next_w(struct archive_entry *, int want_type,
- int *type, int *permset, int *tag, int *qual,
- const wchar_t **name);
+int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
+int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
+ int * /* type */, int * /* permset */, int * /* tag */,
+ int * /* qual */, const char ** /* name */);
+int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,
+ int * /* type */, int * /* permset */, int * /* tag */,
+ int * /* qual */, const wchar_t ** /* name */);
/*
* Construct a text-format ACL. The flags argument is a bitmask that
@@ -245,10 +275,11 @@ int archive_entry_acl_next_w(struct archive_entry *, int want_type,
*/
#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
-const wchar_t *archive_entry_acl_text_w(struct archive_entry *, int flags);
+const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
+ int /* flags */);
/* Return a count of entries matching 'want_type' */
-int archive_entry_acl_count(struct archive_entry *, int want_type);
+int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
/*
* Private ACL parser. This is private because it handles some
@@ -259,9 +290,12 @@ int archive_entry_acl_count(struct archive_entry *, int want_type);
* this interface are likely to be surprised when it changes.
*
* You were warned!
+ *
+ * TODO: Move this declaration out of the public header and into
+ * a private header. Warnings above are silly.
*/
int __archive_entry_acl_parse_w(struct archive_entry *,
- const wchar_t *, int type);
+ const wchar_t *, int /* type */);
/*
* extended attributes
@@ -269,7 +303,8 @@ int __archive_entry_acl_parse_w(struct archive_entry *,
void archive_entry_xattr_clear(struct archive_entry *);
void archive_entry_xattr_add_entry(struct archive_entry *,
- const char *name, const void *value, size_t size);
+ const char * /* name */, const void * /* value */,
+ size_t /* size */);
/*
* To retrieve the xattr list, first "reset", then repeatedly ask for the
@@ -279,29 +314,94 @@ void archive_entry_xattr_add_entry(struct archive_entry *,
int archive_entry_xattr_count(struct archive_entry *);
int archive_entry_xattr_reset(struct archive_entry *);
int archive_entry_xattr_next(struct archive_entry *,
- const char **name, const void **value, size_t *);
+ const char ** /* name */, const void ** /* value */, size_t *);
/*
* Utility to detect hardlinks.
*
- * The 'struct archive_hardlink_lookup' is a cache of entry
- * names and dev/ino numbers. Here's how to use it:
- * 1. Create a lookup object with archive_hardlink_lookup_new()
- * 2. Hand each archive_entry to archive_hardlink_lookup().
- * That function will return NULL (this is not a hardlink to
- * a previous entry) or the pathname of the first entry
- * that matched this.
- * 3. Use archive_hardlink_lookup_free() to release the cache.
+ * The 'struct archive_entry_linkresolver' is a cache of archive entries
+ * for files with multiple links. Here's how to use it:
+ * 1. Create a lookup object with archive_entry_linkresolver_new()
+ * 2. Set the appropriate strategy.
+ * 3. Hand each archive_entry to archive_entry_linkify().
+ * That function will return 0, 1, or 2 entries that should
+ * be written.
+ * 4. Call archive_entry_linkify(resolver, NULL) until
+ * no more entries are returned.
+ * 5. Call archive_entry_link_resolver_free(resolver) to free resources.
+ *
+ * The entries returned have their hardlink and size fields updated
+ * appropriately. If an entry is passed in that does not refer to
+ * a file with multiple links, it is returned unchanged. The intention
+ * is that you should be able to simply filter all entries through
+ * this machine.
*
* To make things more efficient, be sure that each entry has a valid
* nlinks value. The hardlink cache uses this to track when all links
* have been found. If the nlinks value is zero, it will keep every
* name in the cache indefinitely, which can use a lot of memory.
+ *
+ * Note that archive_entry_size() is reset to zero if the file
+ * body should not be written to the archive. Pay attention!
*/
struct archive_entry_linkresolver;
+/*
+ * This machine supports three different strategies for marking
+ * hardlinks. The names come from the best-known
+ * formats that rely on each strategy:
+ *
+ * "Old cpio" is the simplest, it always returns any entry unmodified.
+ * As far as I know, only cpio formats use this. Old cpio archives
+ * store every link with the full body; the onus is on the dearchiver
+ * to detect and properly link the files as they are restored.
+ * "tar" is also pretty simple; it caches a copy the first time it sees
+ * any link. Subsequent appearances are modified to be hardlink
+ * references without any body to the first one. Used by all tar
+ * formats, although the newest tar formats permit the "old cpio" strategy
+ * as well. This strategy is very simple for the dearchiver,
+ * and reasonably straightforward for the archiver.
+ * "new cpio" is trickier. It stores the body only with the last
+ * occurrence. The complication is that we might not
+ * see every link to a particular file in a single session, so
+ * there's no easy way to know when we've seen the last occurrence.
+ * The solution here is to queue one link until we see the next.
+ * At the end of the session, you can enumerate any remaining
+ * entries by calling archive_entry_linkify(NULL) and store those
+ * bodies. If you have a file with three links l1, l2, and l3,
+ * you'll get the following behavior if you see all three links:
+ * linkify(l1) => NULL (the resolver stores l1 internally)
+ * linkify(l2) => l1 (resolver stores l2, you write l1)
+ * linkify(l3) => l2, l3 (all links seen, you can write both).
+ * If you only see l1 and l2, you'll get this behavior:
+ * linkify(l1) => NULL
+ * linkify(l2) => l1
+ * linkify(NULL) => l2 (at end, you retrieve remaining links)
+ * As the name suggests, this strategy is used by newer cpio variants.
+ * It's noticably more complex for the archiver, slightly more complex
+ * for the dearchiver than the tar strategy, but makes it straightforward
+ * to restore a file using any link by simply continuing to scan until
+ * you see a link that is stored with a body. In contrast, the tar
+ * strategy requires you to rescan the archive from the beginning to
+ * correctly extract an arbitrary link.
+ */
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_TAR 0
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO 1
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO 2
+
struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
+void archive_entry_linkresolver_set_strategy(
+ struct archive_entry_linkresolver *, int /* strategy */);
void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
+void archive_entry_linkify(struct archive_entry_linkresolver *,
+ struct archive_entry **, struct archive_entry **);
+
+/*
+ * DEPRECATED: This will be removed in libarchive 3.0. It was an
+ * early attempt at providing library-level hardlink recognition
+ * support, but it only handles the tar strategy and cannot easily
+ * be extended, so it's being replaced with the "linkify" function.
+ */
const char *archive_entry_linkresolve(struct archive_entry_linkresolver *,
struct archive_entry *);
diff --git a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
index 0f07e068e07..37131ff325d 100644
--- a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
+++ b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_link_resolver.c,v 1.1 2007/12/30 04:58:21 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -42,133 +42,194 @@ __FBSDID("$FreeBSD$");
#include "archive_entry.h"
+/*
+ * This is mostly a pretty straightforward hash table implementation.
+ * The only interesting bit is the different strategies used to
+ * match up links. These strategies match those used by various
+ * archiving formats:
+ * tar - content stored with first link, remainder refer back to it.
+ * This requires us to match each subsequent link up with the
+ * first appearance.
+ * cpio - Old cpio just stored body with each link, match-ups were
+ * implicit. This is trivial.
+ * new cpio - New cpio only stores body with last link, match-ups
+ * are implicit. This is actually quite tricky; see the notes
+ * below.
+ */
+
/* Initial size of link cache. */
#define links_cache_initial_size 1024
+struct links_entry {
+ struct links_entry *next;
+ struct links_entry *previous;
+ int links; /* # links not yet seen */
+ int hash;
+ struct archive_entry *entry;
+};
+
struct archive_entry_linkresolver {
- char *last_name;
+ struct links_entry **buckets;
+ struct links_entry *spare;
unsigned long number_entries;
size_t number_buckets;
- struct links_entry **buckets;
+ int strategy;
};
-struct links_entry {
- struct links_entry *next;
- struct links_entry *previous;
- int links;
- dev_t dev;
- ino_t ino;
- char *name;
-};
+static struct links_entry *find_entry(struct archive_entry_linkresolver *,
+ struct archive_entry *);
+static void grow_hash(struct archive_entry_linkresolver *);
+static void insert_entry(struct archive_entry_linkresolver *,
+ struct archive_entry *);
struct archive_entry_linkresolver *
archive_entry_linkresolver_new(void)
{
- struct archive_entry_linkresolver *links_cache;
+ struct archive_entry_linkresolver *res;
size_t i;
- links_cache = malloc(sizeof(struct archive_entry_linkresolver));
- if (links_cache == NULL)
+ res = malloc(sizeof(struct archive_entry_linkresolver));
+ if (res == NULL)
return (NULL);
- memset(links_cache, 0, sizeof(struct archive_entry_linkresolver));
- links_cache->number_buckets = links_cache_initial_size;
- links_cache->buckets = malloc(links_cache->number_buckets *
- sizeof(links_cache->buckets[0]));
- if (links_cache->buckets == NULL) {
- free(links_cache);
+ memset(res, 0, sizeof(struct archive_entry_linkresolver));
+ res->number_buckets = links_cache_initial_size;
+ res->buckets = malloc(res->number_buckets *
+ sizeof(res->buckets[0]));
+ if (res->buckets == NULL) {
+ free(res);
return (NULL);
}
- for (i = 0; i < links_cache->number_buckets; i++)
- links_cache->buckets[i] = NULL;
- return (links_cache);
+ for (i = 0; i < res->number_buckets; i++)
+ res->buckets[i] = NULL;
+ return (res);
+}
+
+void
+archive_entry_linkresolver_set_strategy(struct archive_entry_linkresolver *res,
+ int strategy)
+{
+ res->strategy = strategy;
}
void
-archive_entry_linkresolver_free(struct archive_entry_linkresolver *links_cache)
+archive_entry_linkresolver_free(struct archive_entry_linkresolver *res)
{
size_t i;
- if (links_cache->buckets == NULL)
+ if (res->buckets == NULL)
return;
- for (i = 0; i < links_cache->number_buckets; i++) {
- while (links_cache->buckets[i] != NULL) {
- struct links_entry *lp = links_cache->buckets[i]->next;
- if (links_cache->buckets[i]->name != NULL)
- free(links_cache->buckets[i]->name);
- free(links_cache->buckets[i]);
- links_cache->buckets[i] = lp;
+ for (i = 0; i < res->number_buckets; i++) {
+ while (res->buckets[i] != NULL) {
+ struct links_entry *lp = res->buckets[i]->next;
+ archive_entry_free(res->buckets[i]->entry);
+ free(res->buckets[i]);
+ res->buckets[i] = lp;
}
}
- free(links_cache->buckets);
- links_cache->buckets = NULL;
+ free(res->buckets);
+ res->buckets = NULL;
}
+/* Always uses tar-like semantics. */
const char *
-archive_entry_linkresolve(struct archive_entry_linkresolver *links_cache,
+archive_entry_linkresolve(struct archive_entry_linkresolver *res,
struct archive_entry *entry)
{
- struct links_entry *le, **new_buckets;
- int hash;
- size_t i, new_size;
- dev_t dev;
- ino_t ino;
- int nlinks;
+ struct links_entry *le;
+ /* If it has only one link, then we're done. */
+ if (archive_entry_nlink(entry) == 1)
+ return (NULL);
- /* Free a held name. */
- free(links_cache->last_name);
- links_cache->last_name = NULL;
+ /* Look it up in the hash. */
+ le = find_entry(res, entry);
+ if (le != NULL)
+ return (archive_entry_pathname(le->entry));
+ /* If it's not there, insert it. */
+ insert_entry(res, entry);
+ return (NULL);
+}
- /* If the links cache overflowed and got flushed, don't bother. */
- if (links_cache->buckets == NULL)
- return (NULL);
+void
+archive_entry_linkify(struct archive_entry_linkresolver *res,
+ struct archive_entry **e, struct archive_entry **f)
+{
+ struct links_entry *le;
+ struct archive_entry *t;
- dev = archive_entry_dev(entry);
- ino = archive_entry_ino(entry);
- nlinks = archive_entry_nlink(entry);
+ *f = NULL; /* Default: Don't return a second entry. */
- /* An entry with one link can't be a hard link. */
- if (nlinks == 1)
- return (NULL);
+ /* If it has only one link, then we're done. */
+ if (archive_entry_nlink(*e) == 1)
+ return;
- /* If the links cache is getting too full, enlarge the hash table. */
- if (links_cache->number_entries > links_cache->number_buckets * 2)
- {
- /* Try to enlarge the bucket list. */
- new_size = links_cache->number_buckets * 2;
- new_buckets = malloc(new_size * sizeof(struct links_entry *));
-
- if (new_buckets != NULL) {
- memset(new_buckets, 0,
- new_size * sizeof(struct links_entry *));
- for (i = 0; i < links_cache->number_buckets; i++) {
- while (links_cache->buckets[i] != NULL) {
- /* Remove entry from old bucket. */
- le = links_cache->buckets[i];
- links_cache->buckets[i] = le->next;
-
- /* Add entry to new bucket. */
- hash = (le->dev ^ le->ino) % new_size;
-
- if (new_buckets[hash] != NULL)
- new_buckets[hash]->previous =
- le;
- le->next = new_buckets[hash];
- le->previous = NULL;
- new_buckets[hash] = le;
- }
+ switch (res->strategy) {
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR:
+ le = find_entry(res, *e);
+ if (le != NULL) {
+ archive_entry_set_size(*e, 0);
+ archive_entry_set_hardlink(*e,
+ archive_entry_pathname(le->entry));
+ } else
+ insert_entry(res, *e);
+ return;
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO:
+ /* This one is trivial. */
+ return;
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO:
+ le = find_entry(res, *e);
+ if (le != NULL) {
+ t = *e;
+ *e = le->entry;
+ le->entry = t;
+ archive_entry_set_size(*e, 0);
+ archive_entry_set_hardlink(*e,
+ archive_entry_pathname(le->entry));
+ if (le->links == 0) {
+ *f = le->entry;
}
- free(links_cache->buckets);
- links_cache->buckets = new_buckets;
- links_cache->number_buckets = new_size;
+ } else {
+ insert_entry(res, *e);
+ *e = NULL;
}
+ return;
+ default:
+ break;
}
+ return;
+}
+
+static struct links_entry *
+find_entry(struct archive_entry_linkresolver *res,
+ struct archive_entry *entry)
+{
+ struct links_entry *le;
+ int hash, bucket;
+ dev_t dev;
+ ino_t ino;
+
+ /* Free a held entry. */
+ if (res->spare != NULL) {
+ archive_entry_free(res->spare->entry);
+ free(res->spare);
+ res->spare = NULL;
+ }
+
+ /* If the links cache overflowed and got flushed, don't bother. */
+ if (res->buckets == NULL)
+ return (NULL);
+
+ dev = archive_entry_dev(entry);
+ ino = archive_entry_ino(entry);
+ hash = dev ^ ino;
/* Try to locate this entry in the links cache. */
- hash = ( dev ^ ino ) % links_cache->number_buckets;
- for (le = links_cache->buckets[hash]; le != NULL; le = le->next) {
- if (le->dev == dev && le->ino == ino) {
+ bucket = hash % res->number_buckets;
+ for (le = res->buckets[bucket]; le != NULL; le = le->next) {
+ if (le->hash == hash
+ && dev == archive_entry_dev(le->entry)
+ && ino == archive_entry_ino(le->entry)) {
/*
* Decrement link count each time and release
* the entry if it hits zero. This saves
@@ -177,46 +238,91 @@ archive_entry_linkresolve(struct archive_entry_linkresolver *links_cache,
*/
--le->links;
if (le->links > 0)
- return (le->name);
- /*
- * When we release the entry, save the name
- * until the next call.
- */
- links_cache->last_name = le->name;
- /*
- * Release the entry.
- */
+ return (le);
+ /* Remove it from this hash bucket. */
if (le->previous != NULL)
le->previous->next = le->next;
if (le->next != NULL)
le->next->previous = le->previous;
- if (links_cache->buckets[hash] == le)
- links_cache->buckets[hash] = le->next;
- links_cache->number_entries--;
- free(le);
- return (links_cache->last_name);
+ if (res->buckets[bucket] == le)
+ res->buckets[bucket] = le->next;
+ res->number_entries--;
+ /* Defer freeing this entry. */
+ res->spare = le;
+ return (le);
}
}
+ return (NULL);
+}
+
+static void
+insert_entry(struct archive_entry_linkresolver *res,
+ struct archive_entry *entry)
+{
+ struct links_entry *le;
+ int hash, bucket;
/* Add this entry to the links cache. */
le = malloc(sizeof(struct links_entry));
if (le == NULL)
- return (NULL);
- le->name = strdup(archive_entry_pathname(entry));
- if (le->name == NULL) {
+ return;
+ le->entry = archive_entry_clone(entry);
+ if (le->entry == NULL) {
free(le);
- return (NULL);
+ return;
}
+ /* If the links cache is getting too full, enlarge the hash table. */
+ if (res->number_entries > res->number_buckets * 2)
+ grow_hash(res);
+
+ hash = archive_entry_dev(entry) ^ archive_entry_ino(entry);
+ bucket = hash % res->number_buckets;
+
/* If we could allocate the entry, record it. */
- if (links_cache->buckets[hash] != NULL)
- links_cache->buckets[hash]->previous = le;
- links_cache->number_entries++;
- le->next = links_cache->buckets[hash];
+ if (res->buckets[bucket] != NULL)
+ res->buckets[bucket]->previous = le;
+ res->number_entries++;
+ le->next = res->buckets[bucket];
le->previous = NULL;
- links_cache->buckets[hash] = le;
- le->dev = dev;
- le->ino = ino;
- le->links = nlinks - 1;
- return (NULL);
+ res->buckets[bucket] = le;
+ le->hash = hash;
+ le->links = archive_entry_nlink(entry) - 1;
+}
+
+static void
+grow_hash(struct archive_entry_linkresolver *res)
+{
+ struct links_entry *le, **new_buckets;
+ size_t new_size;
+ size_t i, bucket;
+
+ /* Try to enlarge the bucket list. */
+ new_size = res->number_buckets * 2;
+ new_buckets = malloc(new_size * sizeof(struct links_entry *));
+
+ if (new_buckets != NULL) {
+ memset(new_buckets, 0,
+ new_size * sizeof(struct links_entry *));
+ for (i = 0; i < res->number_buckets; i++) {
+ while (res->buckets[i] != NULL) {
+ /* Remove entry from old bucket. */
+ le = res->buckets[i];
+ res->buckets[i] = le->next;
+
+ /* Add entry to new bucket. */
+ bucket = le->hash % new_size;
+
+ if (new_buckets[bucket] != NULL)
+ new_buckets[bucket]->previous =
+ le;
+ le->next = new_buckets[bucket];
+ le->previous = NULL;
+ new_buckets[bucket] = le;
+ }
+ }
+ free(res->buckets);
+ res->buckets = new_buckets;
+ res->number_buckets = new_size;
+ }
}
diff --git a/archivers/libarchive/files/libarchive/archive_entry_private.h b/archivers/libarchive/files/libarchive/archive_entry_private.h
index 50ad7b9064b..57fe29600ac 100644
--- a/archivers/libarchive/files/libarchive/archive_entry_private.h
+++ b/archivers/libarchive/files/libarchive/archive_entry_private.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.1 2007/05/29 01:00:18 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_entry_private.h,v 1.2 2007/12/30 04:58:21 kientzle Exp $
*/
#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
diff --git a/archivers/libarchive/files/libarchive/archive_entry_strmode.c b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
index 1a018734bce..dc08d9721a6 100644
--- a/archivers/libarchive/files/libarchive/archive_entry_strmode.c
+++ b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.2 2008/02/19 05:49:02 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -65,15 +65,15 @@ archive_entry_strmode(struct archive_entry *entry)
bp[i+1] = '-';
if (mode & S_ISUID) {
- if (mode & S_IXUSR) bp[3] = 's';
+ if (mode & 0100) bp[3] = 's';
else bp[3] = 'S';
}
if (mode & S_ISGID) {
- if (mode & S_IXGRP) bp[6] = 's';
+ if (mode & 0010) bp[6] = 's';
else bp[6] = 'S';
}
if (mode & S_ISVTX) {
- if (mode & S_IXOTH) bp[9] = 't';
+ if (mode & 0001) bp[9] = 't';
else bp[9] = 'T';
}
if (archive_entry_acl_count(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS))
diff --git a/archivers/libarchive/files/libarchive/archive_platform.h b/archivers/libarchive/files/libarchive/archive_platform.h
index 193a52cc674..b14ccd8206b 100644
--- a/archivers/libarchive/files/libarchive/archive_platform.h
+++ b/archivers/libarchive/files/libarchive/archive_platform.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.27 2007/05/29 01:00:18 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_platform.h,v 1.29 2008/02/19 06:06:13 kientzle Exp $
*/
/*
@@ -36,7 +36,10 @@
#ifndef ARCHIVE_PLATFORM_H_INCLUDED
#define ARCHIVE_PLATFORM_H_INCLUDED
-#if defined(PLATFORM_CONFIG_H)
+#ifdef _WIN32
+#include "config_windows.h"
+#include "archive_windows.h"
+#elif defined(PLATFORM_CONFIG_H)
/* Use hand-built config.h in environments that need it. */
#include PLATFORM_CONFIG_H
#elif defined(HAVE_CONFIG_H)
diff --git a/archivers/libarchive/files/libarchive/archive_read.c b/archivers/libarchive/files/libarchive/archive_read.c
index 7803fd2f9fe..19be77569c1 100644
--- a/archivers/libarchive/files/libarchive/archive_read.c
+++ b/archivers/libarchive/files/libarchive/archive_read.c
@@ -32,7 +32,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.35 2007/05/29 01:00:18 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read.c,v 1.37 2008/01/03 17:54:26 des Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -741,3 +741,14 @@ __archive_read_register_compression(struct archive_read *a,
__archive_errx(1, "Not enough slots for compression registration");
return (NULL); /* Never actually executed. */
}
+
+/* used internally to simplify read-ahead */
+const void *
+__archive_read_ahead(struct archive_read *a, size_t len)
+{
+ const void *h;
+
+ if ((a->decompressor->read_ahead)(a, &h, len) < (ssize_t)len)
+ return (NULL);
+ return (h);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_extract.c b/archivers/libarchive/files/libarchive/archive_read_extract.c
index 423ff7dd3c5..bb5add7bbdc 100644
--- a/archivers/libarchive/files/libarchive/archive_read_extract.c
+++ b/archivers/libarchive/files/libarchive/archive_read_extract.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.59 2007/05/29 01:00:18 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.60 2008/01/18 04:53:45 kientzle Exp $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -67,6 +67,7 @@ get_extract(struct archive_read *a)
archive_set_error(&a->archive, ENOMEM, "Can't extract");
return (NULL);
}
+ memset(a->extract, 0, sizeof(*a->extract));
a->extract->ad = archive_write_disk_new();
if (a->extract->ad == NULL) {
archive_set_error(&a->archive, ENOMEM, "Can't extract");
@@ -130,11 +131,13 @@ archive_read_extract_set_progress_callback(struct archive *_a,
static int
copy_data(struct archive *ar, struct archive *aw)
{
- int r;
+ off_t offset;
const void *buff;
+ struct extract *extract;
size_t size;
- off_t offset;
+ int r;
+ extract = get_extract((struct archive_read *)ar);
for (;;) {
r = archive_read_data_block(ar, &buff, &size, &offset);
if (r == ARCHIVE_EOF)
@@ -149,6 +152,9 @@ copy_data(struct archive *ar, struct archive *aw)
"%s", archive_error_string(aw));
return (r);
}
+ if (extract->extract_progress)
+ (extract->extract_progress)
+ (extract->extract_progress_user_data);
}
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_open_filename.c b/archivers/libarchive/files/libarchive/archive_read_open_filename.c
index 02e7902f3a8..3d6376fbcfa 100644
--- a/archivers/libarchive/files/libarchive/archive_read_open_filename.c
+++ b/archivers/libarchive/files/libarchive/archive_read_open_filename.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_filename.c,v 1.20 2007/06/26 03:06:48 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_filename.c,v 1.21 2008/02/19 06:10:48 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -47,6 +47,10 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_filename.c,v 1.20 2007/
#include "archive.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
struct read_file_data {
int fd;
size_t block_size;
@@ -113,7 +117,7 @@ file_open(struct archive *a, void *client_data)
return (ARCHIVE_FATAL);
}
if (mine->filename[0] != '\0')
- mine->fd = open(mine->filename, O_RDONLY);
+ mine->fd = open(mine->filename, O_RDONLY | O_BINARY);
else
mine->fd = 0; /* Fake "open" for stdin. */
if (mine->fd < 0) {
diff --git a/archivers/libarchive/files/libarchive/archive_read_private.h b/archivers/libarchive/files/libarchive/archive_read_private.h
index f0f52021132..90fb7db12e6 100644
--- a/archivers/libarchive/files/libarchive/archive_read_private.h
+++ b/archivers/libarchive/files/libarchive/archive_read_private.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/archive_read_private.h,v 1.3 2007/05/29 01:00:18 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/archive_read_private.h,v 1.4 2008/01/03 17:54:26 des Exp $
*/
#ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED
@@ -173,4 +173,7 @@ struct decompressor_t
int (*bid)(const void *, size_t),
int (*init)(struct archive_read *, const void *, size_t));
+const void
+ *__archive_read_ahead(struct archive_read *, size_t);
+
#endif
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c
index aa664d10b19..372eff09541 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c
@@ -25,7 +25,7 @@
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_bzip2.c,v 1.16 2007/05/29 01:00:18 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_bzip2.c,v 1.17 2008/02/19 05:44:59 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -145,7 +145,7 @@ init(struct archive_read *a, const void *buff, size_t n)
(void)buff; /* UNUSED */
(void)n; /* UNUSED */
- archive_set_error(a, -1,
+ archive_set_error(&a->archive, -1,
"This version of libarchive was compiled without bzip2 support");
return (ARCHIVE_FATAL);
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c
index 89784b8dfcc..2dac54da0cd 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c
@@ -25,7 +25,7 @@
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_gzip.c,v 1.15 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_gzip.c,v 1.16 2008/02/19 05:44:59 kientzle Exp $");
#ifdef HAVE_ERRNO_H
@@ -146,7 +146,7 @@ init(struct archive_read *a, const void *buff, size_t n)
(void)buff; /* UNUSED */
(void)n; /* UNUSED */
- archive_set_error(a, -1,
+ archive_set_error(&a->archive, -1,
"This version of libarchive was compiled without gzip support");
return (ARCHIVE_FATAL);
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
index 1cafd8385a5..3f17756abae 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.18 2007/10/27 22:45:40 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_compression_none.c,v 1.19 2007/12/30 04:58:21 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_all.c b/archivers/libarchive/files/libarchive/archive_read_support_format_all.c
index c9165c89453..24e31ef54f5 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_all.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_all.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_all.c,v 1.9 2007/04/07 05:54:23 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_all.c,v 1.10 2007/12/30 04:58:21 kientzle Exp $");
#include "archive.h"
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
index 5fad4aea038..a74791c6dae 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
@@ -26,7 +26,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.6 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_ar.c,v 1.8 2008/02/19 05:54:24 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -268,8 +268,7 @@ archive_read_format_ar_read_header(struct archive_read *a,
/* This must come before any call to _read_ahead. */
ar_parse_common_header(ar, entry, h);
archive_entry_copy_pathname(entry, filename);
- archive_entry_set_mode(entry,
- S_IFREG | (archive_entry_mode(entry) & 0777));
+ archive_entry_set_filetype(entry, AE_IFREG);
/* Get the size of the filename table. */
number = ar_atol10(h + AR_size_offset, AR_size_size);
if (number > SIZE_MAX) {
@@ -375,8 +374,7 @@ archive_read_format_ar_read_header(struct archive_read *a,
/* Parse the time, owner, mode, size fields. */
r = ar_parse_common_header(ar, entry, h);
/* Force the file type to a regular file. */
- archive_entry_set_mode(entry,
- S_IFREG | (archive_entry_mode(entry) & 0777));
+ archive_entry_set_filetype(entry, AE_IFREG);
return (r);
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
index 1ede8b622b2..2c50abc6b88 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_cpio.c,v 1.24 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_cpio.c,v 1.26 2008/01/15 04:56:48 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -321,10 +321,12 @@ static int
is_hex(const char *p, size_t len)
{
while (len-- > 0) {
- if (*p < '0' || (*p > '9' && *p < 'a') || *p > 'f') {
+ if ((*p >= '0' && *p <= '9')
+ || (*p >= 'a' && *p <= 'f')
+ || (*p >= 'A' && *p <= 'F'))
+ ++p;
+ else
return (0);
- }
- ++p;
}
return (1);
}
@@ -741,7 +743,7 @@ record_hardlink(struct cpio *cpio, struct archive_entry *entry)
*/
for (le = cpio->links_head; le; le = le->next) {
if (le->dev == dev && le->ino == ino) {
- archive_entry_set_hardlink(entry, le->name);
+ archive_entry_copy_hardlink(entry, le->name);
if (--le->links <= 0) {
if (le->previous != NULL)
@@ -750,6 +752,7 @@ record_hardlink(struct cpio *cpio, struct archive_entry *entry)
le->next->previous = le->previous;
if (cpio->links_head == le)
cpio->links_head = le->next;
+ free(le->name);
free(le);
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
index d2419eac66f..d333f0ccb4e 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.23 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_iso9660.c,v 1.25 2008/02/19 06:02:01 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -181,6 +181,7 @@ struct file_info {
time_t mtime; /* File last modified time. */
time_t atime; /* File last accessed time. */
time_t ctime; /* File creation time. */
+ uint64_t rdev; /* Device number */
mode_t mode;
uid_t uid;
gid_t gid;
@@ -360,6 +361,8 @@ archive_read_format_iso9660_read_header(struct archive_read *a,
archive_entry_set_mtime(entry, file->mtime, 0);
archive_entry_set_ctime(entry, file->ctime, 0);
archive_entry_set_atime(entry, file->atime, 0);
+ /* N.B.: Rock Ridge supports 64-bit device numbers. */
+ archive_entry_set_rdev(entry, (dev_t)file->rdev);
archive_entry_set_size(entry, iso9660->entry_bytes_remaining);
archive_string_empty(&iso9660->pathname);
archive_entry_set_pathname(entry,
@@ -675,6 +678,14 @@ parse_rockridge(struct iso9660 *iso9660, struct file_info *file,
*/
break;
}
+ if (p[0] == 'P' && p[1] == 'N' && version == 1) {
+ if (data_length == 16) {
+ file->rdev = toi(data,4);
+ file->rdev <<= 32;
+ file->rdev |= toi(data + 8, 4);
+ }
+ break;
+ }
if (p[0] == 'P' && p[1] == 'X' && version == 1) {
/*
* PX extension comprises:
@@ -1053,24 +1064,28 @@ time_from_tm(struct tm *t)
if (t->tm_isdst)
t->tm_hour -= 1;
return (mktime(t)); /* Re-convert. */
-#else
- /*
- * If you don't have tm_gmtoff, let's try resetting the timezone
- * (yecch!).
- */
+#elif defined(HAVE_SETENV) && defined(HAVE_UNSETENV) && defined(HAVE_TZSET)
+ /* No timegm() and no tm_gmtoff, let's try forcing mktime() to UTC. */
time_t ret;
char *tz;
+ /* Reset the timezone, remember the old one. */
tz = getenv("TZ");
setenv("TZ", "UTC 0", 1);
tzset();
+
ret = mktime(t);
+
+ /* Restore the previous timezone. */
if (tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
tzset();
return ret;
+#else
+ /* <sigh> We have no choice but to use localtime instead of UTC. */
+ return (mktime(t));
#endif
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
index e6ac99f6bfb..7db6db3377a 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_mtree.c,v 1.2 2008/02/19 06:07:10 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -50,6 +50,10 @@ __FBSDID("$FreeBSD$");
#include "archive_read_private.h"
#include "archive_string.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
struct mtree_entry {
struct mtree_entry *next;
char *name;
@@ -371,7 +375,8 @@ read_header(struct archive_read *a, struct archive_entry *entry)
* the contents file on disk.)
*/
if (archive_strlen(&mtree->contents_name) > 0) {
- mtree->fd = open(mtree->contents_name.s, O_RDONLY);
+ mtree->fd = open(mtree->contents_name.s,
+ O_RDONLY | O_BINARY);
if (mtree->fd < 0) {
archive_set_error(&a->archive, errno,
"Can't open content=\"%s\"",
@@ -380,7 +385,8 @@ read_header(struct archive_read *a, struct archive_entry *entry)
}
} else {
/* If the specified path opens, use it. */
- mtree->fd = open(mtree->current_dir.s, O_RDONLY);
+ mtree->fd = open(mtree->current_dir.s,
+ O_RDONLY | O_BINARY);
/* But don't fail if it's not there. */
}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
index 6d6ee309571..26b2abbe578 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.62 2007/10/24 04:01:31 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_tar.c,v 1.65 2008/01/31 07:41:45 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -144,8 +144,8 @@ struct sparse_block {
struct tar {
struct archive_string acl_text;
- struct archive_string entry_name;
- struct archive_string entry_linkname;
+ struct archive_string entry_pathname;
+ struct archive_string entry_linkpath;
struct archive_string entry_uname;
struct archive_string entry_gname;
struct archive_string longlink;
@@ -153,6 +153,7 @@ struct tar {
struct archive_string pax_header;
struct archive_string pax_global;
struct archive_string line;
+ int pax_hdrcharset_binary;
wchar_t *pax_entry;
size_t pax_entry_length;
int header_recursion_depth;
@@ -169,9 +170,9 @@ struct tar {
char sparse_gnu_pending;
};
-static size_t UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n);
+static ssize_t UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n);
static int archive_block_is_null(const unsigned char *p);
-static char *base64_decode(const wchar_t *, size_t, size_t *);
+static char *base64_decode(const char *, size_t, size_t *);
static void gnu_add_sparse_entry(struct tar *,
off_t offset, off_t remaining);
static void gnu_clear_sparse_list(struct tar *);
@@ -179,7 +180,7 @@ static int gnu_sparse_old_read(struct archive_read *, struct tar *,
const struct archive_entry_header_gnutar *header);
static void gnu_sparse_old_parse(struct tar *,
const struct gnu_sparse *sparse, int length);
-static int gnu_sparse_01_parse(struct tar *, const wchar_t *);
+static int gnu_sparse_01_parse(struct tar *, const char *);
static ssize_t gnu_sparse_10_read(struct archive_read *, struct tar *);
static int header_Solaris_ACL(struct archive_read *, struct tar *,
struct archive_entry *, const void *);
@@ -210,24 +211,23 @@ static int archive_read_format_tar_read_header(struct archive_read *,
struct archive_entry *);
static int checksum(struct archive_read *, const void *);
static int pax_attribute(struct tar *, struct archive_entry *,
- wchar_t *key, wchar_t *value);
+ char *key, char *value);
static int pax_header(struct archive_read *, struct tar *,
struct archive_entry *, char *attr);
-static void pax_time(const wchar_t *, int64_t *sec, long *nanos);
+static void pax_time(const char *, int64_t *sec, long *nanos);
static ssize_t readline(struct archive_read *, struct tar *, const char **,
ssize_t limit);
static int read_body_to_string(struct archive_read *, struct tar *,
struct archive_string *, const void *h);
static int64_t tar_atol(const char *, unsigned);
-static int64_t tar_atol10(const wchar_t *, unsigned);
+static int64_t tar_atol10(const char *, unsigned);
static int64_t tar_atol256(const char *, unsigned);
static int64_t tar_atol8(const char *, unsigned);
static int tar_read_header(struct archive_read *, struct tar *,
struct archive_entry *);
static int tohex(int c);
static char *url_decode(const char *);
-static int utf8_decode(wchar_t *, const char *, size_t length);
-static char *wide_to_narrow(const wchar_t *wval);
+static wchar_t *utf8_decode(struct tar *, const char *, size_t length);
int
archive_read_support_format_gnutar(struct archive *a)
@@ -271,13 +271,15 @@ archive_read_format_tar_cleanup(struct archive_read *a)
tar = (struct tar *)(a->format->data);
gnu_clear_sparse_list(tar);
archive_string_free(&tar->acl_text);
- archive_string_free(&tar->entry_name);
- archive_string_free(&tar->entry_linkname);
+ archive_string_free(&tar->entry_pathname);
+ archive_string_free(&tar->entry_linkpath);
archive_string_free(&tar->entry_uname);
archive_string_free(&tar->entry_gname);
archive_string_free(&tar->line);
archive_string_free(&tar->pax_global);
archive_string_free(&tar->pax_header);
+ archive_string_free(&tar->longname);
+ archive_string_free(&tar->longlink);
free(tar->pax_entry);
free(tar);
(a->format->data) = NULL;
@@ -293,24 +295,8 @@ archive_read_format_tar_bid(struct archive_read *a)
const void *h;
const struct archive_entry_header_ustar *header;
- /*
- * If we're already reading a non-tar file, don't
- * bother to bid.
- */
- if (a->archive.archive_format != 0 &&
- (a->archive.archive_format & ARCHIVE_FORMAT_BASE_MASK) !=
- ARCHIVE_FORMAT_TAR)
- return (0);
bid = 0;
- /*
- * If we're already reading a tar format, start the bid at 1 as
- * a failsafe.
- */
- if ((a->archive.archive_format & ARCHIVE_FORMAT_BASE_MASK) ==
- ARCHIVE_FORMAT_TAR)
- bid++;
-
/* Now let's look at the actual header and see if it matches. */
if (a->decompressor->read_ahead != NULL)
bytes_read = (a->decompressor->read_ahead)(a, &h, 512);
@@ -322,13 +308,14 @@ archive_read_format_tar_bid(struct archive_read *a)
return (0);
/* If it's an end-of-archive mark, we can handle it. */
- if ((*(const char *)h) == 0 && archive_block_is_null((const unsigned char *)h)) {
- /* If it's a known tar file, end-of-archive is definite. */
- if ((a->archive.archive_format & ARCHIVE_FORMAT_BASE_MASK) ==
- ARCHIVE_FORMAT_TAR)
- return (512);
- /* Empty archive? */
- return (1);
+ if ((*(const char *)h) == 0
+ && archive_block_is_null((const unsigned char *)h)) {
+ /*
+ * Usually, I bid the number of bits verified, but
+ * in this case, 4096 seems excessive so I picked 10 as
+ * an arbitrary but reasonable-seeming value.
+ */
+ return (10);
}
/* If it's not an end-of-archive mark, it must have a valid checksum.*/
@@ -588,6 +575,10 @@ tar_read_header(struct archive_read *a, struct tar *tar,
if (bytes > 0)
(a->decompressor->consume)(a, bytes);
archive_set_error(&a->archive, 0, NULL);
+ if (a->archive.archive_format_name == NULL) {
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR;
+ a->archive.archive_format_name = "tar";
+ }
return (ARCHIVE_EOF);
}
@@ -775,16 +766,9 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
while (*p != '\0' && p < acl + size)
p++;
- wp = (wchar_t *)malloc((p - acl + 1) * sizeof(wchar_t));
- if (wp == NULL) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate work buffer for ACL parsing");
- return (ARCHIVE_FATAL);
- }
- utf8_decode(wp, acl, p - acl);
+ wp = utf8_decode(tar, acl, p - acl);
err = __archive_entry_acl_parse_w(entry, wp,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
- free(wp);
return (err);
}
@@ -804,7 +788,7 @@ header_longlink(struct archive_read *a, struct tar *tar,
if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
return (err);
/* Set symlink if symlink already set, else hardlink. */
- archive_entry_set_link(entry, tar->longlink.s);
+ archive_entry_copy_link(entry, tar->longlink.s);
return (ARCHIVE_OK);
}
@@ -824,7 +808,7 @@ header_longname(struct archive_read *a, struct tar *tar,
err = tar_read_header(a, tar, entry);
if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
return (err);
- archive_entry_set_pathname(entry, tar->longname.s);
+ archive_entry_copy_pathname(entry, tar->longname.s);
return (ARCHIVE_OK);
}
@@ -916,10 +900,10 @@ header_common(struct archive_read *a, struct tar *tar,
header = (const struct archive_entry_header_ustar *)h;
if (header->linkname[0])
- archive_strncpy(&(tar->entry_linkname), header->linkname,
+ archive_strncpy(&(tar->entry_linkpath), header->linkname,
sizeof(header->linkname));
else
- archive_string_empty(&(tar->entry_linkname));
+ archive_string_empty(&(tar->entry_linkpath));
/* Parse out the numeric fields (all are octal) */
archive_entry_set_mode(entry, tar_atol(header->mode, sizeof(header->mode)));
@@ -935,7 +919,7 @@ header_common(struct archive_read *a, struct tar *tar,
switch (tartype) {
case '1': /* Hard link */
- archive_entry_set_hardlink(entry, tar->entry_linkname.s);
+ archive_entry_copy_hardlink(entry, tar->entry_linkpath.s);
/*
* The following may seem odd, but: Technically, tar
* does not store the file type for a "hard link"
@@ -952,36 +936,52 @@ header_common(struct archive_read *a, struct tar *tar,
* A tricky point: Traditionally, tar readers have
* ignored the size field when reading hardlink
* entries, and some writers put non-zero sizes even
- * though the body is empty. POSIX.1-2001 broke with
- * this tradition by permitting hardlink entries to
- * store valid bodies in pax interchange format, but
- * not in ustar format. Since there is no hard and
- * fast way to distinguish pax interchange from
- * earlier archives (the 'x' and 'g' entries are
- * optional, after all), we need a heuristic. Here, I
- * use the bid function to test whether or not there's
- * a valid header following. Of course, if we know
- * this is pax interchange format, then we must obey
- * the size.
- *
- * This heuristic will only fail for a pax interchange
- * archive that is storing hardlink bodies, no pax
- * extended attribute entries have yet occurred, and
- * we encounter a hardlink entry for a file that is
- * itself an uncompressed tar archive.
+ * though the body is empty. POSIX blessed this
+ * convention in the 1988 standard, but broke with
+ * this tradition in 2001 by permitting hardlink
+ * entries to store valid bodies in pax interchange
+ * format, but not in ustar format. Since there is no
+ * hard and fast way to distinguish pax interchange
+ * from earlier archives (the 'x' and 'g' entries are
+ * optional, after all), we need a heuristic.
*/
- if (archive_entry_size(entry) > 0 &&
- a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE &&
- archive_read_format_tar_bid(a) > 50) {
+ if (archive_entry_size(entry) == 0) {
+ /* If the size is already zero, we're done. */
+ } else if (a->archive.archive_format
+ == ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
+ /* Definitely pax extended; must obey hardlink size. */
+ } else if (a->archive.archive_format == ARCHIVE_FORMAT_TAR
+ || a->archive.archive_format == ARCHIVE_FORMAT_TAR_GNUTAR)
+ {
+ /* Old-style or GNU tar: we must ignore the size. */
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ } else if (archive_read_format_tar_bid(a) > 50) {
+ /*
+ * We don't know if it's pax: If the bid
+ * function sees a valid ustar header
+ * immediately following, then let's ignore
+ * the hardlink size.
+ */
archive_entry_set_size(entry, 0);
tar->entry_bytes_remaining = 0;
}
+ /*
+ * TODO: There are still two cases I'd like to handle:
+ * = a ustar non-pax archive with a hardlink entry at
+ * end-of-archive. (Look for block of nulls following?)
+ * = a pax archive that has not seen any pax headers
+ * and has an entry which is a hardlink entry storing
+ * a body containing an uncompressed tar archive.
+ * The first is worth addressing; I don't see any reliable
+ * way to deal with the second possibility.
+ */
break;
case '2': /* Symlink */
archive_entry_set_filetype(entry, AE_IFLNK);
archive_entry_set_size(entry, 0);
tar->entry_bytes_remaining = 0;
- archive_entry_set_symlink(entry, tar->entry_linkname.s);
+ archive_entry_copy_symlink(entry, tar->entry_linkpath.s);
break;
case '3': /* Character device */
archive_entry_set_filetype(entry, AE_IFCHR);
@@ -1053,8 +1053,8 @@ header_old_tar(struct archive_read *a, struct tar *tar,
/* Copy filename over (to ensure null termination). */
header = (const struct archive_entry_header_ustar *)h;
- archive_strncpy(&(tar->entry_name), header->name, sizeof(header->name));
- archive_entry_set_pathname(entry, tar->entry_name.s);
+ archive_strncpy(&(tar->entry_pathname), header->name, sizeof(header->name));
+ archive_entry_copy_pathname(entry, tar->entry_pathname.s);
/* Grab rest of common fields */
header_common(a, tar, entry, h);
@@ -1125,7 +1125,7 @@ header_ustar(struct archive_read *a, struct tar *tar,
header = (const struct archive_entry_header_ustar *)h;
/* Copy name into an internal buffer to ensure null-termination. */
- as = &(tar->entry_name);
+ as = &(tar->entry_pathname);
if (header->prefix[0]) {
archive_strncpy(as, header->prefix, sizeof(header->prefix));
if (as->s[archive_strlen(as) - 1] != '/')
@@ -1134,7 +1134,7 @@ header_ustar(struct archive_read *a, struct tar *tar,
} else
archive_strncpy(as, header->name, sizeof(header->name));
- archive_entry_set_pathname(entry, as->s);
+ archive_entry_copy_pathname(entry, as->s);
/* Handle rest of common fields. */
header_common(a, tar, entry, h);
@@ -1142,11 +1142,11 @@ header_ustar(struct archive_read *a, struct tar *tar,
/* Handle POSIX ustar fields. */
archive_strncpy(&(tar->entry_uname), header->uname,
sizeof(header->uname));
- archive_entry_set_uname(entry, tar->entry_uname.s);
+ archive_entry_copy_uname(entry, tar->entry_uname.s);
archive_strncpy(&(tar->entry_gname), header->gname,
sizeof(header->gname));
- archive_entry_set_gname(entry, tar->entry_gname.s);
+ archive_entry_copy_gname(entry, tar->entry_gname.s);
/* Parse out device numbers only for char and block specials. */
if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
@@ -1173,10 +1173,16 @@ pax_header(struct archive_read *a, struct tar *tar,
{
size_t attr_length, l, line_length;
char *line, *p;
- wchar_t *key, *wp, *value;
+ char *key, *value;
+ wchar_t *wp;
int err, err2;
attr_length = strlen(attr);
+ tar->pax_hdrcharset_binary = 0;
+ archive_string_empty(&(tar->entry_gname));
+ archive_string_empty(&(tar->entry_linkpath));
+ archive_string_empty(&(tar->entry_pathname));
+ archive_string_empty(&(tar->entry_uname));
err = ARCHIVE_OK;
while (attr_length > 0) {
/* Parse decimal length field at start of line. */
@@ -1219,49 +1225,24 @@ pax_header(struct archive_read *a, struct tar *tar,
return (ARCHIVE_WARN);
}
- /* Ensure pax_entry buffer is big enough. */
- if (tar->pax_entry_length <= line_length) {
- wchar_t *old_entry = tar->pax_entry;
-
- if (tar->pax_entry_length <= 0)
- tar->pax_entry_length = 1024;
- while (tar->pax_entry_length <= line_length + 1)
- tar->pax_entry_length *= 2;
-
- old_entry = tar->pax_entry;
- tar->pax_entry = (wchar_t *)realloc(tar->pax_entry,
- tar->pax_entry_length * sizeof(wchar_t));
- if (tar->pax_entry == NULL) {
- free(old_entry);
- archive_set_error(&a->archive, ENOMEM,
- "No memory");
- return (ARCHIVE_FATAL);
- }
- }
-
- /* Decode UTF-8 to wchar_t, null-terminate result. */
- if (utf8_decode(tar->pax_entry, p,
- line_length - (p - attr) - 1)) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Invalid UTF8 character in pax extended attribute");
- err = err_combine(err, ARCHIVE_WARN);
- }
+ /* Null-terminate the line. */
+ attr[line_length - 1] = '\0';
- /* Null-terminate 'key' value. */
- wp = key = tar->pax_entry;
- if (key[0] == L'=')
+ /* Find end of key and null terminate it. */
+ key = p;
+ if (key[0] == '=')
return (-1);
- while (*wp && *wp != L'=')
- ++wp;
- if (*wp == L'\0') {
+ while (*p && *p != '=')
+ ++p;
+ if (*p == '\0') {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Invalid pax extended attributes");
return (ARCHIVE_WARN);
}
- *wp = 0;
+ *p = '\0';
/* Identify null-terminated 'value' portion. */
- value = wp + 1;
+ value = p + 1;
/* Identify this attribute and set it in the entry. */
err2 = pax_attribute(tar, entry, key, value);
@@ -1271,33 +1252,77 @@ pax_header(struct archive_read *a, struct tar *tar,
attr += line_length;
attr_length -= line_length;
}
+ if (archive_strlen(&(tar->entry_gname)) > 0) {
+ value = tar->entry_gname.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_gname(entry, value);
+ else {
+ wp = utf8_decode(tar, value, strlen(value));
+ if (wp == NULL)
+ archive_entry_copy_gname(entry, value);
+ else
+ archive_entry_copy_gname_w(entry, wp);
+ }
+ }
+ if (archive_strlen(&(tar->entry_linkpath)) > 0) {
+ value = tar->entry_linkpath.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_link(entry, value);
+ else {
+ wp = utf8_decode(tar, value, strlen(value));
+ if (wp == NULL)
+ archive_entry_copy_link(entry, value);
+ else
+ archive_entry_copy_link_w(entry, wp);
+ }
+ }
+ if (archive_strlen(&(tar->entry_pathname)) > 0) {
+ value = tar->entry_pathname.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_pathname(entry, value);
+ else {
+ wp = utf8_decode(tar, value, strlen(value));
+ if (wp == NULL)
+ archive_entry_copy_pathname(entry, value);
+ else
+ archive_entry_copy_pathname_w(entry, wp);
+ }
+ }
+ if (archive_strlen(&(tar->entry_uname)) > 0) {
+ value = tar->entry_uname.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_uname(entry, value);
+ else {
+ wp = utf8_decode(tar, value, strlen(value));
+ if (wp == NULL)
+ archive_entry_copy_uname(entry, value);
+ else
+ archive_entry_copy_uname_w(entry, wp);
+ }
+ }
return (err);
}
static int
pax_attribute_xattr(struct archive_entry *entry,
- wchar_t *name, wchar_t *value)
+ char *name, char *value)
{
- char *name_decoded, *name_narrow;
+ char *name_decoded;
void *value_decoded;
size_t value_len;
- if (wcslen(name) < 18 || (wcsncmp(name, L"LIBARCHIVE.xattr.", 17)) != 0)
+ if (strlen(name) < 18 || (strncmp(name, "LIBARCHIVE.xattr.", 17)) != 0)
return 3;
name += 17;
/* URL-decode name */
- name_narrow = wide_to_narrow(name);
- if (name_narrow == NULL)
- return 2;
- name_decoded = url_decode(name_narrow);
- free(name_narrow);
+ name_decoded = url_decode(name);
if (name_decoded == NULL)
return 2;
/* Base-64 decode value */
- value_decoded = base64_decode(value, wcslen(value), &value_len);
+ value_decoded = base64_decode(value, strlen(value), &value_len);
if (value_decoded == NULL) {
free(name_decoded);
return 1;
@@ -1326,22 +1351,23 @@ pax_attribute_xattr(struct archive_entry *entry,
*/
static int
pax_attribute(struct tar *tar, struct archive_entry *entry,
- wchar_t *key, wchar_t *value)
+ char *key, char *value)
{
int64_t s;
long n;
+ wchar_t *wp;
switch (key[0]) {
case 'G':
/* GNU "0.0" sparse pax format. */
- if (wcscmp(key, L"GNU.sparse.numblocks") == 0) {
+ if (strcmp(key, "GNU.sparse.numblocks") == 0) {
tar->sparse_offset = -1;
tar->sparse_numbytes = -1;
tar->sparse_gnu_major = 0;
tar->sparse_gnu_minor = 0;
}
- if (wcscmp(key, L"GNU.sparse.offset") == 0) {
- tar->sparse_offset = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.offset") == 0) {
+ tar->sparse_offset = tar_atol10(value, strlen(value));
if (tar->sparse_numbytes != -1) {
gnu_add_sparse_entry(tar,
tar->sparse_offset, tar->sparse_numbytes);
@@ -1349,8 +1375,8 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
tar->sparse_numbytes = -1;
}
}
- if (wcscmp(key, L"GNU.sparse.numbytes") == 0) {
- tar->sparse_numbytes = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.numbytes") == 0) {
+ tar->sparse_numbytes = tar_atol10(value, strlen(value));
if (tar->sparse_numbytes != -1) {
gnu_add_sparse_entry(tar,
tar->sparse_offset, tar->sparse_numbytes);
@@ -1358,13 +1384,13 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
tar->sparse_numbytes = -1;
}
}
- if (wcscmp(key, L"GNU.sparse.size") == 0) {
- tar->realsize = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.size") == 0) {
+ tar->realsize = tar_atol10(value, strlen(value));
archive_entry_set_size(entry, tar->realsize);
}
/* GNU "0.1" sparse pax format. */
- if (wcscmp(key, L"GNU.sparse.map") == 0) {
+ if (strcmp(key, "GNU.sparse.map") == 0) {
tar->sparse_gnu_major = 0;
tar->sparse_gnu_minor = 1;
if (gnu_sparse_01_parse(tar, value) != ARCHIVE_OK)
@@ -1372,18 +1398,23 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
}
/* GNU "1.0" sparse pax format */
- if (wcscmp(key, L"GNU.sparse.major") == 0) {
- tar->sparse_gnu_major = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.major") == 0) {
+ tar->sparse_gnu_major = tar_atol10(value, strlen(value));
tar->sparse_gnu_pending = 1;
}
- if (wcscmp(key, L"GNU.sparse.minor") == 0) {
- tar->sparse_gnu_minor = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.minor") == 0) {
+ tar->sparse_gnu_minor = tar_atol10(value, strlen(value));
tar->sparse_gnu_pending = 1;
}
- if (wcscmp(key, L"GNU.sparse.name") == 0)
- archive_entry_copy_pathname_w(entry, value);
- if (wcscmp(key, L"GNU.sparse.realsize") == 0) {
- tar->realsize = tar_atol10(value, wcslen(value));
+ if (strcmp(key, "GNU.sparse.name") == 0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ if (wp != NULL)
+ archive_entry_copy_pathname_w(entry, wp);
+ else
+ archive_entry_copy_pathname(entry, value);
+ }
+ if (strcmp(key, "GNU.sparse.realsize") == 0) {
+ tar->realsize = tar_atol10(value, strlen(value));
archive_entry_set_size(entry, tar->realsize);
}
break;
@@ -1394,85 +1425,107 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
if (strcmp(key, "LIBARCHIVE.xxxxxxx")==0)
archive_entry_set_xxxxxx(entry, value);
*/
- if (wcsncmp(key, L"LIBARCHIVE.xattr.", 17)==0)
+ if (strncmp(key, "LIBARCHIVE.xattr.", 17)==0)
pax_attribute_xattr(entry, key, value);
break;
case 'S':
/* We support some keys used by the "star" archiver */
- if (wcscmp(key, L"SCHILY.acl.access")==0)
- __archive_entry_acl_parse_w(entry, value,
+ if (strcmp(key, "SCHILY.acl.access")==0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ /* TODO: if (wp == NULL) */
+ __archive_entry_acl_parse_w(entry, wp,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
- else if (wcscmp(key, L"SCHILY.acl.default")==0)
- __archive_entry_acl_parse_w(entry, value,
+ } else if (strcmp(key, "SCHILY.acl.default")==0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ /* TODO: if (wp == NULL) */
+ __archive_entry_acl_parse_w(entry, wp,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
- else if (wcscmp(key, L"SCHILY.devmajor")==0)
- archive_entry_set_rdevmajor(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"SCHILY.devminor")==0)
- archive_entry_set_rdevminor(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"SCHILY.fflags")==0)
- archive_entry_copy_fflags_text_w(entry, value);
- else if (wcscmp(key, L"SCHILY.dev")==0)
- archive_entry_set_dev(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"SCHILY.ino")==0)
- archive_entry_set_ino(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"SCHILY.nlink")==0)
- archive_entry_set_nlink(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"SCHILY.realsize")==0) {
- tar->realsize = tar_atol10(value, wcslen(value));
+ } else if (strcmp(key, "SCHILY.devmajor")==0) {
+ archive_entry_set_rdevmajor(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.devminor")==0) {
+ archive_entry_set_rdevminor(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.fflags")==0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ /* TODO: if (wp == NULL) */
+ archive_entry_copy_fflags_text_w(entry, wp);
+ } else if (strcmp(key, "SCHILY.dev")==0) {
+ archive_entry_set_dev(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.ino")==0) {
+ archive_entry_set_ino(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.nlink")==0) {
+ archive_entry_set_nlink(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.realsize")==0) {
+ tar->realsize = tar_atol10(value, strlen(value));
archive_entry_set_size(entry, tar->realsize);
}
break;
case 'a':
- if (wcscmp(key, L"atime")==0) {
+ if (strcmp(key, "atime")==0) {
pax_time(value, &s, &n);
archive_entry_set_atime(entry, s, n);
}
break;
case 'c':
- if (wcscmp(key, L"ctime")==0) {
+ if (strcmp(key, "ctime")==0) {
pax_time(value, &s, &n);
archive_entry_set_ctime(entry, s, n);
- } else if (wcscmp(key, L"charset")==0) {
+ } else if (strcmp(key, "charset")==0) {
/* TODO: Publish charset information in entry. */
- } else if (wcscmp(key, L"comment")==0) {
+ } else if (strcmp(key, "comment")==0) {
/* TODO: Publish comment in entry. */
}
break;
case 'g':
- if (wcscmp(key, L"gid")==0)
- archive_entry_set_gid(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"gname")==0)
- archive_entry_copy_gname_w(entry, value);
+ if (strcmp(key, "gid")==0) {
+ archive_entry_set_gid(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "gname")==0) {
+ archive_strcpy(&(tar->entry_gname), value);
+ }
+ break;
+ case 'h':
+ if (strcmp(key, "hdrcharset") == 0) {
+ if (strcmp(value, "BINARY") == 0)
+ tar->pax_hdrcharset_binary = 1;
+ else if (strcmp(value, "ISO-IR 10646 2000 UTF-8") == 0)
+ tar->pax_hdrcharset_binary = 0;
+ else {
+ /* TODO: Warn about unsupported hdrcharset */
+ }
+ }
break;
case 'l':
/* pax interchange doesn't distinguish hardlink vs. symlink. */
- if (wcscmp(key, L"linkpath")==0) {
- if (archive_entry_hardlink(entry))
- archive_entry_copy_hardlink_w(entry, value);
- else
- archive_entry_copy_symlink_w(entry, value);
+ if (strcmp(key, "linkpath")==0) {
+ archive_strcpy(&(tar->entry_linkpath), value);
}
break;
case 'm':
- if (wcscmp(key, L"mtime")==0) {
+ if (strcmp(key, "mtime")==0) {
pax_time(value, &s, &n);
archive_entry_set_mtime(entry, s, n);
}
break;
case 'p':
- if (wcscmp(key, L"path")==0)
- archive_entry_copy_pathname_w(entry, value);
+ if (strcmp(key, "path")==0) {
+ archive_strcpy(&(tar->entry_pathname), value);
+ }
break;
case 'r':
/* POSIX has reserved 'realtime.*' */
break;
case 's':
/* POSIX has reserved 'security.*' */
- /* Someday: if (wcscmp(key, L"security.acl")==0) { ... } */
- if (wcscmp(key, L"size")==0) {
+ /* Someday: if (strcmp(key, "security.acl")==0) { ... } */
+ if (strcmp(key, "size")==0) {
/* "size" is the size of the data in the entry. */
tar->entry_bytes_remaining
- = tar_atol10(value, wcslen(value));
+ = tar_atol10(value, strlen(value));
/*
* But, "size" is not necessarily the size of
* the file on disk; if this is a sparse file,
@@ -1490,10 +1543,12 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
}
break;
case 'u':
- if (wcscmp(key, L"uid")==0)
- archive_entry_set_uid(entry, tar_atol10(value, wcslen(value)));
- else if (wcscmp(key, L"uname")==0)
- archive_entry_copy_uname_w(entry, value);
+ if (strcmp(key, "uid")==0) {
+ archive_entry_set_uid(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "uname")==0) {
+ archive_strcpy(&(tar->entry_uname), value);
+ }
break;
}
return (0);
@@ -1505,7 +1560,7 @@ pax_attribute(struct tar *tar, struct archive_entry *entry,
* parse a decimal time value, which may include a fractional portion
*/
static void
-pax_time(const wchar_t *p, int64_t *ps, long *pn)
+pax_time(const char *p, int64_t *ps, long *pn)
{
char digit;
int64_t s;
@@ -1573,9 +1628,9 @@ header_gnutar(struct archive_read *a, struct tar *tar,
/* Copy filename over (to ensure null termination). */
header = (const struct archive_entry_header_gnutar *)h;
- archive_strncpy(&(tar->entry_name), header->name,
+ archive_strncpy(&(tar->entry_pathname), header->name,
sizeof(header->name));
- archive_entry_set_pathname(entry, tar->entry_name.s);
+ archive_entry_copy_pathname(entry, tar->entry_pathname.s);
/* Fields common to ustar and GNU */
/* XXX Can the following be factored out since it's common
@@ -1583,11 +1638,11 @@ header_gnutar(struct archive_read *a, struct tar *tar,
* header_common, perhaps? */
archive_strncpy(&(tar->entry_uname),
header->uname, sizeof(header->uname));
- archive_entry_set_uname(entry, tar->entry_uname.s);
+ archive_entry_copy_uname(entry, tar->entry_uname.s);
archive_strncpy(&(tar->entry_gname),
header->gname, sizeof(header->gname));
- archive_entry_set_gname(entry, tar->entry_gname.s);
+ archive_entry_copy_gname(entry, tar->entry_gname.s);
/* Parse out device numbers only for char and block specials */
if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
@@ -1741,9 +1796,9 @@ gnu_sparse_old_parse(struct tar *tar,
*/
static int
-gnu_sparse_01_parse(struct tar *tar, const wchar_t *p)
+gnu_sparse_01_parse(struct tar *tar, const char *p)
{
- const wchar_t *e;
+ const char *e;
off_t offset = -1, size = -1;
for (;;) {
@@ -1778,12 +1833,11 @@ gnu_sparse_01_parse(struct tar *tar, const wchar_t *p)
* don't support this format will extract the block map along with the
* data and a separate post-process can restore the sparseness.
*
- * Unfortunately, GNU tar 1.16 adds bogus padding to the end of the
- * entry that depends on the size of the map; this means we have to
- * parse the sparse map when we read the header (otherwise, entry_skip
- * will fail). This is why sparse_10_read is called from read_header
- * above, instead of at the beginning of read_data, where it "should"
- * go.
+ * Unfortunately, GNU tar 1.16 had a bug that added unnecessary
+ * padding to the body of the file when using this format. GNU tar
+ * 1.17 corrected this bug without bumping the version number, so
+ * it's not possible to support both variants. This code supports
+ * the later variant at the expense of not supporting the former.
*
* This variant also replaced GNU.sparse.size with GNU.sparse.realsize
* and introduced the GNU.sparse.major/GNU.sparse.minor attributes.
@@ -1947,7 +2001,7 @@ tar_atol8(const char *p, unsigned char_cnt)
* it does obey locale.
*/
static int64_t
-tar_atol10(const wchar_t *p, unsigned char_cnt)
+tar_atol10(const char *p, unsigned char_cnt)
{
int64_t l, limit, last_digit_limit;
int base, digit, sign;
@@ -1980,10 +2034,7 @@ tar_atol10(const wchar_t *p, unsigned char_cnt)
/*
* Parse a base-256 integer. This is just a straight signed binary
* value in big-endian order, except that the high-order bit is
- * ignored. Remember that "int64_t" may or may not be exactly 64
- * bits; the implementation here tries to avoid making any assumptions
- * about the actual size of an int64_t. It does assume we're using
- * twos-complement arithmetic, though.
+ * ignored.
*/
static int64_t
tar_atol256(const char *_p, unsigned char_cnt)
@@ -2081,15 +2132,38 @@ readline(struct archive_read *a, struct tar *tar, const char **start,
}
}
-static int
-utf8_decode(wchar_t *dest, const char *src, size_t length)
+static wchar_t *
+utf8_decode(struct tar *tar, const char *src, size_t length)
{
- size_t n;
+ wchar_t *dest;
+ ssize_t n;
int err;
+ /* Ensure pax_entry buffer is big enough. */
+ if (tar->pax_entry_length <= length) {
+ wchar_t *old_entry = tar->pax_entry;
+
+ if (tar->pax_entry_length <= 0)
+ tar->pax_entry_length = 1024;
+ while (tar->pax_entry_length <= length + 1)
+ tar->pax_entry_length *= 2;
+
+ old_entry = tar->pax_entry;
+ tar->pax_entry = (wchar_t *)realloc(tar->pax_entry,
+ tar->pax_entry_length * sizeof(wchar_t));
+ if (tar->pax_entry == NULL) {
+ free(old_entry);
+ /* TODO: Handle this error. */
+ return (NULL);
+ }
+ }
+
+ dest = tar->pax_entry;
err = 0;
while (length > 0) {
n = UTF8_mbrtowc(dest, src, length);
+ if (n < 0)
+ return (NULL);
if (n == 0)
break;
dest++;
@@ -2097,13 +2171,13 @@ utf8_decode(wchar_t *dest, const char *src, size_t length)
length -= n;
}
*dest++ = L'\0';
- return (err);
+ return (tar->pax_entry);
}
/*
* Copied and simplified from FreeBSD libc/locale.
*/
-static size_t
+static ssize_t
UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n)
{
int ch, i, len, mask;
@@ -2130,22 +2204,14 @@ UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n)
} else if ((ch & 0xf8) == 0xf0) {
mask = 0x07;
len = 4;
- } else if ((ch & 0xfc) == 0xf8) {
- mask = 0x03;
- len = 5;
- } else if ((ch & 0xfe) == 0xfc) {
- mask = 0x01;
- len = 6;
} else {
- /* Invalid first byte; convert to '?' */
- *pwc = '?';
- return (1);
+ /* Invalid first byte. */
+ return (-1);
}
if (n < (size_t)len) {
- /* Invalid first byte; convert to '?' */
- *pwc = '?';
- return (1);
+ /* Valid first byte but truncated. */
+ return (-2);
}
/*
@@ -2191,7 +2257,7 @@ UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n)
* omits line breaks; RFC1341 used for MIME requires both.)
*/
static char *
-base64_decode(const wchar_t *src, size_t len, size_t *out_len)
+base64_decode(const char *s, size_t len, size_t *out_len)
{
static const unsigned char digits[64] = {
'A','B','C','D','E','F','G','H','I','J','K','L','M','N',
@@ -2201,6 +2267,7 @@ base64_decode(const wchar_t *src, size_t len, size_t *out_len)
'4','5','6','7','8','9','+','/' };
static unsigned char decode_table[128];
char *out, *d;
+ const unsigned char *src = (const unsigned char *)s;
/* If the decode table is not yet initialized, prepare it. */
if (decode_table[digits[1]] != 1) {
@@ -2261,43 +2328,6 @@ base64_decode(const wchar_t *src, size_t len, size_t *out_len)
return (out);
}
-/*
- * This is a little tricky because the C99 standard wcstombs()
- * function returns the number of bytes that were converted,
- * not the number that should be converted. As a result,
- * we can never accurately size the output buffer (without
- * doing a tedious output size calculation in advance).
- * This approach (try a conversion, then try again if it fails)
- * will almost always succeed on the first try, and is thus
- * much faster, at the cost of sometimes requiring multiple
- * passes while we expand the buffer.
- */
-static char *
-wide_to_narrow(const wchar_t *wval)
-{
- int converted_length;
- /* Guess an output buffer size and try the conversion. */
- int alloc_length = wcslen(wval) * 3;
- char *mbs_val = (char *)malloc(alloc_length + 1);
- if (mbs_val == NULL)
- return (NULL);
- converted_length = wcstombs(mbs_val, wval, alloc_length);
-
- /* If we exhausted the buffer, resize and try again. */
- while (converted_length >= alloc_length) {
- free(mbs_val);
- alloc_length *= 2;
- mbs_val = (char *)malloc(alloc_length + 1);
- if (mbs_val == NULL)
- return (NULL);
- converted_length = wcstombs(mbs_val, wval, alloc_length);
- }
-
- /* Ensure a trailing null and return the final string. */
- mbs_val[alloc_length] = '\0';
- return (mbs_val);
-}
-
static char *
url_decode(const char *in)
{
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
index f5d97adb064..09e7411be86 100644
--- a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.15 2007/10/12 04:08:28 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.21 2008/02/26 07:17:47 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_support_format_zip.c,v 1.15
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_read_private.h"
+#include "archive_endian.h"
struct zip {
/* entry_bytes_remaining is the number of bytes we expect. */
@@ -121,11 +122,6 @@ static int archive_read_format_zip_read_data(struct archive_read *,
static int archive_read_format_zip_read_data_skip(struct archive_read *a);
static int archive_read_format_zip_read_header(struct archive_read *,
struct archive_entry *);
-static int i2(const char *);
-static int i4(const char *);
-static unsigned int u2(const char *);
-static unsigned int u4(const char *);
-static uint64_t u8(const char *);
static int zip_read_data_deflate(struct archive_read *a, const void **buff,
size_t *size, off_t *offset);
static int zip_read_data_none(struct archive_read *a, const void **buff,
@@ -166,18 +162,12 @@ archive_read_support_format_zip(struct archive *_a)
static int
archive_read_format_zip_bid(struct archive_read *a)
{
- int bytes_read;
- int bid = 0;
- const void *h;
const char *p;
+ const void *buff;
+ size_t bytes_avail;
- if (a->archive.archive_format == ARCHIVE_FORMAT_ZIP)
- bid += 1;
-
- bytes_read = (a->decompressor->read_ahead)(a, &h, 4);
- if (bytes_read < 4)
- return (-1);
- p = (const char *)h;
+ if ((p = __archive_read_ahead(a, 4)) == NULL)
+ return (-1);
/*
* Bid of 30 here is: 16 bits for "PK",
@@ -188,20 +178,116 @@ archive_read_format_zip_bid(struct archive_read *a)
if ((p[2] == '\001' && p[3] == '\002')
|| (p[2] == '\003' && p[3] == '\004')
|| (p[2] == '\005' && p[3] == '\006')
- || (p[2] == '\007' && p[3] == '\010'))
+ || (p[2] == '\007' && p[3] == '\010')
+ || (p[2] == '0' && p[3] == '0'))
return (30);
}
+
+ /*
+ * Attempt to handle self-extracting archives
+ * by noting a PE header and searching forward
+ * up to 64k for a 'PK\003\004' marker.
+ */
+ if (p[0] == 'M' && p[1] == 'Z') {
+ /*
+ * TODO: Additional checks that this really is a PE
+ * file before we invoke the 128k lookahead below.
+ * No point in allocating a bigger lookahead buffer
+ * if we don't need to.
+ */
+ /*
+ * TODO: Of course, the compression layer lookahead
+ * buffers aren't dynamically sized yet; they should be.
+ */
+ bytes_avail = (a->decompressor->read_ahead)(a, &buff, 128*1024);
+ p = (const char *)buff;
+
+ /*
+ * TODO: Optimize by jumping forward based on values
+ * in the PE header. Note that we don't need to be
+ * exact, but we mustn't skip too far. The search
+ * below will compensate if we undershoot. Skipping
+ * will also reduce the chance of false positives
+ * (which is not really all that high to begin with,
+ * so maybe skipping isn't really necessary).
+ */
+
+ while (p < bytes_avail + (const char *)buff) {
+ if (p[0] == 'P' && p[1] == 'K' /* "PK" signature */
+ && p[2] == 3 && p[3] == 4 /* File entry */
+ && p[8] == 8 /* compression == deflate */
+ && p[9] == 0 /* High byte of compression */
+ )
+ {
+ return (30);
+ }
+ ++p;
+ }
+ }
+
return (0);
}
+/*
+ * Search forward for a "PK\003\004" file header. This handles the
+ * case of self-extracting archives, where there is an executable
+ * prepended to the ZIP archive.
+ */
+static int
+skip_sfx(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip, bytes;
+
+ /*
+ * TODO: We should be able to skip forward by a bunch
+ * by lifting some values from the PE header. We don't
+ * need to be exact (we're still going to search forward
+ * to find the header), but it will speed things up and
+ * reduce the chance of a false positive.
+ */
+ for (;;) {
+ bytes = (a->decompressor->read_ahead)(a, &h, 4096);
+ if (bytes < 4)
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /*
+ * Scan ahead until we find something that looks
+ * like the zip header.
+ */
+ while (p + 4 < q) {
+ switch (p[3]) {
+ case '\004':
+ /* TODO: Additional verification here. */
+ if (memcmp("PK\003\004", p, 4) == 0) {
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ return (ARCHIVE_OK);
+ }
+ p += 4;
+ break;
+ case '\003': p += 1; break;
+ case 'K': p += 2; break;
+ case 'P': p += 3; break;
+ default: p += 4; break;
+ }
+ }
+ skip = p - (const char *)h;
+ (a->decompressor->consume)(a, skip);
+ }
+}
+
static int
archive_read_format_zip_read_header(struct archive_read *a,
struct archive_entry *entry)
{
- int bytes_read;
const void *h;
const char *signature;
struct zip *zip;
+ int r = ARCHIVE_OK, r1;
a->archive.archive_format = ARCHIVE_FORMAT_ZIP;
if (a->archive.archive_format_name == NULL)
@@ -213,17 +299,43 @@ archive_read_format_zip_read_header(struct archive_read *a,
zip->end_of_entry_cleanup = 0;
zip->entry_uncompressed_bytes_read = 0;
zip->entry_compressed_bytes_read = 0;
- bytes_read = (a->decompressor->read_ahead)(a, &h, 4);
- if (bytes_read < 4)
+ if ((h = __archive_read_ahead(a, 4)) == NULL)
return (ARCHIVE_FATAL);
signature = (const char *)h;
+ if (signature[0] == 'M' && signature[1] == 'Z') {
+ /* This is an executable? Must be self-extracting... */
+ r = skip_sfx(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
+ if ((h = __archive_read_ahead(a, 4)) == NULL)
+ return (ARCHIVE_FATAL);
+ signature = (const char *)h;
+ }
+
if (signature[0] != 'P' || signature[1] != 'K') {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Bad ZIP file");
return (ARCHIVE_FATAL);
}
+ /*
+ * "PK00" signature is used for "split" archives that
+ * only have a single segment. This means we can just
+ * skip the PK00; the first real file header should follow.
+ */
+ if (signature[2] == '0' && signature[3] == '0') {
+ (a->decompressor->consume)(a, 4);
+ if ((h = __archive_read_ahead(a, 4)) == NULL)
+ return (ARCHIVE_FATAL);
+ signature = (const char *)h;
+ if (signature[0] != 'P' || signature[1] != 'K') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Bad ZIP file");
+ return (ARCHIVE_FATAL);
+ }
+ }
+
if (signature[2] == '\001' && signature[3] == '\002') {
/* Beginning of central directory. */
return (ARCHIVE_EOF);
@@ -231,7 +343,10 @@ archive_read_format_zip_read_header(struct archive_read *a,
if (signature[2] == '\003' && signature[3] == '\004') {
/* Regular file entry. */
- return (zip_read_file_header(a, entry, zip));
+ r1 = zip_read_file_header(a, entry, zip);
+ if (r1 != ARCHIVE_OK)
+ return (r1);
+ return (r);
}
if (signature[2] == '\005' && signature[3] == '\006') {
@@ -261,21 +376,17 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
{
const struct zip_file_header *p;
const void *h;
- int bytes_read;
- bytes_read =
- (a->decompressor->read_ahead)(a, &h, sizeof(struct zip_file_header));
- if (bytes_read < (int)sizeof(struct zip_file_header)) {
+ if ((p = __archive_read_ahead(a, sizeof *p)) == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP file header");
return (ARCHIVE_FATAL);
}
- p = (const struct zip_file_header *)h;
zip->version = p->version[0];
zip->system = p->version[1];
- zip->flags = i2(p->flags);
- zip->compression = i2(p->compression);
+ zip->flags = archive_le16dec(p->flags);
+ zip->compression = archive_le16dec(p->compression);
if (zip->compression <
sizeof(compression_names)/sizeof(compression_names[0]))
zip->compression_name = compression_names[zip->compression];
@@ -287,25 +398,24 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->mode = 0;
zip->uid = 0;
zip->gid = 0;
- zip->crc32 = i4(p->crc32);
- zip->filename_length = i2(p->filename_length);
- zip->extra_length = i2(p->extra_length);
- zip->uncompressed_size = u4(p->uncompressed_size);
- zip->compressed_size = u4(p->compressed_size);
+ zip->crc32 = archive_le32dec(p->crc32);
+ zip->filename_length = archive_le16dec(p->filename_length);
+ zip->extra_length = archive_le16dec(p->extra_length);
+ zip->uncompressed_size = archive_le32dec(p->uncompressed_size);
+ zip->compressed_size = archive_le32dec(p->compressed_size);
(a->decompressor->consume)(a, sizeof(struct zip_file_header));
/* Read the filename. */
- bytes_read = (a->decompressor->read_ahead)(a, &h, zip->filename_length);
- if (bytes_read < zip->filename_length) {
+ if ((h = __archive_read_ahead(a, zip->filename_length)) == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP file header");
return (ARCHIVE_FATAL);
}
if (archive_string_ensure(&zip->pathname, zip->filename_length) == NULL)
__archive_errx(1, "Out of memory");
- archive_strncpy(&zip->pathname, (const char *)h, zip->filename_length);
+ archive_strncpy(&zip->pathname, h, zip->filename_length);
(a->decompressor->consume)(a, zip->filename_length);
archive_entry_set_pathname(entry, zip->pathname.s);
@@ -315,8 +425,7 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->mode = AE_IFREG | 0777;
/* Read the extra data. */
- bytes_read = (a->decompressor->read_ahead)(a, &h, zip->extra_length);
- if (bytes_read < zip->extra_length) {
+ if ((h = __archive_read_ahead(a, zip->extra_length)) == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP file header");
return (ARCHIVE_FATAL);
@@ -337,7 +446,8 @@ zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
zip->entry_offset = 0;
/* If there's no body, force read_data() to return EOF immediately. */
- if (zip->entry_bytes_remaining < 1)
+ if (0 == (zip->flags & ZIP_LENGTH_AT_END)
+ && zip->entry_bytes_remaining < 1)
zip->end_of_entry = 1;
/* Set up a more descriptive format name. */
@@ -386,21 +496,18 @@ archive_read_format_zip_read_data(struct archive_read *a,
if (zip->end_of_entry) {
if (!zip->end_of_entry_cleanup) {
if (zip->flags & ZIP_LENGTH_AT_END) {
- const void *h;
const char *p;
- int bytes_read =
- (a->decompressor->read_ahead)(a, &h, 16);
- if (bytes_read < 16) {
+
+ if ((p = __archive_read_ahead(a, 16)) == NULL) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
"Truncated ZIP end-of-file record");
return (ARCHIVE_FATAL);
}
- p = (const char *)h;
- zip->crc32 = i4(p + 4);
- zip->compressed_size = u4(p + 8);
- zip->uncompressed_size = u4(p + 12);
- bytes_read = (a->decompressor->consume)(a, 16);
+ zip->crc32 = archive_le32dec(p + 4);
+ zip->compressed_size = archive_le32dec(p + 8);
+ zip->uncompressed_size = archive_le32dec(p + 12);
+ (a->decompressor->consume)(a, 16);
}
/* Check file size, CRC against these values. */
@@ -695,37 +802,6 @@ archive_read_format_zip_cleanup(struct archive_read *a)
return (ARCHIVE_OK);
}
-static int
-i2(const char *p)
-{
- return ((0xff & (int)p[0]) + 256 * (0xff & (int)p[1]));
-}
-
-
-static int
-i4(const char *p)
-{
- return ((0xffff & i2(p)) + 0x10000 * (0xffff & i2(p+2)));
-}
-
-static unsigned int
-u2(const char *p)
-{
- return ((0xff & (unsigned int)p[0]) + 256 * (0xff & (unsigned int)p[1]));
-}
-
-static unsigned int
-u4(const char *p)
-{
- return u2(p) + 0x10000 * u2(p+2);
-}
-
-static uint64_t
-u8(const char *p)
-{
- return u4(p) + 0x100000000LL * u4(p+4);
-}
-
/*
* The extra data is stored as a list of
* id1+size1+data1 + id2+size2+data2 ...
@@ -738,8 +814,8 @@ process_extra(const void* extra, struct zip* zip)
const char *p = (const char *)extra;
while (offset < zip->extra_length - 4)
{
- unsigned short headerid = u2(p + offset);
- unsigned short datasize = u2(p + offset + 2);
+ unsigned short headerid = archive_le16dec(p + offset);
+ unsigned short datasize = archive_le16dec(p + offset + 2);
offset += 4;
if (offset + datasize > zip->extra_length)
break;
@@ -751,9 +827,9 @@ process_extra(const void* extra, struct zip* zip)
case 0x0001:
/* Zip64 extended information extra field. */
if (datasize >= 8)
- zip->uncompressed_size = u8(p + offset);
+ zip->uncompressed_size = archive_le64dec(p + offset);
if (datasize >= 16)
- zip->compressed_size = u8(p + offset + 8);
+ zip->compressed_size = archive_le64dec(p + offset + 8);
break;
case 0x5455:
{
@@ -766,11 +842,12 @@ process_extra(const void* extra, struct zip* zip)
{
#ifdef DEBUG
fprintf(stderr, "mtime: %lld -> %d\n",
- (long long)zip->mtime, i4(p + offset));
+ (long long)zip->mtime,
+ archive_le32dec(p + offset));
#endif
if (datasize < 4)
break;
- zip->mtime = i4(p + offset);
+ zip->mtime = archive_le32dec(p + offset);
offset += 4;
datasize -= 4;
}
@@ -778,7 +855,7 @@ process_extra(const void* extra, struct zip* zip)
{
if (datasize < 4)
break;
- zip->atime = i4(p + offset);
+ zip->atime = archive_le32dec(p + offset);
offset += 4;
datasize -= 4;
}
@@ -786,7 +863,7 @@ process_extra(const void* extra, struct zip* zip)
{
if (datasize < 4)
break;
- zip->ctime = i4(p + offset);
+ zip->ctime = archive_le32dec(p + offset);
offset += 4;
datasize -= 4;
}
@@ -796,12 +873,13 @@ process_extra(const void* extra, struct zip* zip)
/* Info-ZIP Unix Extra Field (type 2) "Ux". */
#ifdef DEBUG
fprintf(stderr, "uid %d gid %d\n",
- i2(p + offset), i2(p + offset + 2));
+ archive_le16dec(p + offset),
+ archive_le16dec(p + offset + 2));
#endif
if (datasize >= 2)
- zip->uid = i2(p + offset);
+ zip->uid = archive_le16dec(p + offset);
if (datasize >= 4)
- zip->gid = i2(p + offset + 2);
+ zip->gid = archive_le16dec(p + offset + 2);
break;
default:
break;
diff --git a/archivers/libarchive/files/libarchive/archive_util.c b/archivers/libarchive/files/libarchive/archive_util.c
index 2bc2844abcb..413199a360f 100644
--- a/archivers/libarchive/files/libarchive/archive_util.c
+++ b/archivers/libarchive/files/libarchive/archive_util.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.15 2007/07/06 15:36:38 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_util.c,v 1.16 2007/12/30 04:58:21 kientzle Exp $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.c b/archivers/libarchive/files/libarchive/archive_write_disk.c
index ec220869074..dfb6d35aec8 100644
--- a/archivers/libarchive/files/libarchive/archive_write_disk.c
+++ b/archivers/libarchive/files/libarchive/archive_write_disk.c
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.17 2007/09/21 04:52:42 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.22 2008/02/19 05:39:35 kientzle Exp $");
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
@@ -45,6 +45,9 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.17 2007/09/21 04
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
+#ifdef HAVE_SYS_UTIME_H
+#include <sys/utime.h>
+#endif
#ifdef HAVE_EXT2FS_EXT2_FS_H
#include <ext2fs/ext2_fs.h> /* for Linux file flags */
@@ -89,6 +92,10 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_disk.c,v 1.17 2007/09/21 04
#include "archive_entry.h"
#include "archive_private.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
struct fixup_entry {
struct fixup_entry *next;
mode_t mode;
@@ -171,6 +178,8 @@ struct archive_write_disk {
int fd;
/* Current offset for writing data to the file. */
off_t offset;
+ /* Maximum size of file. */
+ off_t filesize;
/* Dir we were in before this restore; only for deep paths. */
int restore_pwd;
/* Mode we should use for this entry; affected by _PERM and umask. */
@@ -302,6 +311,7 @@ _archive_write_header(struct archive *_a, struct archive_entry *entry)
a->offset = 0;
a->uid = a->user_uid;
a->mode = archive_entry_mode(a->entry);
+ a->filesize = archive_entry_size(a->entry);
archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry));
a->name = a->_name_data.s;
archive_clear_error(&a->archive);
@@ -425,8 +435,10 @@ _archive_write_header(struct archive *_a, struct archive_entry *entry)
* If it's not open, tell our client not to try writing.
* In particular, dirs, links, etc, don't get written to.
*/
- if (a->fd < 0)
+ if (a->fd < 0) {
archive_entry_set_size(entry, 0);
+ a->filesize = 0;
+ }
done:
/* Restore the user's umask before returning. */
umask(a->user_umask);
@@ -451,6 +463,7 @@ _archive_write_data_block(struct archive *_a,
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
ssize_t bytes_written = 0;
+ int r = ARCHIVE_OK;
__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_disk_block");
@@ -470,7 +483,13 @@ _archive_write_data_block(struct archive *_a,
}
/* Write the data. */
- while (size > 0) {
+ while (size > 0 && a->offset < a->filesize) {
+ if ((off_t)(a->offset + size) > a->filesize) {
+ size = (size_t)(a->filesize - a->offset);
+ archive_set_error(&a->archive, errno,
+ "Write request too large");
+ r = ARCHIVE_WARN;
+ }
bytes_written = write(a->fd, buff, size);
if (bytes_written < 0) {
archive_set_error(&a->archive, errno, "Write failed");
@@ -479,13 +498,14 @@ _archive_write_data_block(struct archive *_a,
size -= bytes_written;
a->offset += bytes_written;
}
- return (ARCHIVE_OK);
+ return (r);
}
static ssize_t
_archive_write_data(struct archive *_a, const void *buff, size_t size)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ off_t offset;
int r;
__archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
@@ -493,10 +513,11 @@ _archive_write_data(struct archive *_a, const void *buff, size_t size)
if (a->fd < 0)
return (ARCHIVE_OK);
+ offset = a->offset;
r = _archive_write_data_block(_a, buff, size, a->offset);
if (r < ARCHIVE_OK)
return (r);
- return (size);
+ return (a->offset - offset);
}
static int
@@ -622,7 +643,9 @@ archive_write_disk_new(void)
a->archive.vtable = archive_write_disk_vtable();
a->lookup_uid = trivial_lookup_uid;
a->lookup_gid = trivial_lookup_gid;
+#ifdef HAVE_GETEUID
a->user_uid = geteuid();
+#endif /* HAVE_GETEUID */
if (archive_string_ensure(&a->path_safe, 512) == NULL) {
free(a);
return (NULL);
@@ -653,7 +676,7 @@ edit_deep_directories(struct archive_write_disk *a)
return;
/* Try to record our starting dir. */
- a->restore_pwd = open(".", O_RDONLY);
+ a->restore_pwd = open(".", O_RDONLY | O_BINARY);
if (a->restore_pwd < 0)
return;
@@ -691,6 +714,14 @@ restore_entry(struct archive_write_disk *a)
int ret = ARCHIVE_OK, en;
if (a->flags & ARCHIVE_EXTRACT_UNLINK && !S_ISDIR(a->mode)) {
+ /*
+ * TODO: Fix this. Apparently, there are platforms
+ * that still allow root to hose the entire filesystem
+ * by unlinking a dir. The S_ISDIR() test above
+ * prevents us from using unlink() here if the new
+ * object is a dir, but that doesn't mean the old
+ * object isn't a dir.
+ */
if (unlink(a->name) == 0) {
/* We removed it, we're done. */
} else if (errno == ENOENT) {
@@ -829,8 +860,20 @@ create_filesystem_object(struct archive_write_disk *a)
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
linkname = archive_entry_hardlink(a->entry);
- if (linkname != NULL)
- return link(linkname, a->name) ? errno : 0;
+ if (linkname != NULL) {
+ r = link(linkname, a->name) ? errno : 0;
+ /*
+ * New cpio and pax formats allow hardlink entries
+ * to carry data, so we may have to open the file
+ * for hardlink entries.
+ */
+ if (r == 0 && a->filesize > 0) {
+ a->fd = open(a->name, O_WRONLY | O_TRUNC | O_BINARY);
+ if (a->fd < 0)
+ r = errno;
+ }
+ return (r);
+ }
linkname = archive_entry_symlink(a->entry);
if (linkname != NULL)
return symlink(linkname, a->name) ? errno : 0;
@@ -850,24 +893,38 @@ create_filesystem_object(struct archive_write_disk *a)
*/
mode = final_mode & 0777;
- switch (a->mode & S_IFMT) {
+ switch (a->mode & AE_IFMT) {
default:
/* POSIX requires that we fall through here. */
/* FALLTHROUGH */
- case S_IFREG:
+ case AE_IFREG:
a->fd = open(a->name,
- O_WRONLY | O_CREAT | O_EXCL, mode);
+ O_WRONLY | O_CREAT | O_EXCL | O_BINARY, mode);
r = (a->fd < 0);
break;
- case S_IFCHR:
+ case AE_IFCHR:
+#ifdef HAVE_MKNOD
+ /* Note: we use AE_IFCHR for the case label, and
+ * S_IFCHR for the mknod() call. This is correct. */
r = mknod(a->name, mode | S_IFCHR,
archive_entry_rdev(a->entry));
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a char device node. */
+ return (EINVAL);
+#endif /* HAVE_MKNOD */
break;
- case S_IFBLK:
+ case AE_IFBLK:
+#ifdef HAVE_MKNOD
r = mknod(a->name, mode | S_IFBLK,
archive_entry_rdev(a->entry));
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a block device node. */
+ return (EINVAL);
+#endif /* HAVE_MKNOD */
break;
- case S_IFDIR:
+ case AE_IFDIR:
mode = (mode | MINIMUM_DIR_MODE) & MAXIMUM_DIR_MODE;
r = mkdir(a->name, mode);
if (r == 0) {
@@ -880,8 +937,14 @@ create_filesystem_object(struct archive_write_disk *a)
a->todo &= ~TODO_MODE;
}
break;
- case S_IFIFO:
+ case AE_IFIFO:
+#ifdef HAVE_MKFIFO
r = mkfifo(a->name, mode);
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a fifo. */
+ return (EINVAL);
+#endif /* HAVE_MKFIFO */
break;
}
@@ -1427,28 +1490,34 @@ set_ownership(struct archive_write_disk *a)
}
#ifdef HAVE_FCHOWN
- if (a->fd >= 0 && fchown(a->fd, a->uid, a->gid) == 0)
- goto success;
+ /* If we have an fd, we can avoid a race. */
+ if (a->fd >= 0 && fchown(a->fd, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
#endif
+ /* We prefer lchown() but will use chown() if that's all we have. */
+ /* Of course, if we have neither, this will always fail. */
#ifdef HAVE_LCHOWN
- if (lchown(a->name, a->uid, a->gid) == 0)
- goto success;
-#else
- if (!S_ISLNK(a->mode) && chown(a->name, a->uid, a->gid) == 0)
- goto success;
+ if (lchown(a->name, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
+#elif HAVE_CHOWN
+ if (!S_ISLNK(a->mode) && chown(a->name, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
#endif
archive_set_error(&a->archive, errno,
"Can't set user=%d/group=%d for %s", a->uid, a->gid,
a->name);
return (ARCHIVE_WARN);
-success:
- a->todo &= ~TODO_OWNER;
- /* We know the user/group are correct now. */
- a->todo &= ~TODO_SGID_CHECK;
- a->todo &= ~TODO_SUID_CHECK;
- return (ARCHIVE_OK);
}
#ifdef HAVE_UTIMES
@@ -1786,7 +1855,7 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
/* If we weren't given an fd, open it ourselves. */
if (myfd < 0)
- myfd = open(name, O_RDONLY|O_NONBLOCK);
+ myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY);
if (myfd < 0)
return (ARCHIVE_OK);
diff --git a/archivers/libarchive/files/libarchive/archive_write_open_filename.c b/archivers/libarchive/files/libarchive/archive_write_open_filename.c
index fcaaaca4a68..72eeb54053d 100644
--- a/archivers/libarchive/files/libarchive/archive_write_open_filename.c
+++ b/archivers/libarchive/files/libarchive/archive_write_open_filename.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_filename.c,v 1.19 2007/01/09 08:05:56 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_filename.c,v 1.20 2008/02/19 05:46:58 kientzle Exp $");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
@@ -47,6 +47,10 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_filename.c,v 1.19 2007
#include "archive.h"
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
struct write_file_data {
int fd;
char filename[1];
@@ -95,7 +99,7 @@ file_open(struct archive *a, void *client_data)
struct stat st;
mine = (struct write_file_data *)client_data;
- flags = O_WRONLY | O_CREAT | O_TRUNC;
+ flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
/*
* Open the file.
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c
index 0883ea1de2f..272ae26e520 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c
@@ -28,7 +28,7 @@
/* Don't compile this if we don't have bzlib. */
#if HAVE_BZLIB_H
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_bzip2.c,v 1.12 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_bzip2.c,v 1.13 2007/12/30 04:58:21 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -320,6 +320,10 @@ drive_compressor(struct archive_write *a, struct private_data *state, int finish
state->stream.avail_out = bytes_written;
}
+ /* If there's nothing to do, we're done. */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+
ret = BZ2_bzCompress(&(state->stream),
finishing ? BZ_FINISH : BZ_RUN);
@@ -339,7 +343,9 @@ drive_compressor(struct archive_write *a, struct private_data *state, int finish
/* Any other return value indicates an error */
archive_set_error(&a->archive,
ARCHIVE_ERRNO_PROGRAMMER,
- "Bzip2 compression failed");
+ "Bzip2 compression failed;"
+ " BZ2_bzCompress() returned %d",
+ ret);
return (ARCHIVE_FATAL);
}
}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c
index 56a0a11fd92..18abbdf67b5 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c
@@ -28,7 +28,7 @@
/* Don't compile this if we don't have zlib. */
#if HAVE_ZLIB_H
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_gzip.c,v 1.14 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_gzip.c,v 1.16 2008/02/21 03:21:50 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -106,6 +106,21 @@ archive_compressor_gzip_init(struct archive_write *a)
return (ret);
}
+ /*
+ * The next check is a temporary workaround until the gzip
+ * code can be overhauled some. The code should not require
+ * that compressed_buffer_size == bytes_per_block. Removing
+ * this assumption will allow us to compress larger chunks at
+ * a time, which should improve overall performance
+ * marginally. As a minor side-effect, such a cleanup would
+ * allow us to support truly arbitrary block sizes.
+ */
+ if (a->bytes_per_block < 10) {
+ archive_set_error(&a->archive, EINVAL,
+ "GZip compressor requires a minimum 10 byte block size");
+ return (ARCHIVE_FATAL);
+ }
+
state = (struct private_data *)malloc(sizeof(*state));
if (state == NULL) {
archive_set_error(&a->archive, ENOMEM,
@@ -114,6 +129,10 @@ archive_compressor_gzip_init(struct archive_write *a)
}
memset(state, 0, sizeof(*state));
+ /*
+ * See comment above. We should set compressed_buffer_size to
+ * max(bytes_per_block, 65536), but the code can't handle that yet.
+ */
state->compressed_buffer_size = a->bytes_per_block;
state->compressed = (unsigned char *)malloc(state->compressed_buffer_size);
state->crc = crc32(0L, NULL, 0);
@@ -378,6 +397,10 @@ drive_compressor(struct archive_write *a, struct private_data *state, int finish
state->stream.avail_out = bytes_written;
}
+ /* If there's nothing to do, we're done. */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+
ret = deflate(&(state->stream),
finishing ? Z_FINISH : Z_NO_FLUSH );
@@ -396,7 +419,9 @@ drive_compressor(struct archive_write *a, struct private_data *state, int finish
default:
/* Any other return value indicates an error. */
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "GZip compression failed");
+ "GZip compression failed:"
+ " deflate() call returned status %d",
+ ret);
return (ARCHIVE_FATAL);
}
}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
index bb8555ef4eb..bdecb240d9f 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_none.c,v 1.15 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_compression_none.c,v 1.16 2007/12/30 04:58:22 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c
index 404b651311e..2e77f1bd89a 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c
@@ -26,7 +26,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.3 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ar.c,v 1.5 2008/01/31 08:11:01 kaiw Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -75,6 +75,7 @@ static int archive_write_ar_header(struct archive_write *,
static ssize_t archive_write_ar_data(struct archive_write *,
const void *buff, size_t s);
static int archive_write_ar_destroy(struct archive_write *);
+static int archive_write_ar_finish(struct archive_write *);
static int archive_write_ar_finish_entry(struct archive_write *);
static const char *ar_basename(const char *path);
static int format_octal(int64_t v, char *p, int s);
@@ -126,7 +127,7 @@ archive_write_set_format_ar(struct archive_write *a)
a->format_write_header = archive_write_ar_header;
a->format_write_data = archive_write_ar_data;
- a->format_finish = NULL;
+ a->format_finish = archive_write_ar_finish;
a->format_destroy = archive_write_ar_destroy;
a->format_finish_entry = archive_write_ar_finish_entry;
return (ARCHIVE_OK);
@@ -398,6 +399,23 @@ archive_write_ar_destroy(struct archive_write *a)
}
static int
+archive_write_ar_finish(struct archive_write *a)
+{
+ int ret;
+
+ /*
+ * If we haven't written anything yet, we need to write
+ * the ar global header now to make it a valid ar archive.
+ */
+ if (a->archive.file_position == 0) {
+ ret = (a->compressor.write)(a, "!<arch>\n", 8);
+ return (ret);
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static int
archive_write_ar_finish_entry(struct archive_write *a)
{
struct ar_w *ar;
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
index c8a6a7ac5ec..45cb4e74b64 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.12 2007/10/12 04:11:31 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio.c,v 1.13 2007/12/30 04:58:22 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
index e50544b45f3..d11176c1c1e 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
@@ -25,7 +25,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.2 2007/10/12 04:11:31 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_cpio_newc.c,v 1.3 2008/01/23 05:43:25 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -176,9 +176,15 @@ archive_write_newc_header(struct archive_write *a, struct archive_entry *entry)
cpio->entry_bytes_remaining = archive_entry_size(entry);
cpio->padding = 3 & (-cpio->entry_bytes_remaining);
+
/* Write the symlink now. */
- if (p != NULL && *p != '\0')
+ if (p != NULL && *p != '\0') {
ret = (a->compressor.write)(a, p, strlen(p));
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ pad = 0x3 & -strlen(p);
+ ret = (a->compressor.write)(a, "\0\0\0", pad);
+ }
return (ret);
}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
index cedbfd75c96..4604d99a6e8 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.41 2007/05/29 01:00:19 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_pax.c,v 1.42 2007/12/30 04:58:22 kientzle Exp $");
#ifdef HAVE_ERRNO_H
#include <errno.h>
@@ -383,19 +383,25 @@ archive_write_pax_header(struct archive_write *a,
struct archive_entry *entry_original)
{
struct archive_entry *entry_main;
- const char *linkname, *p;
+ const char *p;
char *t;
- const char *hardlink;
const wchar_t *wp;
const char *suffix_start;
int need_extension, r, ret;
struct pax *pax;
+ const char *hdrcharset = NULL;
+ const char *hardlink;
+ const char *path = NULL, *linkpath = NULL;
+ const char *uname = NULL, *gname = NULL;
+ const wchar_t *path_w = NULL, *linkpath_w = NULL;
+ const wchar_t *uname_w = NULL, *gname_w = NULL;
char paxbuff[512];
char ustarbuff[512];
char ustar_entry_name[256];
char pax_entry_name[256];
+ ret = ARCHIVE_OK;
need_extension = 0;
pax = (struct pax *)a->format_data;
@@ -442,53 +448,109 @@ archive_write_pax_header(struct archive_write *a,
archive_string_empty(&(pax->pax_header)); /* Blank our work area. */
/*
+ * First, check the name fields and see if any of them
+ * require binary coding. If any of them does, then all of
+ * them do.
+ */
+ hdrcharset = NULL;
+ path = archive_entry_pathname(entry_main);
+ path_w = archive_entry_pathname_w(entry_main);
+ if (path != NULL && path_w == NULL) {
+ archive_set_error(&a->archive, EILSEQ,
+ "Can't translate pathname '%s' to UTF-8", path);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ uname = archive_entry_uname(entry_main);
+ uname_w = archive_entry_uname_w(entry_main);
+ if (uname != NULL && uname_w == NULL) {
+ archive_set_error(&a->archive, EILSEQ,
+ "Can't translate uname '%s' to UTF-8", uname);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ gname = archive_entry_gname(entry_main);
+ gname_w = archive_entry_uname_w(entry_main);
+ if (gname != NULL && gname_w == NULL) {
+ archive_set_error(&a->archive, EILSEQ,
+ "Can't translate gname '%s' to UTF-8", gname);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ linkpath = hardlink;
+ if (linkpath != NULL) {
+ linkpath_w = archive_entry_hardlink_w(entry_main);
+ } else {
+ linkpath = archive_entry_symlink(entry_main);
+ if (linkpath != NULL)
+ linkpath_w = archive_entry_symlink_w(entry_main);
+ }
+ if (linkpath != NULL && linkpath_w == NULL) {
+ archive_set_error(&a->archive, EILSEQ,
+ "Can't translate linkpath '%s' to UTF-8", linkpath);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+
+ /* Store the header encoding first, to be nice to readers. */
+ if (hdrcharset != NULL)
+ add_pax_attr(&(pax->pax_header), "hdrcharset", hdrcharset);
+
+ /*
* Determining whether or not the name is too big is ugly
* because of the rules for dividing names between 'name' and
* 'prefix' fields. Here, I pick out the longest possible
* suffix, then test whether the remaining prefix is too long.
*/
- wp = archive_entry_pathname_w(entry_main);
- p = archive_entry_pathname(entry_main);
- if (strlen(p) <= 100) /* Short enough for just 'name' field */
- suffix_start = p; /* Record a zero-length prefix */
+ if (strlen(path) <= 100) /* Short enough for just 'name' field */
+ suffix_start = path; /* Record a zero-length prefix */
else
/* Find the largest suffix that fits in 'name' field. */
- suffix_start = strchr(p + strlen(p) - 100 - 1, '/');
+ suffix_start = strchr(path + strlen(path) - 100 - 1, '/');
/*
* If name is too long, or has non-ASCII characters, add
- * 'path' to pax extended attrs.
+ * 'path' to pax extended attrs. (Note that an unconvertible
+ * name must have non-ASCII characters.)
*/
- if (suffix_start == NULL || suffix_start - p > 155 || has_non_ASCII(wp)) {
- add_pax_attr_w(&(pax->pax_header), "path", wp);
+ if (suffix_start == NULL || suffix_start - path > 155
+ || path_w == NULL || has_non_ASCII(path_w)) {
+ if (path_w == NULL || hdrcharset != NULL)
+ /* Can't do UTF-8, so store it raw. */
+ add_pax_attr(&(pax->pax_header), "path", path);
+ else
+ add_pax_attr_w(&(pax->pax_header), "path", path_w);
archive_entry_set_pathname(entry_main,
- build_ustar_entry_name(ustar_entry_name, p, strlen(p), NULL));
+ build_ustar_entry_name(ustar_entry_name,
+ path, strlen(path), NULL));
need_extension = 1;
}
- /* If link name is too long or has non-ASCII characters, add
- * 'linkpath' to pax extended attrs. */
- linkname = hardlink;
- if (linkname == NULL)
- linkname = archive_entry_symlink(entry_main);
-
- if (linkname != NULL) {
- /* There is a link name, get the wide version as well. */
- if (hardlink != NULL)
- wp = archive_entry_hardlink_w(entry_main);
- else
- wp = archive_entry_symlink_w(entry_main);
-
- /* If the link is long or has a non-ASCII character,
- * store it as a pax extended attribute. */
- if (strlen(linkname) > 100 || has_non_ASCII(wp)) {
- add_pax_attr_w(&(pax->pax_header), "linkpath", wp);
- if (hardlink != NULL)
- archive_entry_set_hardlink(entry_main,
- "././@LongHardLink");
+ if (linkpath != NULL) {
+ /* If link name is too long or has non-ASCII characters, add
+ * 'linkpath' to pax extended attrs. */
+ if (strlen(linkpath) > 100 || linkpath_w == NULL
+ || linkpath_w == NULL || has_non_ASCII(linkpath_w)) {
+ if (linkpath_w == NULL || hdrcharset != NULL)
+ /* If the linkpath is not convertible
+ * to wide, or we're encoding in
+ * binary anyway, store it raw. */
+ add_pax_attr(&(pax->pax_header),
+ "linkpath", linkpath);
else
- archive_entry_set_symlink(entry_main,
- "././@LongSymLink");
+ /* If the link is long or has a
+ * non-ASCII character, store it as a
+ * pax extended attribute. */
+ add_pax_attr_w(&(pax->pax_header),
+ "linkpath", linkpath_w);
+ if (strlen(linkpath) > 100) {
+ if (hardlink != NULL)
+ archive_entry_set_hardlink(entry_main,
+ "././@LongHardLink");
+ else
+ archive_entry_set_symlink(entry_main,
+ "././@LongSymLink");
+ }
need_extension = 1;
}
}
@@ -509,12 +571,20 @@ archive_write_pax_header(struct archive_write *a,
/* If group name is too large or has non-ASCII characters, add
* 'gname' to pax extended attrs. */
- p = archive_entry_gname(entry_main);
- wp = archive_entry_gname_w(entry_main);
- if (p != NULL && (strlen(p) > 31 || has_non_ASCII(wp))) {
- add_pax_attr_w(&(pax->pax_header), "gname", wp);
- archive_entry_set_gname(entry_main, NULL);
- need_extension = 1;
+ if (gname != NULL) {
+ if (strlen(gname) > 31
+ || gname_w == NULL
+ || has_non_ASCII(gname_w))
+ {
+ if (gname_w == NULL || hdrcharset != NULL) {
+ add_pax_attr(&(pax->pax_header),
+ "gname", gname);
+ } else {
+ add_pax_attr_w(&(pax->pax_header),
+ "gname", gname_w);
+ }
+ need_extension = 1;
+ }
}
/* If numeric UID is too large, add 'uid' to pax extended attrs. */
@@ -524,14 +594,21 @@ archive_write_pax_header(struct archive_write *a,
need_extension = 1;
}
- /* If user name is too large, add 'uname' to pax extended attrs. */
- /* TODO: If uname has non-ASCII characters, use pax attribute. */
- p = archive_entry_uname(entry_main);
- wp = archive_entry_uname_w(entry_main);
- if (p != NULL && (strlen(p) > 31 || has_non_ASCII(wp))) {
- add_pax_attr_w(&(pax->pax_header), "uname", wp);
- archive_entry_set_uname(entry_main, NULL);
- need_extension = 1;
+ /* Add 'uname' to pax extended attrs if necessary. */
+ if (uname != NULL) {
+ if (strlen(uname) > 31
+ || uname_w == NULL
+ || has_non_ASCII(uname_w))
+ {
+ if (uname_w == NULL || hdrcharset != NULL) {
+ add_pax_attr(&(pax->pax_header),
+ "uname", uname);
+ } else {
+ add_pax_attr_w(&(pax->pax_header),
+ "uname", uname_w);
+ }
+ need_extension = 1;
+ }
}
/*
@@ -733,7 +810,6 @@ archive_write_pax_header(struct archive_write *a,
__archive_write_format_header_ustar(a, ustarbuff, entry_main, -1, 0);
/* If we built any extended attributes, write that entry first. */
- ret = ARCHIVE_OK;
if (archive_strlen(&(pax->pax_header)) > 0) {
struct archive_entry *pax_attr_entry;
time_t s;
@@ -793,13 +869,13 @@ archive_write_pax_header(struct archive_write *a,
/* Standard ustar doesn't support ctime. */
archive_entry_set_ctime(pax_attr_entry, 0, 0);
- ret = __archive_write_format_header_ustar(a, paxbuff,
+ r = __archive_write_format_header_ustar(a, paxbuff,
pax_attr_entry, 'x', 1);
archive_entry_free(pax_attr_entry);
/* Note that the 'x' header shouldn't ever fail to format */
- if (ret != 0) {
+ if (r != 0) {
const char *msg = "archive_write_pax_header: "
"'x' header failed?! This can't happen.\n";
write(2, msg, strlen(msg));
@@ -986,12 +1062,19 @@ build_ustar_entry_name(char *dest, const char *src, size_t src_length,
* The ustar header for the pax extended attributes must have a
* reasonable name: SUSv3 suggests 'dirname'/PaxHeader/'filename'
*
- * Joerg Schiling has argued that this is unnecessary because, in practice,
- * if the pax extended attributes get extracted as regular files, noone is
- * going to bother reading those attributes to manually restore them.
- * Based on this, 'star' uses /tmp/PaxHeader/'basename' as the ustar header
- * name. This is a tempting argument, but I'm not entirely convinced.
- * I'm also uncomfortable with the fact that "/tmp" is a Unix-ism.
+ * Joerg Schilling has argued that this is unnecessary because, in
+ * practice, if the pax extended attributes get extracted as regular
+ * files, noone is going to bother reading those attributes to
+ * manually restore them. Based on this, 'star' uses
+ * /tmp/PaxHeader/'basename' as the ustar header name. This is a
+ * tempting argument, in part because it's simpler than the SUSv3
+ * recommendation, but I'm not entirely convinced. I'm also
+ * uncomfortable with the fact that "/tmp" is a Unix-ism.
+ *
+ * GNU tar uses 'dirname'/PaxHeader.<pid>/'filename', where the PID is
+ * the PID of the archiving process. This seems unnecessarily complex
+ * to me, as I don't see much value to separating the headers from
+ * extracting multiple versions of an archive.
*
* The following routine implements the SUSv3 recommendation, and is
* much simpler because build_ustar_entry_name() above already does
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
index 287afe0657c..a7d26c90579 100644
--- a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
@@ -24,7 +24,7 @@
*/
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.24 2007/06/11 05:17:30 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_set_format_ustar.c,v 1.25 2007/12/30 04:58:22 kientzle Exp $");
#ifdef HAVE_ERRNO_H
diff --git a/archivers/libarchive/files/libarchive/config_freebsd.h b/archivers/libarchive/files/libarchive/config_freebsd.h
index 1b9126058aa..83a85996a84 100644
--- a/archivers/libarchive/files/libarchive/config_freebsd.h
+++ b/archivers/libarchive/files/libarchive/config_freebsd.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.5 2007/05/29 01:00:20 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/config_freebsd.h,v 1.6 2008/02/19 05:40:28 kientzle Exp $
*/
/* FreeBSD 5.0 and later have ACL support. */
@@ -37,6 +37,7 @@
#define HAVE_BZLIB_H 1
#define HAVE_CHFLAGS 1
+#define HAVE_CHOWN 1
#define HAVE_DECL_INT64_MAX 1
#define HAVE_DECL_INT64_MIN 1
#define HAVE_DECL_SIZE_MAX 1
@@ -53,6 +54,7 @@
#define HAVE_FCNTL_H 1
#define HAVE_FSEEKO 1
#define HAVE_FUTIMES 1
+#define HAVE_GETEUID 1
#define HAVE_GRP_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_LCHFLAGS 1
@@ -65,10 +67,12 @@
#define HAVE_MEMSET 1
#define HAVE_MKDIR 1
#define HAVE_MKFIFO 1
+#define HAVE_MKNOD 1
#define HAVE_POLL 1
#define HAVE_POLL_H 1
#define HAVE_PWD_H 1
#define HAVE_SELECT 1
+#define HAVE_SETENV 1
#define HAVE_STDINT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRCHR 1
@@ -87,9 +91,12 @@
#define HAVE_SYS_STAT_H 1
#define HAVE_SYS_TIME_H 1
#define HAVE_SYS_TYPES_H 1
+#undef HAVE_SYS_UTIME_H
#define HAVE_SYS_WAIT_H 1
#define HAVE_TIMEGM 1
+#define HAVE_TZSET 1
#define HAVE_UNISTD_H 1
+#define HAVE_UNSETENV 1
#define HAVE_UTIME 1
#define HAVE_UTIMES 1
#define HAVE_UTIME_H 1
diff --git a/archivers/libarchive/files/libarchive/config_windows.h b/archivers/libarchive/files/libarchive/config_windows.h
index fa55c8e306d..c5200655b14 100644
--- a/archivers/libarchive/files/libarchive/config_windows.h
+++ b/archivers/libarchive/files/libarchive/config_windows.h
@@ -1,168 +1,510 @@
-/*-
- * Copyright (c) 2003-2006 Tim Kientzle
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer
- * in this position and unchanged.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-/* Start of configuration for native Win32 with Visual Studio. */
-/* TODO: Fix this. */
-#undef HAVE_ACL_CREATE_ENTRY
-#undef HAVE_ACL_INIT
-#undef HAVE_ACL_SET_FD
-#undef HAVE_ACL_SET_FD_NP
-#undef HAVE_ACL_SET_FILE
-#undef HAVE_ACL_USER
-#undef HAVE_BZLIB_H
-#undef HAVE_CHFLAGS
-#define HAVE_DECL_INT64_MAX 1
-#define HAVE_DECL_INT64_MIN 1
-#define HAVE_DECL_SIZE_MAX 1
-#define HAVE_DECL_STRERROR_R 1
-#define HAVE_DECL_UINT32_MAX 1
-#define HAVE_DECL_UINT64_MAX 1
-#define HAVE_EFTYPE 1
-#define HAVE_EILSEQ 1
-#define HAVE_ERRNO_H 1
-#undef HAVE_FCHDIR
-#undef HAVE_FCHFLAGS
-#undef HAVE_FCHMOD
-#undef HAVE_FCHOWN
-#define HAVE_FCNTL_H 1
-#undef HAVE_FSEEKO
-#undef HAVE_FUTIMES
-#undef HAVE_GRP_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_LCHFLAGS
-#undef HAVE_LCHMOD
-#undef HAVE_LCHOWN
-#define HAVE_LIMITS_H 1
-#undef HAVE_LUTIMES
-#define HAVE_MALLOC 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMORY_H 1
-#define HAVE_MEMSET 1
-#define HAVE_MKDIR 1
-#undef HAVE_MKFIFO
-#undef HAVE_PATHS_H
-#undef HAVE_POLL
-#undef HAVE_POLL_H
-#undef HAVE_PWD_H
-#undef HAVE_SELECT
-#undef HAVE_STDINT_H
-#define HAVE_STDLIB_H 1
-#define HAVE_STRCHR 1
-#define HAVE_STRDUP 1
-#define HAVE_STRERROR 1
-#undef HAVE_STRERROR_R
-#define HAVE_STRINGS_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRRCHR 1
-#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
-#undef HAVE_STRUCT_STAT_ST_RDEV
-#undef HAVE_STRUCT_TM_TM_GMTOFF
-#undef HAVE_SYS_ACL_H
-#undef HAVE_SYS_IOCTL_H
-#undef HAVE_SYS_SELECT_H
-#define HAVE_SYS_STAT_H 1
-#undef HAVE_SYS_TIME_H
-#define HAVE_SYS_TYPES_H 1
-#undef HAVE_SYS_WAIT_H
-#undef HAVE_TIMEGM
-#undef HAVE_UNISTD_H
-#undef HAVE_UTIME
-#undef HAVE_UTIMES
-#undef HAVE_UTIME_H
-#define HAVE_WCHAR_H 1
-#define HAVE_WCSCPY 1
-#define HAVE_WCSLEN 1
-#define HAVE_WMEMCMP 1
-#define HAVE_WMEMCPY 1
-#undef HAVE_ZLIB_H
-#define STDC_HEADERS 1
-#define TIME_WITH_SYS_TIME 1
-
-/*
- * TODO: libarchive relies heavily on having the file type
- * encoded as part of the mode value. Windows kind-of, sort-of
- * supports this, but the following needs to be carefully compared
- * to Windows conventions and quite possibly changed extensively.
- */
-#define S_IFIFO 0010000 /* named pipe (fifo) */
-//#define S_IFCHR 0020000 /* character special */
-//#define S_IFDIR 0040000 /* directory */
-#define S_IFBLK 0060000 /* block special */
-//#define S_IFREG 0100000 /* regular */
-#define S_IFLNK 0120000 /* symbolic link */
-#define S_IFSOCK 0140000 /* socket */
-#define S_ISVTX 0001000 /* save swapped text even after use */
-//#define S_ISUID
-//#define S_ISGID
-//#define PATH_MAX
-#define S_IRWXU 0700
-#define S_IRWXG 0070
-#define S_IRWXO 0007
-#define S_ISDIR(m) (((m) & 0170000) == S_IFDIR) /* directory */
-#define S_ISCHR(m) (((m) & 0170000) == S_IFCHR) /* char special */
-#define S_ISBLK(m) (((m) & 0170000) == S_IFBLK) /* block special */
-#define S_ISREG(m) (((m) & 0170000) == S_IFREG) /* regular file */
-#define S_ISFIFO(m) (((m) & 0170000) == S_IFIFO) /* fifo or socket */
-#define S_ISLNK(m) (((m) & 0170000) == S_IFLNK) /* symbolic link */
-#define S_ISSOCK(m) (((m) & 0170000) == S_IFSOCK) /* socket */
-
-/* Basic definitions for system and integer types. */
-typedef int uid_t;
-typedef int gid_t;
-typedef int id_t;
-typedef unsigned short mode_t;
-typedef unsigned _int64 uint64_t;
-typedef unsigned _int16 uint16_t;
-typedef uint64_t uintmax_t;
-typedef _int64 intmax_t;
-
-/* Replacement for major/minor/makedev. */
-#define major(x) ((int)(0x00ff & ((x) >> 8)))
-#define minor(x) ((int)(0xffff00ff & (x)))
-#define makedev(maj,min) ((0xff00 & ((maj)<<8))|(0xffff00ff & (min)))
-
-#define EFTYPE 7
-#define STDERR_FILENO 2
-
-/* Alias the Windows _function to the POSIX equivalent. */
-#include <io.h>
-#define write _write
-#define read _read
-#define lseek _lseek
-#define open _open
-#define chdir _chdir
-#define mkdir _mkdir
-#define close _close
-
-/* TODO: Fix the code, don't suppress the warnings. */
-#pragma warning(disable:4996)
-#pragma warning(disable:4244)
-#pragma warning(disable:4305)
-#pragma warning(disable:4267)
-
-/* End of Win32/Visual Studio definitions. */
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+#ifndef CONFIG_H_INCLUDED
+#define CONFIG_H_INCLUDED
+
+/* Version number of bsdcpio */
+#define BSDCPIO_VERSION_STRING "0.3.0"
+
+/* Version number of bsdtar */
+#define BSDTAR_VERSION_STRING "2.4.12"
+
+/* Define to 1 if you have the `acl_create_entry' function. */
+/* #undef HAVE_ACL_CREATE_ENTRY */
+
+/* Define to 1 if you have the `acl_get_perm' function. */
+/* #undef HAVE_ACL_GET_PERM */
+
+/* Define to 1 if you have the `acl_get_perm_np' function. */
+/* #undef HAVE_ACL_GET_PERM_NP */
+
+/* Define to 1 if you have the `acl_init' function. */
+/* #undef HAVE_ACL_INIT */
+
+/* Define to 1 if the system has the type `acl_permset_t'. */
+/* #undef HAVE_ACL_PERMSET_T */
+
+/* Define to 1 if you have the `acl_set_fd' function. */
+/* #undef HAVE_ACL_SET_FD */
+
+/* Define to 1 if you have the `acl_set_fd_np' function. */
+/* #undef HAVE_ACL_SET_FD_NP */
+
+/* Define to 1 if you have the `acl_set_file' function. */
+/* #undef HAVE_ACL_SET_FILE */
+
+/* True for systems with POSIX ACL support */
+/* #undef HAVE_ACL_USER */
+
+/* Define to 1 if you have the <attr/xattr.h> header file. */
+/* #undef HAVE_ATTR_XATTR_H */
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+/* #undef HAVE_BZLIB_H */
+
+/* Define to 1 if you have the `chflags' function. */
+/* #undef HAVE_CHFLAGS */
+
+/* Define to 1 if you have the `chown' function. */
+/* #undef HAVE_CHOWN */
+
+/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_INT64_MAX */
+
+/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_INT64_MIN */
+
+/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTARG */
+
+/* Define to 1 if you have the declaration of `optind', and to 0 if you don't.
+ */
+/* #undef HAVE_DECL_OPTIND */
+
+/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
+ don't. */
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+#define HAVE_DECL_SIZE_MAX 1
+#else
+/* #undef HAVE_DECL_SIZE_MAX */
+#endif
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_STRERROR_R */
+
+/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_UINT32_MAX */
+
+/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
+ don't. */
+/* #undef HAVE_DECL_UINT64_MAX */
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_DIRENT_H */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if nl_langinfo supports D_MD_ORDER */
+/* #undef HAVE_D_MD_ORDER */
+
+/* A possible errno value for invalid file format errors */
+#define HAVE_EFTYPE 1
+
+/* A possible errno value for invalid file format errors */
+#define HAVE_EILSEQ 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <ext2fs/ext2_fs.h> header file. */
+/* #undef HAVE_EXT2FS_EXT2_FS_H */
+
+/* Define to 1 if you have the `fchdir' function. */
+/* #undef HAVE_FCHDIR */
+
+/* Define to 1 if you have the `fchflags' function. */
+/* #undef HAVE_FCHFLAGS */
+
+/* Define to 1 if you have the `fchmod' function. */
+/* #undef HAVE_FCHMOD */
+
+/* Define to 1 if you have the `fchown' function. */
+/* #undef HAVE_FCHOWN */
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if your system has a working POSIX `fnmatch' function. */
+/* #undef HAVE_FNMATCH */
+
+/* Define to 1 if fnmatch(3) supports the FNM_LEADING_DIR flag */
+/* #undef HAVE_FNM_LEADING_DIR */
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+/* #undef HAVE_FSEEKO */
+
+/* Define to 1 if you have the `fsetxattr' function. */
+/* #undef HAVE_FSETXATTR */
+
+/* Define to 1 if you have the `ftruncate' function. */
+/* #undef HAVE_FTRUNCATE */
+
+/* Define to 1 if you have the `futimes' function. */
+/* #undef HAVE_FUTIMES */
+
+/* Define to 1 if you have the `geteuid' function. */
+/* #undef HAVE_GETEUID */
+
+/* Define to 1 if you have the `getopt_long' function. */
+/* #undef HAVE_GETOPT_LONG */
+
+/* Define to 1 if you have the `getxattr' function. */
+/* #undef HAVE_GETXATTR */
+
+/* Define to 1 if you have the <grp.h> header file. */
+/* #undef HAVE_GRP_H */
+
+/* Define to 1 if the system has the type `intmax_t'. */
+/* #undef HAVE_INTMAX_T */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+/* #undef HAVE_INTTYPES_H */
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+/* #undef HAVE_LANGINFO_H */
+
+/* Define to 1 if you have the `lchflags' function. */
+/* #undef HAVE_LCHFLAGS */
+
+/* Define to 1 if you have the `lchmod' function. */
+/* #undef HAVE_LCHMOD */
+
+/* Define to 1 if you have the `lchown' function. */
+/* #undef HAVE_LCHOWN */
+
+/* Define to 1 if you have the `lgetxattr' function. */
+/* #undef HAVE_LGETXATTR */
+
+/* Define to 1 if you have the `acl' library (-lacl). */
+/* #undef HAVE_LIBACL */
+
+/* Define to 1 if you have the `attr' library (-lattr). */
+/* #undef HAVE_LIBATTR */
+
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+/* #undef HAVE_LIBBZ2 */
+
+/* Define to 1 if you have the `z' library (-lz). */
+/* #undef HAVE_LIBZ */
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the <linux/ext2_fs.h> header file. */
+/* #undef HAVE_LINUX_EXT2_FS_H */
+
+/* Define to 1 if you have the <linux/fs.h> header file. */
+/* #undef HAVE_LINUX_FS_H */
+
+/* Define to 1 if you have the `listxattr' function. */
+/* #undef HAVE_LISTXATTR */
+
+/* Define to 1 if you have the `llistxattr' function. */
+/* #undef HAVE_LLISTXATTR */
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+/* Define to 1 if the system has the type `long long int'. */
+#define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `lsetxattr' function. */
+/* #undef HAVE_LSETXATTR */
+
+/* Define to 1 if `lstat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */
+
+/* Define to 1 if you have the `lutimes' function. */
+/* #undef HAVE_LUTIMES */
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mkdir' function. */
+#define HAVE_MKDIR 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+/* #undef HAVE_MKFIFO */
+
+/* Define to 1 if you have the `mknod' function. */
+/* #undef HAVE_MKNOD */
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+/* #undef HAVE_NL_LANGINFO */
+
+/* Define to 1 if you have the <paths.h> header file. */
+/* #undef HAVE_PATHS_H */
+
+/* Define to 1 if you have the `poll' function. */
+/* #undef HAVE_POLL */
+
+/* Define to 1 if you have the <poll.h> header file. */
+/* #undef HAVE_POLL_H */
+
+/* Define to 1 if you have the <pwd.sh.h> header file. */
+/* #undef HAVE_PWD_H */
+
+/* Define to 1 if you have the `select' function. */
+/* #undef HAVE_SELECT */
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+ zero-length file name argument. */
+/* #undef HAVE_STAT_EMPTY_STRING_BUG */
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+/* #undef HAVE_STDINT_H */
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+/* #undef HAVE_STRERROR_R */
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strrchr' function. */
+#define HAVE_STRRCHR 1
+
+/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */
+
+/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */
+
+/* Define to 1 if `st_rdev' is member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_RDEV 1
+
+/* Define to 1 if `tm_gmtoff' is member of `struct tm'. */
+/* #undef HAVE_STRUCT_TM_TM_GMTOFF */
+
+/* Define to 1 if you have the <sys/acl.h> header file. */
+/* #undef HAVE_SYS_ACL_H */
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+/* #undef HAVE_SYS_IOCTL_H */
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+ */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+/* #undef HAVE_SYS_POLL_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+/* #undef HAVE_SYS_SELECT_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#define HAVE_SYS_UTIME_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+/* #undef HAVE_SYS_WAIT_H */
+
+/* Define to 1 if you have the `timegm' function. */
+/* #undef HAVE_TIMEGM */
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if the system has the type `uintmax_t'. */
+/* #undef HAVE_UINTMAX_T */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#define HAVE_UNSIGNED_LONG_LONG 1
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimes' function. */
+/* #undef HAVE_UTIMES */
+
+/* Define to 1 if you have the <utime.h> header file. */
+/* #undef HAVE_UTIME_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if you have the `wcscpy' function. */
+#define HAVE_WCSCPY 1
+
+/* Define to 1 if you have the `wcslen' function. */
+#define HAVE_WCSLEN 1
+
+/* Define to 1 if you have the `wmemcmp' function. */
+/* #undef HAVE_WMEMCMP */
+
+/* Define to 1 if you have the `wmemcpy' function. */
+/* #undef HAVE_WMEMCPY */
+
+/* Define to 1 if you have the <zlib.h> header file. */
+/* #undef HAVE_ZLIB_H */
+
+/* Version number of libarchive as a single integer */
+#define LIBARCHIVE_VERSION "2004012"
+
+/* Version number of libarchive */
+#define LIBARCHIVE_VERSION_STRING "2.4.12"
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+ */
+/* #undef MAJOR_IN_MKDEV */
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+ <sysmacros.h>. */
+/* #undef MAJOR_IN_SYSMACROS */
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "libarchive"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "kientzle@freebsd.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libarchive"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libarchive 2.4.12"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libarchive"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "2.4.12"
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if strerror_r returns char *. */
+/* #undef STRERROR_R_CHAR_P */
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "2.4.12"
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef was allowed, the
+ #define below would cause a syntax error. */
+/* #undef _UINT64_T */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+//#define gid_t int
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#define id_t int
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#define int64_t long long
+
+/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
+ not define. */
+#define intmax_t long long
+
+/* Define to `int' if <sys/types.h> does not define. */
+//#define mode_t unsigned short
+
+/* Define to `long long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+//#define uid_t int
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#define uint64_t unsigned long long
+
+/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
+ do not define. */
+#define uintmax_t unsigned long long
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef uintptr_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#define pid_t unsigned int
+
+#define uint32_t unsigned long
+#define uint16_t unsigned short
+//#define ssize_t long
+
+#endif /* CONFIG_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/cpio.5 b/archivers/libarchive/files/libarchive/cpio.5
index 2f298332d18..9dbdc6d8408 100644
--- a/archivers/libarchive/files/libarchive/cpio.5
+++ b/archivers/libarchive/files/libarchive/cpio.5
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
+.\" $FreeBSD: src/lib/libarchive/cpio.5,v 1.1 2007/12/30 04:58:22 kientzle Exp $
.\"
.Dd October 5, 2007
.Dt CPIO 5
diff --git a/archivers/libarchive/files/libarchive/filter_fork.c b/archivers/libarchive/files/libarchive/filter_fork.c
index c71cf6883ff..8cad9e2f098 100644
--- a/archivers/libarchive/files/libarchive/filter_fork.c
+++ b/archivers/libarchive/files/libarchive/filter_fork.c
@@ -25,7 +25,7 @@
#include "archive_platform.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/filter_fork.c,v 1.1 2007/05/29 01:00:20 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/filter_fork.c,v 1.2 2007/12/30 04:58:22 kientzle Exp $");
#if defined(HAVE_POLL)
# if defined(HAVE_POLL_H)
diff --git a/archivers/libarchive/files/libarchive/libarchive-formats.5 b/archivers/libarchive/files/libarchive/libarchive-formats.5
index 0606a5ba1d0..0346d8f5aff 100644
--- a/archivers/libarchive/files/libarchive/libarchive-formats.5
+++ b/archivers/libarchive/files/libarchive/libarchive-formats.5
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.14 2007/04/05 05:07:53 kientzle Exp $
+.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.15 2007/12/30 04:58:22 kientzle Exp $
.\"
.Dd April 27, 2004
.Dt libarchive-formats 3
diff --git a/archivers/libarchive/files/libarchive/libarchive_internals.3 b/archivers/libarchive/files/libarchive/libarchive_internals.3
index a84c9406d34..9a42b76d4e6 100644
--- a/archivers/libarchive/files/libarchive/libarchive_internals.3
+++ b/archivers/libarchive/files/libarchive/libarchive_internals.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD: src/lib/libarchive/libarchive_internals.3,v 1.1 2007/05/29 01:00:20 kientzle Exp $
+.\" $FreeBSD: src/lib/libarchive/libarchive_internals.3,v 1.2 2007/12/30 04:58:22 kientzle Exp $
.\"
.Dd April 16, 2007
.Dt LIBARCHIVE 3
diff --git a/archivers/libarchive/files/libarchive/test/list.h b/archivers/libarchive/files/libarchive/test/list.h
index 0b221fcec97..fdd56335dc9 100644
--- a/archivers/libarchive/files/libarchive/test/list.h
+++ b/archivers/libarchive/files/libarchive/test/list.h
@@ -2,8 +2,14 @@ DEFINE_TEST(test_acl_basic)
DEFINE_TEST(test_acl_pax)
DEFINE_TEST(test_archive_api_feature)
DEFINE_TEST(test_bad_fd)
+DEFINE_TEST(test_compat_gtar)
+DEFINE_TEST(test_compat_tar_hardlink)
+DEFINE_TEST(test_compat_zip)
+DEFINE_TEST(test_empty_write)
DEFINE_TEST(test_entry)
DEFINE_TEST(test_entry_strmode)
+DEFINE_TEST(test_link_resolver)
+DEFINE_TEST(test_pax_filename_encoding)
DEFINE_TEST(test_read_compress_program)
DEFINE_TEST(test_read_data_large)
DEFINE_TEST(test_read_extract)
@@ -35,6 +41,7 @@ DEFINE_TEST(test_tar_filenames)
DEFINE_TEST(test_tar_large)
DEFINE_TEST(test_write_compress_program)
DEFINE_TEST(test_write_disk)
+DEFINE_TEST(test_write_disk_hardlink)
DEFINE_TEST(test_write_disk_perms)
DEFINE_TEST(test_write_disk_secure)
DEFINE_TEST(test_write_format_ar)
diff --git a/archivers/libarchive/files/libarchive/test/main.c b/archivers/libarchive/files/libarchive/test/main.c
index 4585c2631db..0b56cc64156 100644
--- a/archivers/libarchive/files/libarchive/test/main.c
+++ b/archivers/libarchive/files/libarchive/test/main.c
@@ -24,15 +24,23 @@
*/
/*
- * Various utility routines useful for test programs.
- * Each test program is linked against this file.
+ * This same file is used pretty much verbatim for all test harnesses.
+ *
+ * The next line is used to define various environment variables, etc.
+ *
+ * The tar and cpio test harnesses are identical except for this line;
+ * the libarchive test harness omits some code that is needed only for
+ * testing standalone executables.
*/
+#define PROGRAM "LIBARCHIVE"
+
#include <errno.h>
+#include <locale.h>
#include <stdarg.h>
#include <time.h>
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.8 2007/07/31 05:03:27 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.10 2008/02/19 05:52:30 kientzle Exp $");
/*
* "list.h" is simply created by "grep DEFINE_TEST"; it has
@@ -60,6 +68,8 @@ static int quiet_flag = 0;
static int failures = 0;
/* Cumulative count of skipped component tests. */
static int skips = 0;
+/* Cumulative count of assertions. */
+static int assertions = 0;
/*
* My own implementation of the standard assert() macro emits the
@@ -86,7 +96,6 @@ static struct line {
int count;
} failed_lines[1000];
-
/*
* Count this failure; return the number of previous failures.
*/
@@ -116,21 +125,26 @@ previous_failures(const char *filename, int line)
}
/*
- * Inform user that we're skipping a test.
+ * Copy arguments into file-local variables.
*/
-static const char *skipped_filename;
-static int skipped_line;
-void skipping_setup(const char *filename, int line)
+static const char *test_filename;
+static int test_line;
+static void *test_extra;
+void test_setup(const char *filename, int line)
{
- skipped_filename = filename;
- skipped_line = line;
+ test_filename = filename;
+ test_line = line;
}
+
+/*
+ * Inform user that we're skipping a test.
+ */
void
test_skipping(const char *fmt, ...)
{
va_list ap;
- if (previous_failures(skipped_filename, skipped_line))
+ if (previous_failures(test_filename, test_line))
return;
va_start(ap, fmt);
@@ -209,19 +223,21 @@ failure(const char *fmt, ...)
}
/* Generic assert() just displays the failed condition. */
-void
+int
test_assert(const char *file, int line, int value, const char *condition, void *extra)
{
+ ++assertions;
if (value) {
msg[0] = '\0';
- return;
+ return (value);
}
failures ++;
if (previous_failures(file, line))
- return;
+ return (value);
fprintf(stderr, "%s:%d: Assertion failed\n", file, line);
fprintf(stderr, " Condition: %s\n", condition);
report_failure(extra);
+ return (value);
}
/* assertEqualInt() displays the values of the two integers. */
@@ -229,6 +245,7 @@ void
test_assert_equal_int(const char *file, int line,
int v1, const char *e1, int v2, const char *e2, void *extra)
{
+ ++assertions;
if (v1 == v2) {
msg[0] = '\0';
return;
@@ -250,6 +267,7 @@ test_assert_equal_string(const char *file, int line,
const char *v2, const char *e2,
void *extra)
{
+ ++assertions;
if (v1 == NULL || v2 == NULL) {
if (v1 == v2) {
msg[0] = '\0';
@@ -276,6 +294,7 @@ test_assert_equal_wstring(const char *file, int line,
const wchar_t *v2, const char *e2,
void *extra)
{
+ ++assertions;
if (wcscmp(v1, v2) == 0) {
msg[0] = '\0';
return;
@@ -290,15 +309,52 @@ test_assert_equal_wstring(const char *file, int line,
report_failure(extra);
}
-/* assertEqualMem() displays the values of the two strings. */
+/*
+ * Pretty standard hexdump routine. As a bonus, if ref != NULL, then
+ * any bytes in p that differ from ref will be highlighted with '_'
+ * before and after the hex value.
+ */
+static void
+hexdump(const char *p, const char *ref, size_t l, size_t offset)
+{
+ size_t i, j;
+ char sep;
+
+ for(i=0; i < l; i+=16) {
+ fprintf(stderr, "%04x", i + offset);
+ sep = ' ';
+ for (j = 0; j < 16 && i + j < l; j++) {
+ if (ref != NULL && p[i + j] != ref[i + j])
+ sep = '_';
+ fprintf(stderr, "%c%02x", sep, p[i+j]);
+ if (ref != NULL && p[i + j] == ref[i + j])
+ sep = ' ';
+ }
+ for (; j < 16; j++) {
+ fprintf(stderr, "%c ", sep);
+ sep = ' ';
+ }
+ fprintf(stderr, "%c", sep);
+ for (j=0; j < 16 && i + j < l; j++) {
+ int c = p[i + j];
+ if (c >= ' ' && c <= 126)
+ fprintf(stderr, "%c", c);
+ else
+ fprintf(stderr, ".");
+ }
+ fprintf(stderr, "\n");
+ }
+}
+
+/* assertEqualMem() displays the values of the two memory blocks. */
+/* TODO: For long blocks, hexdump the first bytes that actually differ. */
void
test_assert_equal_mem(const char *file, int line,
const char *v1, const char *e1,
const char *v2, const char *e2,
size_t l, const char *ld, void *extra)
{
- unsigned int i;
-
+ ++assertions;
if (v1 == NULL || v2 == NULL) {
if (v1 == v2) {
msg[0] = '\0';
@@ -314,31 +370,69 @@ test_assert_equal_mem(const char *file, int line,
fprintf(stderr, "%s:%d: Assertion failed: memory not equal\n",
file, line);
fprintf(stderr, " size %s = %d\n", ld, (int)l);
- fprintf(stderr, " %s = ", e1);
- for(i=0; i < 32 && i < l; i++) {
- int c = v1[i];
- if (c >= ' ' && c <= 126)
- fprintf(stderr, "'%c'", c);
- else
- fprintf(stderr, "0x%02x", c);
- if (i < l)
- fprintf(stderr, ", ");
- }
- fprintf(stderr, "\n");
- fprintf(stderr, " %s = ", e2);
- for(i=0; i < 32 && i < l; i++) {
- int c = v2[i];
- if (c >= ' ' && c <= 126)
- fprintf(stderr, "'%c'", c);
- else
- fprintf(stderr, "0x%02x", c);
- if (i < l)
- fprintf(stderr, ", ");
- }
+ fprintf(stderr, " Dump of %s\n", e1);
+ hexdump(v1, v2, l < 32 ? l : 32, 0);
+ fprintf(stderr, " Dump of %s\n", e2);
+ hexdump(v2, v1, l < 32 ? l : 32, 0);
fprintf(stderr, "\n");
report_failure(extra);
}
+void
+test_assert_empty_file(const char *f1fmt, ...)
+{
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ fprintf(stderr, "%s:%d: Could not stat: %s\n", test_filename, test_line, f1);
+ report_failure(NULL);
+ } else if (st.st_size > 0) {
+ fprintf(stderr, "%s:%d: File not empty: %s\n", test_filename, test_line, f1);
+ fprintf(stderr, " File size: %d\n", (int)st.st_size);
+ report_failure(NULL);
+ }
+}
+
+/* assertEqualFile() asserts that two files have the same contents. */
+/* TODO: hexdump the first bytes that actually differ. */
+void
+test_assert_equal_file(const char *f1, const char *f2pattern, ...)
+{
+ char f2[1024];
+ va_list ap;
+ char buff1[1024];
+ char buff2[1024];
+ int fd1, fd2;
+ int n1, n2;
+
+ va_start(ap, f2pattern);
+ vsprintf(f2, f2pattern, ap);
+ va_end(ap);
+
+ fd1 = open(f1, O_RDONLY);
+ fd2 = open(f2, O_RDONLY);
+ for (;;) {
+ n1 = read(fd1, buff1, sizeof(buff1));
+ n2 = read(fd2, buff2, sizeof(buff2));
+ if (n1 != n2)
+ break;
+ if (n1 == 0 && n2 == 0)
+ return;
+ if (memcmp(buff1, buff2, n1) != 0)
+ break;
+ }
+ fprintf(stderr, "%s:%d: Files are not identical\n", test_filename, test_line);
+ fprintf(stderr, " file1=\"%s\"\n", f1);
+ fprintf(stderr, " file2=\"%s\"\n", f2);
+ report_failure(test_extra);
+}
+
/*
* Call standard system() call, but build up the command line using
@@ -412,8 +506,8 @@ slurpfile(size_t * sizep, const char *fmt, ...)
/*
* "list.h" is automatically generated; it just has a lot of lines like:
* DEFINE_TEST(function_name)
- * The common "test.h" includes it to declare all of the test functions.
- * We reuse it here to define a list of all tests to run.
+ * It's used above to declare all of the test functions.
+ * We reuse it here to define a list of all tests (functions and names).
*/
#undef DEFINE_TEST
#define DEFINE_TEST(n) { n, #n },
@@ -457,6 +551,8 @@ static int test_run(int i, const char *tmpdir)
tests[i].name);
exit(1);
}
+ /* Explicitly reset the locale before each test. */
+ setlocale(LC_ALL, "C");
/* Run the actual test. */
(*tests[i].func)();
/* Summarize the results of this test. */
@@ -490,6 +586,7 @@ int main(int argc, char **argv)
static const int limit = sizeof(tests) / sizeof(tests[0]);
int i, tests_run = 0, tests_failed = 0, opt;
time_t now;
+ char *refdir_alloc = NULL;
char *progname, *p;
char tmpdir[256];
char tmpdir_timestamp[256];
@@ -506,7 +603,7 @@ int main(int argc, char **argv)
}
/* Get the directory holding test files from environment. */
- refdir = getenv("LIBARCHIVE_TEST_FILES");
+ refdir = getenv(PROGRAM "_TEST_FILES");
/*
* Parse options.
@@ -556,7 +653,7 @@ int main(int argc, char **argv)
*/
if (refdir == NULL) {
systemf("/bin/pwd > %s/refdir", tmpdir);
- refdir = slurpfile(NULL, "%s/refdir", tmpdir);
+ refdir = refdir_alloc = slurpfile(NULL, "%s/refdir", tmpdir);
p = refdir + strlen(refdir);
while (p[-1] == '\n') {
--p;
@@ -603,10 +700,14 @@ int main(int argc, char **argv)
*/
if (!quiet_flag) {
printf("\n");
- printf("%d of %d test groups reported failures\n",
+ printf("%d of %d tests reported failures\n",
tests_failed, tests_run);
- printf(" Total of %d individual tests failed.\n", failures);
- printf(" Total of %d individual tests were skipped.\n", skips);
+ printf(" Total of %d assertions checked.\n", assertions);
+ printf(" Total of %d assertions failed.\n", failures);
+ printf(" Total of %d assertions skipped.\n", skips);
}
+
+ free(refdir_alloc);
+
return (tests_failed);
}
diff --git a/archivers/libarchive/files/libarchive/test/read_open_memory.c b/archivers/libarchive/files/libarchive/test/read_open_memory.c
index 8be3d63eaef..aacb0123fda 100644
--- a/archivers/libarchive/files/libarchive/test/read_open_memory.c
+++ b/archivers/libarchive/files/libarchive/test/read_open_memory.c
@@ -24,7 +24,7 @@
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/read_open_memory.c,v 1.1 2007/07/13 15:12:52 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/read_open_memory.c,v 1.2 2008/01/01 22:28:04 kientzle Exp $");
#include <errno.h>
#include <stdlib.h>
diff --git a/archivers/libarchive/files/libarchive/test/test.h b/archivers/libarchive/files/libarchive/test/test.h
index 940b0274bf5..72d611d77d1 100644
--- a/archivers/libarchive/files/libarchive/test/test.h
+++ b/archivers/libarchive/files/libarchive/test/test.h
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $FreeBSD: src/lib/libarchive/test/test.h,v 1.6 2007/07/14 17:52:01 kientzle Exp $
+ * $FreeBSD: src/lib/libarchive/test/test.h,v 1.8 2008/02/19 05:52:30 kientzle Exp $
*/
/* Every test program should #include "test.h" as the first thing. */
@@ -31,8 +31,9 @@
* The goal of this file (and the matching test.c) is to
* simplify the very repetitive test-*.c test programs.
*/
-
+#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
+#endif
#include <errno.h>
#include <fcntl.h>
@@ -40,7 +41,9 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#ifndef _WIN32
#include <unistd.h>
+#endif
#include <wchar.h>
#ifdef USE_DMALLOC
@@ -90,6 +93,14 @@
/* As above, but raw blocks of bytes. */
#define assertEqualMem(v1, v2, l) \
test_assert_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
+/* Assert two files are the same; allow printf-style expansion of second name.
+ * See below for comments about variable arguments here...
+ */
+#define assertEqualFile \
+ test_setup(__FILE__, __LINE__);test_assert_equal_file
+/* Assert that a file is empty; supports printf-style arguments. */
+#define assertEmptyFile \
+ test_setup(__FILE__, __LINE__);test_assert_empty_file
/*
* This would be simple with C99 variadic macros, but I don't want to
@@ -98,13 +109,15 @@
* but effective.
*/
#define skipping \
- skipping_setup(__FILE__, __LINE__);test_skipping
+ test_setup(__FILE__, __LINE__);test_skipping
/* Function declarations. These are defined in test_utility.c. */
void failure(const char *fmt, ...);
-void skipping_setup(const char *, int);
+void test_setup(const char *, int);
void test_skipping(const char *fmt, ...);
-void test_assert(const char *, int, int, const char *, void *);
+int test_assert(const char *, int, int, const char *, void *);
+void test_assert_empty_file(const char *, ...);
+void test_assert_equal_file(const char *, const char *, ...);
void test_assert_equal_int(const char *, int, int, const char *, int, const char *, void *);
void test_assert_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
void test_assert_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_gtar.c b/archivers/libarchive/files/libarchive/test/test_compat_gtar.c
new file mode 100644
index 00000000000..3451a76ebbc
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_gtar.c
@@ -0,0 +1,110 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_gtar.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
+
+/*
+ * Verify our ability to read sample files created by GNU tar.
+ * It should be easy to add any new sample files sent in by users
+ * to this collection of tests.
+ */
+
+/* Copy this function for each test file and adjust it accordingly. */
+
+/*
+ * test_compat_gtar_1.tgz exercises reading long filenames and
+ * symlink targets stored in the GNU tar format.
+ */
+static void
+test_compat_gtar_1(void)
+{
+ char name[1024];
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ sprintf(name, "%s/test_compat_gtar_1.tgz", refdir);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890",
+ archive_entry_pathname(ae));
+ assertEqualInt(1197179003, archive_entry_mtime(ae));
+ assertEqualInt(1000, archive_entry_uid(ae));
+ assertEqualString("tim", archive_entry_uname(ae));
+ assertEqualInt(1000, archive_entry_gid(ae));
+ assertEqualString("tim", archive_entry_gname(ae));
+ assertEqualInt(0100644, archive_entry_mode(ae));
+
+ /* Read second entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij",
+ archive_entry_pathname(ae));
+ assertEqualString(
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890",
+ archive_entry_symlink(ae));
+ assertEqualInt(1197179043, archive_entry_mtime(ae));
+ assertEqualInt(1000, archive_entry_uid(ae));
+ assertEqualString("tim", archive_entry_uname(ae));
+ assertEqualInt(1000, archive_entry_gid(ae));
+ assertEqualString("tim", archive_entry_gname(ae));
+ assertEqualInt(0120755, archive_entry_mode(ae));
+
+ /* Verify the end-of-archive. */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify that the format detection worked. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_GZIP);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#else
+ archive_read_finish(a);
+#endif
+}
+
+
+DEFINE_TEST(test_compat_gtar)
+{
+ test_compat_gtar_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_gtar_1.tgz.uu b/archivers/libarchive/files/libarchive/test/test_compat_gtar_1.tgz.uu
new file mode 100644
index 00000000000..f088a4a5fe6
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_gtar_1.tgz.uu
@@ -0,0 +1,9 @@
+begin 644 test_compat_gtar_1.tgz
+M'XL(`,N`6T<``^W62PZ",!`&X!YE3@`SI:6Z<R^7\(&*+Q+%>'W+PJB)43=4
+MJO^W:1.Z:#KYATG2)!T5]7Y95/N-Z@:UF)ZO7B9"-TPD[%@4%1W=Y\'IV$P.
+M1.I0U\VK<^=566Y#7"@LT9FQN1L,.>[=M]\Q5@%JHX0Y-Z;-NSC+]^LM\S[R
+M.G?,XC(B+:Q949"B7O/?5+N7Y]Y]CU32U_[OZS_NZ#X/T/][T\/1_\/K;?XQ
+M_P4QF<[FY6*YJM9Q[[[]CK$*4!O_CV%G[6?SGS9^_C/&:I]_'6(X_?/Y#P``
+4````````````?L\%KFMT6@`H````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c
new file mode 100644
index 00000000000..103b349da0e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c
@@ -0,0 +1,104 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink.c,v 1.1 2008/01/31 07:47:38 kientzle Exp $");
+
+/*
+ * Background: There are two written standards for the tar file format.
+ * The first is the POSIX 1988 "ustar" format, the second is the 2001
+ * "pax extended" format that builds on the "ustar" format by adding
+ * support for generic additional attributes. Buried in the details
+ * is one frustrating incompatibility: The 1988 standard says that
+ * tar readers MUST ignore the size field on hardlink entries; the
+ * 2001 standard says that tar readers MUST obey the size field on
+ * hardlink entries. libarchive tries to navigate this particular
+ * minefield by using auto-detect logic to guess whether it should
+ * or should not obey the size field.
+ *
+ * This test tries to probe the boundaries of such handling; the test
+ * archives here were adapted from real archives created by real
+ * tar implementations that are (as of early 2008) apparently still
+ * in use.
+ */
+
+static void
+test_compat_tar_hardlink_1(void)
+{
+ char name[1024];
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ sprintf(name, "%s/test_compat_tar_hardlink_1.tar", refdir);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry, which is a regular file. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("xmcd-3.3.2/docs_d/READMf",
+ archive_entry_pathname(ae));
+ assertEqualString(NULL, archive_entry_hardlink(ae));
+ assertEqualInt(321, archive_entry_size(ae));
+ assertEqualInt(1082575645, archive_entry_mtime(ae));
+ assertEqualInt(1851, archive_entry_uid(ae));
+ assertEqualInt(3, archive_entry_gid(ae));
+ assertEqualInt(0100444, archive_entry_mode(ae));
+
+ /* Read second entry, which is a hard link at the end of archive. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("xmcd-3.3.2/README",
+ archive_entry_pathname(ae));
+ assertEqualString(
+ "xmcd-3.3.2/docs_d/READMf",
+ archive_entry_hardlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1082575645, archive_entry_mtime(ae));
+ assertEqualInt(1851, archive_entry_uid(ae));
+ assertEqualInt(3, archive_entry_gid(ae));
+ assertEqualInt(0100444, archive_entry_mode(ae));
+
+ /* Verify the end-of-archive. */
+ /*
+ * This failed in libarchive 2.4.12 because the tar reader
+ * tried to obey the size field for the hard link and ended
+ * up running past the end of the file.
+ */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify that the format detection worked. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+DEFINE_TEST(test_compat_tar_hardlink)
+{
+ test_compat_tar_hardlink_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu
new file mode 100644
index 00000000000..95dba54c256
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu
@@ -0,0 +1,39 @@
+$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink_1.tar.uu,v 1.1 2008/01/31 07:47:38 kientzle Exp $
+begin 644 test_compat_tar_hardlink_1.tar
+M>&UC9"TS+C,N,B]D;V-S7V0O4D5!1$UF````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````"`@(#0T-"``("`S-#<S(``@("`@(#,@`"`@("`@("`@-3`Q
+M(#$P,#0Q-30U-#,U("`@-S8U-``@````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!X>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'@`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````'AM8V0M,RXS+C(O
+M4D5!1$U%````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````````@
+M("`T-#0@`"`@,S0W,R``("`@("`S(``@("`@("`@(#4P,2`Q,#`T,34T-30S
+M-2`@,3(R,#<`(#%X;6-D+3,N,RXR+V1O8W-?9"]214%$368`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+&````````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_zip.c b/archivers/libarchive/files/libarchive/test/test_compat_zip.c
new file mode 100644
index 00000000000..0f6d1d00b1b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_zip.c
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_zip.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
+
+/* Copy this function for each test file and adjust it accordingly. */
+static void
+test_compat_zip_1(void)
+{
+ char name[1024];
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ sprintf(name, "%s/test_compat_zip_1.zip", refdir);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("META-INF/MANIFEST.MF", archive_entry_pathname(ae));
+
+ /* Read second entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("tmp.class", archive_entry_pathname(ae));
+
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ZIP);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#else
+ archive_read_finish(a);
+#endif
+}
+
+
+DEFINE_TEST(test_compat_zip)
+{
+ test_compat_zip_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu b/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu
new file mode 100644
index 00000000000..e13a6cac29d
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu
@@ -0,0 +1,14 @@
+begin 644 test_compat_zip_1.zip
+M4$L#!!0`"``(``B$@S<````````````````4````345402U)3D8O34%.249%
+M4U0N34;S3<S+3$LM+M$-2RTJSLS/LU(PU#/@Y7+,0Q)Q+$A,SDA5`(H!)<U!
+MTLY%J8DEJ2FZ3I56"BF9B4DY^;J&>J9Z!O$&YKI)!H8*&L&E>0J^F<E%^<65
+MQ26IN<4*GGG)>IJ\7+Q<`%!+!PAHTY\490```'$```!02P,$%``(``@`"(2#
+M-P````````````````D```!T;7`N8VQA<W,[]6_7/@8&!D,&+G8&#G8&3BX&
+M1@86'@8V!E9&!F8-S3!&!C:;S+S,$CN@L'-^2BHC@T!68EFB?DYB7KJ^?U)6
+M:G()4&%);@&#(@,34"\(,`(AT``@R0[D"8+Y#`RL6ML9F#>"%3```%!+!P@+
+M(*8V:````'8```!02P$"%``4``@`"``(A(,W:-.?%&4```!Q````%```````
+M````````````````345402U)3D8O34%.249%4U0N34902P$"%``4``@`"``(
+MA(,W"R"F-F@```!V````"0````````````````"G````=&UP+F-L87-S4$L%
+J!@`````"``(`>0```$8!```7`%!R;T=U87)D+"!V97)S:6]N(#0N,"XQ
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_empty_write.c b/archivers/libarchive/files/libarchive/test/test_empty_write.c
new file mode 100644
index 00000000000..540ddf110ba
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_empty_write.c
@@ -0,0 +1,118 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_empty_write.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
+
+DEFINE_TEST(test_empty_write)
+{
+ char buff[32768];
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+
+ /*
+ * Exercise a zero-byte write to a gzip-compressed archive.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_gzip(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+
+ /* THE TEST: write zero bytes to this entry. */
+ /* This used to crash. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertA(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+
+
+ /*
+ * Again, with bzip2 compression.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_bzip2(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+
+ /* THE TEST: write zero bytes to this entry. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertA(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+
+
+ /*
+ * For good measure, one more time with no compression.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+
+ /* THE TEST: write zero bytes to this entry. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assertA(0 == archive_write_finish(a));
+#else
+ archive_write_finish(a);
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_entry.c b/archivers/libarchive/files/libarchive/test/test_entry.c
index cb66a85a8c0..bf41aac4891 100644
--- a/archivers/libarchive/files/libarchive/test/test_entry.c
+++ b/archivers/libarchive/files/libarchive/test/test_entry.c
@@ -25,6 +25,8 @@
#include "test.h"
__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry.c,v 1.2 2007/07/06 15:43:11 kientzle Exp $");
+#include <locale.h>
+
/*
* Most of these tests are system-independent, though a few depend on
* features of the local system. Such tests are conditionalized on
@@ -670,6 +672,39 @@ DEFINE_TEST(test_entry)
#endif
#endif
+ /*
+ * Exercise the character-conversion logic, if we can.
+ */
+ failure("Can't exercise charset-conversion logic.");
+ if (assert(NULL != setlocale(LC_ALL, "de_DE.UTF-8"))) {
+ /* A filename that cannot be converted to wide characters. */
+ archive_entry_copy_pathname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_pathname_w(e));
+ //failure("Converting invalid chars to UTF-8 should fail.");
+ //assert(NULL == archive_entry_pathname_utf8(e));
+
+ /* A group name that cannot be converted. */
+ archive_entry_copy_gname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_gname_w(e));
+
+ /* A user name that cannot be converted. */
+ archive_entry_copy_uname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_uname_w(e));
+
+ /* A hardlink target that cannot be converted. */
+ archive_entry_copy_hardlink(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_hardlink_w(e));
+
+ /* A symlink target that cannot be converted. */
+ archive_entry_copy_symlink(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_symlink_w(e));
+ }
+
/* Release the experimental entry. */
archive_entry_free(e);
}
diff --git a/archivers/libarchive/files/libarchive/test/test_entry_strmode.c b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
index 43b01b42232..2941c4a4c38 100644
--- a/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
+++ b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_entry_strmode.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
DEFINE_TEST(test_entry_strmode)
{
diff --git a/archivers/libarchive/files/libarchive/test/test_link_resolver.c b/archivers/libarchive/files/libarchive/test/test_link_resolver.c
new file mode 100644
index 00000000000..24827b0f222
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_link_resolver.c
@@ -0,0 +1,222 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+static void test_link_resolver_basic(void)
+{
+ struct archive_entry *entry;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+
+ /* Create an entry with only 1 link and try to register it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 1);
+
+ /* Shouldn't match anything. */
+ assertEqualString(NULL, archive_entry_linkresolve(resolver, entry));
+ /* Still shouldn't match anything. */
+ assertEqualString(NULL, archive_entry_linkresolve(resolver, entry));
+
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_ino(entry, 2);
+ /* Shouldn't match, since we haven't seen it before. */
+ assertEqualString(NULL, archive_entry_linkresolve(resolver, entry));
+ /* Should match, since we have seen it once before. */
+ archive_entry_set_pathname(entry, "test2");
+ assertEqualString("test1", archive_entry_linkresolve(resolver, entry));
+ /* Should not match, since we've seen both links. */
+ assertEqualString(NULL, archive_entry_linkresolve(resolver, entry));
+
+ archive_entry_free(entry);
+ archive_entry_linkresolver_free(resolver);
+}
+
+static void test_linkify_tar(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_ENTRY_LINKIFY_LIKE_TAR);
+
+ /* Create an entry with only 1 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Now, try again with an entry that has 2 links. */
+ archive_entry_set_pathname(entry, "test2");
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_ino(entry, 2);
+ archive_entry_linkify(resolver, &entry, &e2);
+ /* Shouldn't be altered, since it wasn't seen before. */
+ assert(e2 == NULL);
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+ assertEqualInt(10, archive_entry_size(entry));
+
+ /* Match again and make sure it does get altered. */
+ archive_entry_linkify(resolver, &entry, &e2);
+ assert(e2 == NULL);
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualString("test2", archive_entry_hardlink(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+
+
+ archive_entry_free(entry);
+ archive_entry_linkresolver_free(resolver);
+}
+
+static void test_linkify_old_cpio(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO);
+
+ /* Create an entry with 2 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Still shouldn't be matched. */
+ archive_entry_linkify(resolver, &entry, &e2);
+ assert(e2 == NULL);
+ assertEqualString("test1", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+ assertEqualInt(10, archive_entry_size(entry));
+
+ archive_entry_free(entry);
+ archive_entry_linkresolver_free(resolver);
+}
+
+static void test_linkify_new_cpio(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO);
+
+ /* Create an entry with only 1 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Now, try again with an entry that has 3 links. */
+ archive_entry_set_pathname(entry, "test2");
+ archive_entry_set_nlink(entry, 3);
+ archive_entry_set_ino(entry, 2);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* First time, it just gets swallowed. */
+ assert(entry == NULL);
+ assert(e2 == NULL);
+
+ /* Match again. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test3");
+ archive_entry_set_ino(entry, 2);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Should get back "test2" and nothing else. */
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+ archive_entry_free(entry);
+ assert(NULL == e2);
+ archive_entry_free(e2); /* This should be a no-op. */
+
+ /* Match a third time. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test4");
+ archive_entry_set_ino(entry, 2);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 3);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Should get back "test3". */
+ assertEqualString("test3", archive_entry_pathname(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+
+ /* Since "test4" was the last link, should get it back also. */
+ assertEqualString("test4", archive_entry_pathname(e2));
+ assertEqualInt(10, archive_entry_size(e2));
+
+ archive_entry_free(entry);
+ archive_entry_free(e2);
+ archive_entry_linkresolver_free(resolver);
+}
+
+DEFINE_TEST(test_link_resolver)
+{
+ test_link_resolver_basic();
+ test_linkify_tar();
+ test_linkify_old_cpio();
+ test_linkify_new_cpio();
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
new file mode 100644
index 00000000000..770c6e3b136
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
@@ -0,0 +1,132 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+#include <locale.h>
+
+/*
+ * Pax interchange is supposed to encode filenames into
+ * UTF-8. Of course, that's not always possible. This
+ * test is intended to verify that filenames always get
+ * stored and restored correctly, regardless of the encodings.
+ */
+
+DEFINE_TEST(test_pax_filename_encoding)
+{
+ char buff[65536];
+ /*
+ * \314\214 is a valid 2-byte UTF-8 sequence.
+ * \374 is invalid in UTF-8.
+ */
+ char filename[] = "abc\314\214mno\374xyz";
+ char longname[] = "abc\314\214mno\374xyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ ;
+ size_t used;
+ struct archive *a;
+ struct archive_entry *entry;
+
+ /*
+ * We need a starting locale which has invalid sequences.
+ * de_DE.UTF-8 seems to be commonly supported.
+ */
+ /* If it doesn't exist, just warn and return. */
+ failure("We need a suitable locale for the encoding tests.");
+ if (!assert(NULL != setlocale(LC_ALL, "de_DE.UTF-8")))
+ return;
+
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_pax(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_set_bytes_per_block(a, 0));
+ assertEqualInt(0,
+ archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set pathname, gname, uname, hardlink to nonconvertible values. */
+ archive_entry_copy_pathname(entry, filename);
+ archive_entry_copy_gname(entry, filename);
+ archive_entry_copy_uname(entry, filename);
+ archive_entry_copy_hardlink(entry, filename);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set path, gname, uname, and symlink to nonconvertible values. */
+ archive_entry_copy_pathname(entry, filename);
+ archive_entry_copy_gname(entry, filename);
+ archive_entry_copy_uname(entry, filename);
+ archive_entry_copy_symlink(entry, filename);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set pathname to a very long nonconvertible value. */
+ archive_entry_copy_pathname(entry, longname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assertEqualInt(0, archive_write_close(a));
+ assertEqualInt(0, archive_write_finish(a));
+
+ /*
+ * Now read the entries back.
+ */
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(0, archive_read_support_format_tar(a));
+ assertEqualInt(0, archive_read_open_memory(a, buff, used));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ assertEqualString(filename, archive_entry_gname(entry));
+ assertEqualString(filename, archive_entry_uname(entry));
+ assertEqualString(filename, archive_entry_hardlink(entry));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ assertEqualString(filename, archive_entry_gname(entry));
+ assertEqualString(filename, archive_entry_uname(entry));
+ assertEqualString(filename, archive_entry_symlink(entry));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(longname, archive_entry_pathname(entry));
+
+ assertEqualInt(0, archive_read_close(a));
+ assertEqualInt(0, archive_read_finish(a));
+}
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
index c6eb8312165..1d80ef96a6a 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_cpio_odc.c,v 1.1 2007/03/03 07:37:37 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_cpio_odc.c,v 1.2 2008/01/01 22:28:04 kientzle Exp $");
static unsigned char archive[] = {
'0','7','0','7','0','7','0','0','2','0','2','5','0','7','4','6','6','1','0',
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
index 60ad5ba64cd..ef3c5d25d30 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.6 2007/08/18 21:53:25 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse.c,v 1.7 2008/01/01 22:28:04 kientzle Exp $");
struct contents {
@@ -171,570 +171,6 @@ struct archive_contents {
{ NULL, NULL }
};
-
-/* Old GNU tar sparse format, as created by gtar 1.13 */
-static unsigned char archive_old_gtar_1_13[] = {
-31,139,8,0,30,'%',193,'F',0,3,237,215,'K','n',219,'H',20,133,'a',246,'N',
-180,129,6,170,'n',189,22,210,'+',208,' ',131,12,146,14,',','g',255,'}',201,
-192,142,17,29,'(','A',159,24,'l',160,255,207,3,219,'e',193,186,'$',127,241,
-'q',251,'r','}',186,'}',216,222,'U',169,165,204,222,183,'R','J',']',163,188,
-253,190,139,252,'u',171,'e',206,18,17,189,205,'m','_',')',177,']',254,'z',
-223,177,190,249,'z','{',190,'>',']','.',219,243,199,'O',15,'_',247,179,191,
-255,'k',251,'.','h',179,231,'>','z',221,'#',175,'?',231,'^',10,177,'^',219,
-':',188,172,239,'K',15,223,160,246,'o',175,250,253,211,'_',127,255,191,196,
-255,8,253,0,231,185,29,215,255,'x',215,247,'x','x',253,175,'=',218,221,245,
-'?','j',31,'\\',255,31,'\\',255,'[','o','j','}','E',233,'?',174,255,'Q',202,
-'X','u',212,213,212,'M',194,'~',167,213,'J',31,226,191,197,'\\','e',138,245,
-22,163,'/',181,158,27,161,182,162,'G',12,181,21,'}',214,170,182,'"','G',29,
-'w','[',177,175,143,'Y',213,156,'3','c','Q','s',206,209,170,154,'s',213,':',
-139,'Z',207,157,'-',230,220,227,157,'b',206,154,'{','-',196,156,185,15,218,
-20,'s',214,',','=',196,156,'5',223,'s',138,'9','k',180,213,196,156,'5','V',
-30,'O',177,190,'G',161,230,'l','+',214,'}',21,175,199,191,246,'V',155,154,
-183,207,181,212,188,'#','f','S',243,142,'c',171,239,215,'g','4','U','w',157,
-'3','T',221,'G',196,'j',191,230,'f',23,'1','g',228,';','w','1','g',148,172,
-'H',204,25,181,198,16,'s','F','~','F','T',191,217,196,'R',253,230,185,'j',
-170,'~',143,143,147,154,'3',15,'O','U','s',246,220,0,'5','g',238,132,'P',
-'s',246,'5',167,154,'s',180,161,250,141,177,218,'}',191,223,143,127,30,205,
-'P',29,31,31,127,'5',239,218,191,212,250,'<','6',227,199,245,150,19,'7','1',
-'o','+','3',255,145,'X',175,'Q','U',199,'-',247,210,'}',199,251,233,168,'N',
-213,239,'q',154,18,'s',182,204,189,171,'9','s',247,21,'5','g',198,219,213,
-156,'=',207,130,'j',206,145,225,169,'9',247,'U','5','g','^',247,'T',191,'/',
-167,211,251,245,181,134,154,'3',15,'s','U','s',230,'^',27,15,142,127,223,
-247,136,152,'7','?','<','U','u',220,'3','z',213,'q',207,15,180,234,248,'8',
-253,139,'y','{',134,'7',197,188,'=','s',12,177,'_',243,206,' ',239,'"',196,
-'z',207,'3',134,154,'3','?',133,170,223,'>',242,'D',172,230,28,'#','T',191,
-199,'e','J',205,'9','3','/','5','g','~','l',154,154,'s','e','0','b',206,177,
-167,'\'',230,28,185,'G','U',191,251,177,'W',253,142,'<',209,171,'~',143,203,
-233,131,227,'?',242,196,'t',127,215,176,175,175,'P',247,5,'#','s','Q',247,
-5,'#',195,'T',247,5,'#',15,180,234,'8','O',218,']','u',156,135,161,169,142,
-143,203,191,154,'s',238,'W',0,181,190,127,137,245,227,'f',232,205,'z',145,
-'7','F',248,'%','<',191,195,'A','?','p',208,15,28,244,3,7,253,192,'A','?',
-'p',184,253,208,31,28,244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,3,7,253,192,'A','?','p',208,15,
-28,'<',255,227,'L',244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,3,7,253,192,'A','?','p',208,15,
-28,'<',255,227,'L',244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,3,7,253,192,'A','?','p',208,15,
-28,'<',255,227,'L',244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,3,7,253,192,'A','?','p',208,15,
-28,'<',255,227,'L',244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,3,7,253,192,'A','?','p',208,15,
-28,'<',255,227,'L',244,3,7,253,192,'A','?','p',208,15,28,244,3,7,253,192,
-193,243,'?',206,'D','?','p',208,15,28,244,227,249,252,247,231,'?','o','_',
-174,'O',183,15,239,247,30,165,150,'2','{',223,'J',')','u',141,242,246,251,
-139,173,150,'9','K','D',244,'6',243,245,'5',127,218,'.',229,253,'F',250,238,
-235,237,249,250,'t',185,'l',207,31,'?','=','|',221,207,254,14,0,0,0,0,0,0,
-0,255,'1',255,0,178,'s',140,'2',0,240,0,0};
-
-
-#if ARCHIVE_VERSION_STAMP >= 1009000
-/* libarchive < 1.9 does not support this. */
-/* GNU tar "posix" sparse format 0.0, as created by gtar 1.17 */
-static unsigned char archive_0_0_gtar_1_17[] = {
-31,139,8,0,31,'%',193,'F',0,3,237,217,207,'n',218,'X',20,199,'q',214,'<',
-5,'/','0',228,222,'s','}',255,'x',193,'z',186,26,'u',211,7,240,164,174,20,
-205,'$',169,'0',145,'2',243,244,'5','%',205,144,200,193,'p',14,141,203,232,
-251,217,'P','A',14,'8','9',191,'[',253,',',150,'W',31,155,199,15,'m',243,
-185,']','w',203,232,156,148,171,238,'k',179,238,218,217,249,184,'^',170,170,
-237,163,207,209,237,'?','~','W','9',153,'y',151,146,19,145,'*',228,153,243,
-161,'J','2','[','<',158,241,26,222,244,208,'m',154,'u',127,')',214,247,'y',
-250,']',158,31,'/',132,228,197,239,127,'|','Z',238,'v',190,236,'n',254,'m',
-'W',193,'W','1','K',153,'K',218,127,233,238,225,246,207,191,239,175,255,234,
-'V','a','.','e',255,149,251,'/','_',186,'v',179,170,'{','!',205,'_',190,225,
-'v',234,159,'M',219,173,162,151,185,212,3,'c',190,31,'+','Y','N',158,'{',
-190,202,'8','8',231,230,226,22,205,230,230,182,']','y','_',178,'K',193,'e',
-191,'}',238,250,229,'s','n','>',245,6,166,'u',246,195,'>','`',228,252,203,
-246,184,252,'w',254,'S',127,254,'}',14,'a',182,'x',151,'C',244,227,252,247,
-177,'8',248,'s','c',175,'_',232,249,183,'j',166,190,0,'\\','4',242,'3',173,
-229,'[',253,'O',206,247,25,135,255,255,247,193,247,157,239,'U',255,139,'1',
-210,255,222,195,203,'*',247,189,255,213,245,'n','/',3,149,'l','W',0,235,250,
-151,'h',128,178,157,'s',229,244,230,216,207,229,170,':','y',174,234,231,'R',
-'q','\'',207,197,237,156,'?',253,239,146,250,185,24,'O',255,187,148,']',2,
-'O',159,'S',238,175,30,223,'_','p','C','{','w',227,11,28,30,244,227,27,28,
-30,148,241,21,14,15,134,241,29,14,15,'V',227,'K',28,30,'L',227,'[','|','c',
-'p','|',141,195,131,'Y',187,199,162,221,'c',173,220,163,'8',229,30,197,'+',
-247,'(',162,220,163,'T',202,'=','J',165,220,163,'D',229,30,'%',')',247,'(',
-'Y',187,199,162,221,'c',173,220,'c','p',202,'=',6,'Q',238,'1',136,'r',143,
-'!','(',247,24,'*',229,30,'C','T',238,'1','$',229,30,'C',214,238,177,'(',
-247,248,'t',28,'O',191,212,202,')',247,'X',29,209,'o',134,7,143,'(','8',195,
-131,'G','4',156,225,193,'#','*',206,240,224,17,29,'g','x',240,136,146,'3',
-'<','x','D',203,'y','c','P',187,'G','m',207,137,218,158,19,181,'=','\'','j',
-'{','N',212,246,156,168,237,'9','Q',219,'s',162,182,231,'D','m',207,137,218,
-158,19,181,'=','\'','i','{','N',210,246,156,164,237,'9','I',219,'s',146,182,
-231,'$','m',207,'I',218,158,147,180,'=','\'','i','{','N',210,246,156,172,
-237,'9','Y',219,'s',178,182,231,'d','m',207,201,218,158,147,181,'=','\'',
-'k','{','N',214,246,156,172,237,'9','E',219,'s',138,182,231,20,'m',207,')',
-218,158,'S',180,'=',167,'h','{','N',209,246,156,162,237,'9','E',219,'s',138,
-182,231,20,'m',207,169,181,'=',167,214,246,156,'Z',219,'s','j','m',207,169,
-181,'=',167,214,246,156,'Z',219,'s','j','m',207,169,'G','z',142,175,3,'_',
-174,255,'_',236,150,'{',198,'/','{',6,28,252,254,199,'W',18,156,127,245,253,
-191,'8','I','|',255,127,9,248,254,22,22,228,7,22,228,7,22,228,7,22,228,7,
-22,228,7,22,214,252,144,'?','X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',
-144,31,'X',144,31,'X','p',255,143,')',145,31,'X',144,31,'X',144,31,'X',144,
-31,'X',144,31,'X',144,31,'X','p',255,143,')',145,31,'X',144,31,'X',144,31,
-'X',144,31,'X',144,31,'X',144,31,'X','p',255,143,')',145,31,'X',144,31,'X',
-144,31,'X',144,31,'X',144,31,'X',144,31,'X','p',255,143,')',145,31,'X',144,
-31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X','p',255,143,')',145,31,
-'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X','p',255,143,')',
-145,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X','p',255,
-143,')',145,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',
-'p',255,143,')',145,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,'X',144,
-31,'X','p',255,143,')',145,31,'X',144,31,'X',144,31,'X',144,31,'X',144,31,
-'X',144,31,'X','p',255,143,')',145,31,'X',144,31,'X',144,31,'X',144,31,'X',
-144,31,'X',144,31,'X','p',255,143,')',145,31,'X',144,31,'X',144,31,155,229,
-213,199,230,241,'C',219,'|','n',215,221,'2',':','\'',229,234,238,254,238,
-183,238,'k',179,238,218,'3','}',134,235,165,170,218,'>',250,28,221,254,227,
-'N',255,'o',239,'R','r','"','R',133,'<','s',190,146,232,'g',139,199,'3','}',
-254,'A',15,221,166,'Y',247,151,'b','}',159,167,'_',229,249,241,'B',136,'[',
-'4',155,155,219,'v',229,'}',201,'.',5,151,221,188,127,238,250,245,'s','S',
-'_','\'','~',142,179,31,246,1,163,231,223,237,159,255,212,159,127,137,210,
-159,255,'w','9','D','?',206,127,31,248,131,'?','7',246,250,133,158,127,0,
-0,0,0,0,0,0,0,0,0,0,0,0,192,'e',250,6,'X',180,13,'8',0,24,1,0};
-#endif
-
-#if ARCHIVE_VERSION_STAMP >= 1009000
-/* libarchive < 1.9 does not support this. */
-/* GNU tar "posix" sparse format 0.1, as created by gtar 1.17 */
-static unsigned char archive_0_1_gtar_1_17[] = {
-31,139,8,0,31,'%',193,'F',0,3,237,215,205,'n',26,'W',24,135,'q',214,'\\',
-5,23,224,194,249,'>','3',11,182,'m','V','U',164,170,23,'0','u','f','a','%',
-'v',',',198,150,172,'^','}',135,15,'\'',127,187,9,'T','z',137,167,'D',207,
-'o',195,4,'l','^','0',207,'!',231,',','W',239,187,167,'w','}',247,161,223,
-12,203,236,'\\',244,171,225,190,219,12,253,236,'|',220,168,164,180,189,245,
-'5',';',189,221,9,'9',204,188,'+',197,133,16,'R',172,'3',231,'c',202,'u',
-182,'x',':',227,'k',248,174,199,225,161,219,140,'/',197,250,'<',135,247,242,
-229,246,'B',132,186,248,237,247,'?',151,251,207,'|','9',220,252,221,175,163,
-31,255,250,161,153,135,162,15,221,'=',222,254,245,233,243,245,199,'a',29,
-'_','?',210,221,246,235,253,245,'<','{','}',228,182,187,'_',183,163,'X',174,
-178,15,'W','~',188,'l','j',216,']',31,134,'\\',185,'y','p',139,238,225,'f',
-'|',10,239,155,234,'J','t',213,'o',239,187,'~','y',159,155,'O',253,151,250,
-'9','-','W',227,231,245,199,238,227,250,245,230,'S',255,'C',190,2,'N',172,
-255,176,']','.','_',215,127,25,215,127,246,169,204,22,'o',178,136,158,215,
-255,152,219,209,159,';',245,248,133,174,127,171,'n',234,23,128,139,'F','?',
-211,'Z','~','o',255,23,206,'7',227,212,247,127,241,178,255,'K','n',187,255,
-203,'1',179,255,'{',11,161,249,215,254,175,'m','w',239,'`',220,133,213,'o',
-'o',0,219,246,245,'C','_','w',128,'a',238,'C','[',254,227,'&','0','l',175,
-']',179,223,16,142,215,'5',165,221,'u',26,175,'K',227,'v',215,'y','{',237,
-247,191,'[',198,235,156,247,191,219,236,255,206,251,'k','y',254,'V',158,223,
-';',25,224,189,'L',240,'A','F',248,'(','3','|',146,'!',190,200,20,'_',244,
-'m','T',157,211,232,156,'V',230,4,'\'','s',130,151,'9','!',200,156,144,'d',
-'N','H','2','\'','d',253,'{',21,153,19,170,206,'i','t','N','+','s',162,147,
-'9','1',200,156,24,'d','N',140,186,'9','O',250,193,'d',153,19,139,204,137,
-'U',231,'4','2',231,240,'v',220,225,31,'2','\'',233,231,159,'4',128,244,162,
-0,'M',' ','i',3,'I','#','H','Z','A',210,12,146,'v',144,181,131,172,29,'d',
-237,' ','k',7,'Y',';',200,218,'A',214,14,178,'v',144,181,131,172,29,20,237,
-160,'h',7,'E',';','(',218,'A',209,14,138,'v','P',180,131,162,29,20,237,160,
-'h',7,'U',';',168,218,'A',213,14,170,'v','P',181,131,170,29,'T',237,160,'j',
-7,'U',';','h',180,131,'F',';','h',180,131,'F',';','h',180,131,'F',';','h',
-180,131,230,197,151,193,139,'o',3,237,160,209,14,'Z',237,160,213,14,'Z',237,
-160,213,14,'Z',237,160,213,14,'Z',237,160,213,14,218,231,14,'|',27,255,231,
-231,219,'c',231,191,'s','m',1,142,254,255,239,'S',136,206,191,'>',255,133,
-228,'9',255,']',2,246,239,176,160,31,'X',208,15,',',232,7,22,244,3,11,250,
-129,133,181,31,250,131,5,253,192,130,'~','`','A','?',176,160,31,'X',208,15,
-',',232,7,22,156,255,'1','%',250,129,5,253,192,130,'~','`','A','?',176,160,
-31,'X',208,15,',','8',255,'c','J',244,3,11,250,129,5,253,192,130,'~','`',
-'A','?',176,160,31,'X','p',254,199,148,232,7,22,244,3,11,250,129,5,253,192,
-130,'~','`','A','?',176,224,252,143,')',209,15,',',232,7,22,244,3,11,250,
-129,5,253,192,130,'~','`',193,249,31,'S',162,31,'X',208,15,',',232,7,22,244,
-3,11,250,129,5,253,192,130,243,'?',166,'D','?',176,160,31,'X',208,15,',',
-232,7,22,244,3,11,250,129,5,231,127,'L',137,'~','`','A','?',176,160,31,'X',
-208,15,',',232,7,22,244,3,11,206,255,152,18,253,192,130,'~','`','A','?',176,
-160,31,'X',208,15,',',232,7,22,156,255,'1','%',250,129,5,253,192,130,'~',
-'`','A','?',176,160,31,'X',208,15,',','8',255,'c','J',244,3,11,250,129,5,
-253,192,130,'~','`','A','?',176,160,31,'X','p',254,199,148,232,7,22,244,3,
-11,250,177,'Y',174,222,'w','O',239,250,238,'C',191,25,150,217,185,232,'W',
-'w',159,239,'~',25,238,187,205,208,159,'i',134,27,149,148,182,183,190,'f',
-167,183,'{',227,181,'w',165,184,16,'B','J',227,253,'>',133,152,'g',139,167,
-'3',205,'?',234,'q','x',232,'6',227,'K',177,'>',207,225,173,'|',185,189,16,
-193,'-',186,135,155,219,'~',237,'}','S',']',137,174,186,249,'x',223,245,235,
-251,166,'~',157,248,'1',206,190,216,191,225,228,250,'w',178,254,'c',25,215,
-127,200,193,207,22,'o',178,136,158,215,255,24,252,209,159,';',245,248,133,
-174,127,0,0,0,0,0,240,243,251,7,233,'Q','N','O',0,240,0,0};
-#endif
-
-#if ARCHIVE_VERSION_STAMP >= 1009000
-/* libarchive < 1.9 does not support this. */
-/* GNU tar "posix" sparse format 1.0, as created by gtar 1.17 */
-static unsigned char archive_1_0_gtar_1_17[] = {
-31,139,8,0,' ','%',193,'F',0,3,237,215,205,'n',26,'I',20,134,'a',214,'\\',
-5,'7',16,168,255,234,'^','x',155,'d',21,'E',138,230,2,'Z','I','/',24,197,
-'N',4,142,'d',205,213,'O',1,182,245,217,178,'A',163,'C',220,131,242,'>',155,
-'n',183,'m',14,'?','o',161,174,229,234,243,'p',247,'q',28,190,141,155,237,
-'2',';',23,211,'j',251,'s',216,'l',199,217,249,184,166,164,180,';',250,154,
-157,30,247,130,207,'3',239,'J','q','!',132,148,218,'u',31,'S',142,179,197,
-221,25,159,195,171,'~','m','o',135,'M','{','*',214,199,185,127,'-',143,199,
-11,17,194,226,195,167,191,150,135,207,'|','y','=',252,253,'c','s',229,231,
-207,174,174,'o',218,'U','7',15,'E',175,222,12,215,227,213,225,'|',30,189,
-254,'f','3',14,223,183,235,127,198,171,232,'S',174,161,155,7,183,24,'n',215,
-237,207,189,239,170,'+',209,'U',191,187,246,245,233,'5','7',159,250,205,248,
-3,'-','W',237,131,251,178,255,220,222,175,191,143,191,229,'+',224,196,250,
-143,187,229,242,184,254,'c','i',235,'?',251,28,'f',139,'7','Y','D',15,235,
-191,181,'x',244,239,'N',253,254,'B',215,127,156,247,'M',',',243,236,195,220,
-183,211,174,134,253,249,195,218,'e','U',226,136,'a',234,'\'',128,139,'F',
-'?',211,'Z',190,'v',255,31,206,'7',227,244,253,127,'}','~',255,159,'c',229,
-254,255,'-',252,167,251,255,250,202,253,127,187,'[',8,'/','n',0,250,'~',255,
-'f',248,23,'v',0,129,29,192,255,193,177,251,255,'s','}',5,28,']',255,237,
-'6','3',':',255,252,254,'?',164,202,253,255,'[',232,251,215,'6',0,'a','w',
-238,186,195,'f',160,157,215,148,246,231,169,157,151,206,237,207,243,238,220,
-31,254,183,180,243,156,15,255,219,29,222,132,195,185,'<','~','/',143,239,
-157,12,240,'^','&',248,' ','#','|',148,25,'>',201,16,'_','d',138,'/',250,
-'2',170,206,233,'t','N','/','s',130,147,'9',193,203,156,16,'d','N','H','2',
-'\'','$',153,19,178,190,'_','E',230,132,170,'s',':',157,211,203,156,232,'d',
-'N',12,'2','\'',6,153,19,163,'n',204,146,'~','0','Y',230,196,'"','s','b',
-213,'9',157,204,185,127,'9',238,254,7,153,147,244,243,'O',26,'@','z','R',
-128,'&',144,180,129,164,17,'$',173,' ','i',6,'I',';',200,218,'A',214,14,178,
-'v',144,181,131,172,29,'d',237,' ','k',7,'Y',';',200,218,'A',214,14,138,'v',
-'P',180,131,162,29,20,237,160,'h',7,'E',';','(',218,'A',209,14,138,'v','P',
-180,131,170,29,'T',237,160,'j',7,'U',';',168,218,'A',213,14,170,'v','P',181,
-131,170,29,'t',218,'A',167,29,'t',218,'A',167,29,'t',218,'A',167,29,'t',218,
-'A',247,228,203,224,201,183,129,'v',208,'i',7,189,'v',208,'k',7,189,'v',208,
-'k',7,189,'v',208,'k',7,189,'v',208,'k',7,253,'C',7,190,143,220,'o','X',177,
-127,131,5,253,192,130,'~','`','A','?',176,160,31,'X',208,15,',',172,253,208,
-31,',',232,7,22,244,3,11,250,129,5,253,192,130,'~','`','A','?',176,'`',255,
-143,')',209,15,',',232,7,22,244,3,11,250,129,5,253,192,130,'~','`',193,254,
-31,'S',162,31,'X',208,15,',',232,7,22,244,3,11,250,129,5,253,192,130,253,
-'?',166,'D','?',176,160,31,'X',208,15,',',232,7,22,244,3,11,250,129,5,251,
-127,'L',137,'~','`','A','?',176,160,31,'X',208,15,',',232,7,22,244,3,11,246,
-255,152,18,253,192,130,'~','`','A','?',176,160,31,'X',208,15,',',232,7,22,
-236,255,'1','%',250,129,5,253,192,130,'~','`','A','?',176,160,31,'X',208,
-15,',',216,255,'c','J',244,3,11,250,129,5,253,192,130,'~','`','A','?',176,
-160,31,'X',176,255,199,148,232,7,22,244,3,11,250,129,5,253,192,130,'~','`',
-'A','?',176,'`',255,143,')',209,15,',',232,7,22,244,3,11,250,129,5,253,192,
-130,'~','`',193,254,31,'S',162,31,'X',208,15,',',232,7,22,244,3,11,250,129,
-5,253,192,130,253,'?',166,'D','?',176,160,31,'X',208,143,205,'r',245,'y',
-184,251,'8',14,223,198,205,'v',153,157,139,'i','u',243,227,230,221,246,231,
-176,217,142,'g',154,225,154,146,210,238,232,'k','v','z','<','h',231,222,149,
-226,'B',8,')',181,235,'>',133,'v','X',220,157,'i',254,'Q',191,182,183,195,
-166,'=',21,235,227,220,191,148,199,227,133,8,'n','1',220,174,175,199,'+',
-239,187,234,'J','t',213,205,219,181,175,207,175,'M',253,'<',241,'{',156,'}',
-177,191,224,228,250,'w',178,254,'c','i',235,'?',228,224,'g',139,'7','Y','D',
-15,235,191,5,127,244,239,'N',253,254,'B',215,'?',0,0,0,128,'?',199,191,200,
-'e','(',171,0,240,0,0};
-#endif
-
-
-/*
- * The following test archive is a little odd. First, it's uncompressed,
- * because that exercises some of the block reassembly code a little harder.
- * Second, it includes some leading comments prior to the sparse block
- * description. GNU tar doesn't do this, but I think it should, so I
- * want to ensure that libarchive correctly ignores such comments.
- */
-#if ARCHIVE_VERSION_STAMP >= 1009000
-
-/* Because it's uncompressed, I've made this archive a bit simpler. */
-struct archive_contents files_1_0b[] = {
- { "sparse", archive_contents_sparse },
- { "non-sparse", archive_contents_nonsparse },
- { NULL, NULL }
-};
-
-static unsigned char archive_1_0b[] = {
-'.','/','P','a','x','H','e','a','d','e','r','s','.','7','5','4','7','/','s',
-'p','a','r','s','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0','0','6','4','4',0,'0','0','0','1','7',
-'5','0',0,'0','0','0','1','7','5','0',0,'0','0','0','0','0','0','0','0','2',
-'1','5',0,'1','0','6','5','7','4','5','4','6','1','3',0,'0','1','3','4','2',
-'5',0,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s',
-'t','a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,'0','0','0','0','0','0','0',0,'0','0','0','0','0','0','0',0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,'2','2',' ','G','N','U','.','s','p','a','r','s',
-'e','.','m','a','j','o','r','=','1',10,'2','2',' ','G','N','U','.','s','p',
-'a','r','s','e','.','m','i','n','o','r','=','0',10,'2','6',' ','G','N','U',
-'.','s','p','a','r','s','e','.','n','a','m','e','=','s','p','a','r','s','e',
-10,'3','1',' ','G','N','U','.','s','p','a','r','s','e','.','r','e','a','l',
-'s','i','z','e','=','3','1','4','5','7','2','8',10,'2','0',' ','a','t','i',
-'m','e','=','1','1','8','6','8','7','9','7','9','9',10,'2','0',' ','c','t',
-'i','m','e','=','1','1','8','6','8','7','9','5','2','8',10,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'.','/','G',
-'N','U','S','p','a','r','s','e','F','i','l','e','.','7','5','4','7','/','s',
-'p','a','r','s','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,'0','0','0','0','6','4','4',0,'0','0','0','1','7','5','0',
-0,'0','0','0','1','7','5','0',0,'0','0','0','0','0','0','0','3','0','0','0',
-0,'1','0','6','5','7','4','5','4','0','5','0',0,'0','1','5','1','1','2',0,
-' ','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a',
-'r',0,'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,'0','0','0','0','0','0','0',0,'0','0','0','0','0','0','0',0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-
-/* 32 added bytes containing extra comments at beginning of sparse block */
-'#','!','g','n','u','-','s','p','a','r','s','e','-','f','o','r','m','a',
-'t',10,'#','f','o','r','m','a','t',':','1','.','0',10,
-
-'3',10,'9','9','9','9','3','6',10,'5','1','2',
-10,'1','9','9','9','8','7','2',10,'5','1','2',10,'3','1','4','5','7','2',
-'8',10,'0',10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-
-/* 32 removed bytes to preserve alignment. */
-/* 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, */
-0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'.','/','P','a',
-'x','H','e','a','d','e','r','s','.','7','5','4','7','/','n','o','n','-','s',
-'p','a','r','s','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,'0','0','0','0','6','4','4',0,'0','0','0','1','7','5','0',
-0,'0','0','0','1','7','5','0',0,'0','0','0','0','0','0','0','0','0','5','0',
-0,'1','0','6','5','7','4','5','4','6','1','3',0,'0','1','4','2','1','2',0,
-' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a',
-'r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
-'0','0','0','0','0',0,'0','0','0','0','0','0','0',0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,'2','0',' ','a','t','i','m','e','=','1','1','8','6','8','7',
-'9','7','9','9',10,'2','0',' ','c','t','i','m','e','=','1','1','8','6','8',
-'7','9','5','4','4',10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,'n','o','n','-','s','p','a','r','s','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-0,0,'0','0','0','0','6','4','4',0,'0','0','0','1','7','5','0',0,'0','0','0',
-'1','7','5','0',0,'0','0','0','0','0','0','0','0','0','0','1',0,'1','0','6',
-'5','7','4','5','4','0','7','0',0,'0','1','2','5','3','1',0,' ','0',0,0,0,
-0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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@ -742,29 +178,25 @@ static unsigned char archive_1_0b[] = {
*/
#define min(a,b) ((a) < (b) ? (a) : (b))
-/*
- * A convenience wrapper that adds the size of the buffer and the
- * name of the buffer to any call.
- */
-#define verify_archive(buffer, contents) \
- _verify_archive(buffer, sizeof(buffer), #buffer, contents)
-
static void
-_verify_archive(void *buffer, size_t length, const char *name,
- struct archive_contents *ac)
+verify_archive_file(const char *name, struct archive_contents *ac)
{
+ char path[512];
struct archive_entry *ae;
- struct archive *a;
int err;
/* data, size, offset of next expected block. */
struct contents expect;
/* data, size, offset of block read from archive. */
struct contents actual;
+ struct archive *a;
+
+ sprintf(path, "%s/%s", refdir, name);
assert((a = archive_read_new()) != NULL);
assert(0 == archive_read_support_compression_all(a));
assert(0 == archive_read_support_format_tar(a));
- assert(0 == read_open_memory(a, buffer, length, 3));
+ failure("Can't open %s", path);
+ assert(0 == archive_read_open_filename(a, path, 3));
while (ac->filename != NULL) {
struct contents *cts = ac->contents;
@@ -839,35 +271,51 @@ _verify_archive(void *buffer, size_t length, const char *name,
#endif
}
+
DEFINE_TEST(test_read_format_gtar_sparse)
{
- /*
- FILE *t = fopen("archive_1_0.tgz", "w");
- fwrite(archive_1_0, sizeof(archive_1_0), 1, t);
- fclose(t);
- */
-
- verify_archive(archive_old_gtar_1_13, files);
+ /* Two archives that use the "GNU tar sparse format". */
+ verify_archive_file("test_read_format_gtar_sparse_1_13.tgz", files);
+ verify_archive_file("test_read_format_gtar_sparse_1_17.tgz", files);
/*
- * libarchive < 1.9 doesn't support the newer sparse formats
- * from GNU tar 1.15 and 1.16.
+ * libarchive < 1.9 doesn't support the newer --posix sparse formats
+ * from GNU tar 1.15 and later.
*/
#if ARCHIVE_VERSION_STAMP < 1009000
- skipping("read support for GNUtar sparse format 0.0");
-#else
- verify_archive(archive_0_0_gtar_1_17, files);
-#endif
-#if ARCHIVE_VERSION_STAMP < 1009000
- skipping("read support for GNUtar sparse format 0.1");
+ skipping("read support for GNUtar --posix sparse formats");
#else
- verify_archive(archive_0_1_gtar_1_17, files);
-#endif
-#if ARCHIVE_VERSION_STAMP < 1009000
- skipping("read support for GNUtar sparse format 1.0");
-#else
- verify_archive(archive_1_0_gtar_1_17, files);
- verify_archive(archive_1_0b, files_1_0b);
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=0.1
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix00.tgz",
+ files);
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=0.1
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix01.tgz",
+ files);
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=1.0
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix10.tgz",
+ files);
+ /*
+ * The last test archive here is a little odd. First, it's
+ * uncompressed, because that exercises some of the block
+ * reassembly code a little harder. Second, it includes some
+ * leading comments prior to the sparse block description.
+ * GNU tar doesn't do this, but I think it should, so I want
+ * to ensure that libarchive correctly ignores such comments.
+ * Dump the file, looking for "#!gnu-sparse-format" starting
+ * at byte 0x600.
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix10_modified.tar",
+ files);
#endif
}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu
new file mode 100644
index 00000000000..a298e59fa08
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_13.tgz.uu
@@ -0,0 +1,26 @@
+begin 644 test_read_format_gtar_sparse_1_13.tgz
+M'XL(`&&";$<``^W72VX;1Q2%X<Y.N($`=>NYD*Q``P\\L&.(\OYSNP/)LGE`
+M!SDF.D#^SP,G94&\7?VS']<O3\_7#]M#E2AE]KZ54F*-\O[O7<W_W:*LUJ)$
+M]%R/M>;:+G\\=JR_?;V^/#U?+MO+QT]W?^YG__ZO[5O09L\]>MN1M__.7:IB
+M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Z
+M@8-^X*`?.'C_QYGH!P[Z@8-^X*`?..@'#OJ!@_=_G(E^X*`?..@'#OJ!@W[@
+MH!\X>/_'F>@'#OJ!@WX\G__\_/OUR]/S]</C/J-$*;/WK902:Y3W?[_:HJS6
+MHD3TR)^/&F6[E,>-],W7Z\O3\^6RO7S\=/?G?O;O`````````/`?\Q>.)E`.
+$`/``````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu
new file mode 100644
index 00000000000..3f3127124a1
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17.tgz.uu
@@ -0,0 +1,26 @@
+begin 644 test_read_format_gtar_sparse_1_17.tgz
+M'XL(`&&";$<``^W776X3611%83,33Z"E>^[O0'H$?N"!!V@4A_GWJ8*$".\V
+MK=Y8U1+KB\#H)L2G;BV77=?/EZ?K^]-#E31[WQYCC?+V<5/SSRG*:BU*1,_U
+M6"O:Z?SG8\?ZZLOU^?)T/I^>/WR\^W,_^_Y_MFU!FSVV7?BV(Z__SEVJ8CTW
+M:?>ROO_[WA.\_H=?[O+K?R5^(_1SK.M^_:\/?8Z[U__HM95X<_V/4ZDU6N7Z
+M_\_7_]9Z4^NKEO[C^KM2QHH1:]MF]>RY_WV(WU;G*E.LMSKZ4NMY$.HH>JU#
+M'46?$>HH<M1Q<Q3;^IBAYIS1AYISCA9JSA4QBUK/S19SYL.<8L[(7:MBSMR#
+M-L6<F7:M8L[(YYQBSJAM-3%GU)7G4ZQO4:@YVZKKMHK7\Q^]15/S]KF6FG?4
+MV=2\8S_JV_59FZH[YJRJ[CUBM:]YV$7,6?.9NYBSEJQ(S%DCZA!SUGR-J'ZS
+MB:7ZK34#%ON]OYS4G'EZ0LW9\P#4G+D)5<W9UYQJSM&&ZK>.U6[[_7[^\VQ6
+MU?'^\E?SKNU+K<_],'Y<;SEQ$_.V,O,7B?7(J[_8UY:[=-OQ=CF*J?K=+U-B
+MSGR;:5W-F=M7U)P9;U=S]KP*JCE'AJ?FW%;5G#,W2.SSR^7T=GVMH>;,TQQJ
+MSMRU<>?\]VU'Q+SYX@G5<<_H5<<]7]"JX_WR+^;M&=X4\_;,L8I][;E14\W9
+M\XJAYLQ7H>JWC[P0JSG'J*K?_6U*S3DS+S5GOFR:FG-E,&+.L:4GYARYHZK?
+M[=RK?D=>Z%6_^]OIG?,_\L)T^ZEA6U]5?2X8V^<T-6^&J3X7C#S1JN.\:'?5
+M<9Z&ICK>W_[5G'-[!U#KVY=8WS\,O5DO\H,1_A7NW^"@'SCH!P[Z@8-^X*`?
+M.-Q^Z`\.^H&#?N"@'SCH!P[Z@8-^X.#^'T>B'SCH!P[Z@8-^X*`?..@'#N[_
+M<23Z@8-^X*`?..@'#OJ!@W[@X/X?1Z(?..@'#OJ!@W[@H!\XZ`<.[O]Q)/J!
+M@W[@H!\XZ`<.^H&#?N#@_A]'HA\XZ`<.^H&#?N"@'SCH!P[N_W$D^H&#?N"@
+M'SCH!P[Z@8-^X.#^'T>B'SCH!P[Z@8-^X*`?..@'#N[_<23Z@8-^X*`?..@'
+M#OJ!@W[@X/X?1Z(?..@'#OJ!@W[@H!\XZ`<.[O]Q)/J!@W[@H!\XZ`<.^H&#
+M?N#@_A]'HA\XZ`<.^O%\^NO3']?/EZ?K^\<]1TFS]^TQUBAO'U^<HJS6HD3T
+M..7?M:S3N3QNI.^^7)\O3^?SZ?G#Q[L_][/O`P````````#P/_(W91GI)`#P
+"````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu
new file mode 100644
index 00000000000..41038960bc9
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tgz.uu
@@ -0,0 +1,29 @@
+begin 644 test_read_format_gtar_sparse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P?,?NS#6
+MU;=Y_G\)>'X+#?(##?(##?(##?(##?(##6U^R!\TR`\TR`\TR`\TR`\TR`\T
+MR`\TN/_'G,@/-,@/-,@/-,@/-,@/-,@/-+C_QYS(#S3(#S3(#S3(#S3(#S3(
+M#S2X_\><R`\TR`\TR`\TR`\TR`\TR`\TN/_'G,@/-,@/-,@/-,@/-,@/-,@/
+M-+C_QYS(#S3(#S3(#S3(#S3(#S3(#S2X_\><R`\TR`\TR`\TR`\TR`\TR`\T
+MN/_'G,@/-,@/-,@/-,@/-,@/-,@/-+C_QYS(#S3(#S3(#S3(#S3(#S3(#S2X
+M_\><R`\TR`\TR`\TR`\TR`\TR`\TN/_'G,@/-,@/-,@/-,@/-,@/-,@/-+C_
+MQYS(#S3(#S3(C\[J^F/_^&'H/PV;<>5S#.7Z[O[NI_%KOQF',WT/4\6NV[W:
+M%,SAZU[]NS7)>VNL[=S"U#]"6EP]GNG[O^EAW/:;>BG:K_/THSR_7@AGKOKM
+ME]MA;6W)KOAH[+*^=_/C>W-?)_X=9S_L#9/GWQR>?UO/OPNFGO]W.43?SW\-
+B_)O_;NKS"SW_`````````````````(#+]#?B%\M:`!@!````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu
new file mode 100644
index 00000000000..6d7963ed4f9
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tgz.uu
@@ -0,0 +1,27 @@
+begin 644 test_read_format_gtar_sparse_1_17_posix01.tgz
+M'XL(`&*";$<``^W7WVX:1QB&<8ZY"B[`Q?/-OYT]X+3-416IZ@5L'0ZLQHX%
+MMF3UZKN`';]V&SO21[PB>GXG;,#F`_,,F5F>?QSN/ZR'3^O-=IE:K7:^O1DV
+MV_7L>,*HYKR[M:X$O=V+)<XL="E9,,MQ%BSEFF>+^R.^AF^ZV]X.F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P_Z@0?]P(-^X,'Y'U.B'WC0#SSH!Q[T`P_Z@0?]P(/S
+M/Z9$/_"@'WC0C\_R_.-P_V$]?%IOMLO4:K7SZR_7OVQOALUV?:09851SWMU:
+M5X+>'HS7%KJ4+)CE-`N68['9XOY(\U]UM[T=-N-+\3[/PUOY>GLB8E@,MY=7
+MZY59WV*?:K#Y>-_%R_NF?IWX,8Z^V/_'F^L_Z/JW<?W'$KK9XET6T>/Z'X-_
+9]>?>>OQ$US\``````/CY_0O4#S!&`/``````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu
new file mode 100644
index 00000000000..c74c08fb3ed
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tgz.uu
@@ -0,0 +1,27 @@
+begin 644 test_read_format_gtar_sparse_1_17_posix10.tgz
+M'XL(`&.";$<``^W7RV[;5A1&88WU%'J!RN=^&7B:9E0$*/H`1,*!B]@))`<P
+M\O2A)#O];=@RBJV8$+*^"1G*T=9E'8%G??%AN'L_#I_&S78=6RGQ8OMUV&S'
+MQ>FX24EI=_0U.SWN!9\7WM48O?,^Q87S,96R6-V=\#6\Z-OV=MA,+\7Z//?O
+MY>?Q3(2P^O.O?]:'[WQ]/?S[97/IET^N7MU,5]TR%+UZ,UR/EX?S9?3ZR&8<
+M/F^OOH^7T:=<0UL&MQINKZ8_][ZWT&-Q87?MX^-K;CGWA_$;6E],7]S?^^_M
+MW=7G\9?\!+RR_N-NN?RW_J?K/ON<%ZLW640/ZW]J\>C?O?;XF:[_N.R36);9
+MAZ6?3EL-^_.'M<NJQ!'#W"\`9XU^YK5^Z?X_G&[&Z_?_]>G]?\Z!^_^W\+_N
+M_^L+]__3W4)X=@/0^_[#\,_L`.(S.P#/O<9;.W;_?ZJ?@*/K?[K-C,[+^O>[
+M^_^0(_?_;Z'WES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ive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
new file mode 100644
index 00000000000..cf8fd77cc0c
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
@@ -0,0 +1,1369 @@
+begin 644 test_read_format_gtar_sparse_1_17_posix10_modified.tar
+M+B]087A(96%D97)S+C,X-C8S+W-P87)S90``````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P`#`P,#`P,#`P,C$U
+M`#$P-S,S,3`Q,30S`#`Q,S0V-@`@>```````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!U<W1A<@`P,```````
+M````````````````````````````````````````````````````````````
+M```````````````````P,#`P,#`P`#`P,#`P,#``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````R,B!'3E4N<W!A<G-E+FUA:F]R/3$*,C(@1TY5
+M+G-P87)S92YM:6YO<CTP"C(V($=.52YS<&%R<V4N;F%M93US<&%R<V4*,S$@
+M1TY5+G-P87)S92YR96%L<VEZ93TS,30U-S(X"C(P(&%T:6UE/3$Q.3@R.3,V
+M,#(*,C`@8W1I;64],3$Y.#(Y,S8P,`H`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````"XO1TY54W!A<G-E
+M1FEL92XS.#8V,R]S<&%R<V4`````````````````````````````````````
+M```````````````````````````````````````````````````````````P
+M,#`P-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#`P,S`P,``Q,#<S,S$P,3$T
+M,``P,34Q-34`(#``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````=7-T87(`,#!T:6T`````````````````
+M`````````````````````'1I;0``````````````````````````````````
+M````,#`P,#`P,``P,#`P,#`P````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````(R%G;G4M<W!A<G-E+69O<FUA=`HC9F]R;6%T.C$N,`HS"CDY.3DS
+M-@HU,3(*,3DY.3@W,@HU,3(*,S$T-3<R.`HP"@``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````80``````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````+B]087A(96%D97)S+C,X-C8S+W-P87)S93(`````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P
+M`#`P,#`P,#`P,C$W`#$P-S,S,3`Q,30S`#`Q,S4U,@`@>```````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!U
+M<W1A<@`P,```````````````````````````````````````````````````
+M```````````````````````````````````P,#`P,#`P`#`P,#`P,#``````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````R,B!'3E4N<W!A<G-E+FUA
+M:F]R/3$*,C(@1TY5+G-P87)S92YM:6YO<CTP"C(W($=.52YS<&%R<V4N;F%M
+M93US<&%R<V4R"C,R($=.52YS<&%R<V4N<F5A;'-I>F4].3DP,#`P,#$*,C`@
+M871I;64],3$Y.#(Y,S8P,PHR,"!C=&EM93TQ,3DX,CDS-C`Q"@``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`"XO1TY54W!A<G-E1FEL92XS.#8V,R]S<&%R<V4R````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````P,#`P-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#$T-3,P
+M,0`Q,#<S,S$P,3$T,0`P,34R-3,`(#``````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````=7-T87(`,#!T:6T`
+M`````````````````````````````````````'1I;0``````````````````
+M````````````````````,#`P,#`P,``P,#`P,#`P````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````.3D*.3DY.3,V"C4Q,@HQ.3DY.#<R"C4Q,@HR
+M.3DY.#`X"C4Q,@HS.3DY-S0T"C4Q,@HT.3DY-C@P"C4Q,@HU.3DY-C$V"C4Q
+M,@HV.3DY-34R"C4Q,@HX,#`P,#`P"C4Q,@HX.3DY.3,V"C4Q,@HY.3DY.#<R
+M"C4Q,@HQ,#DY.3@P.`HU,3(*,3$Y.3DW-#0*-3$R"C$R.3DY-C@P"C4Q,@HQ
+M,SDY.38Q-@HU,3(*,30Y.3DU-3(*-3$R"C$V,#`P,#`P"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.34U,@HU,3(*-S(P,#`P,#`*-3$R
+M"C<R.3DY.3,V"C4Q,@HW,SDY.3@W,@HU,3(*-S0Y.3DX,#@*-3$R"C<U.3DY
+M-S0T"C4Q,@HW-CDY.38X,`HU,3(*-S<Y.3DV,38*-3$R"C<X.3DY-34R"C4Q
+M,@HX,#`P,#`P,`HU,3(*.#`Y.3DY,S8*-3$R"C@Q.3DY.#<R"C4Q,@HX,CDY
+M.3@P.`HU,3(*.#,Y.3DW-#0*-3$R"C@T.3DY-C@P"C4Q,@HX-3DY.38Q-@HU
+M,3(*.#8Y.3DU-3(*-3$R"C@X,#`P,#`P"C4Q,@HX.#DY.3DS-@HU,3(*.#DY
+M.3DX-S(*-3$R"CDP.3DY.#`X"C4Q,@HY,3DY.3<T-`HU,3(*.3(Y.3DV.#`*
+M-3$R"CDS.3DY-C$V"C4Q,@HY-#DY.34U,@HU,3(*.38P,#`P,#`*-3$R"CDV
+M.3DY.3,V"C4Q,@HY-SDY.3@W,@HU,3(*.3@Y.3DX,#@*,3DS"@``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````&$`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````!A````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````80``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````&$`````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````&$`````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M``````````````!A````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``!A````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````!A````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````!A````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````!A````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````!A````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``!A````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````!A````````
+M````````````````````````````````````````````````````````````
+M````````````````80``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````80``````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````80``````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````80``````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````80``````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````80``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````80``````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````80``````
+M````````````````````````````````````````````````````````````
+M`````````````````&$`````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````&$`````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````&$`````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````&$`````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````&$`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````&$`````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````&$`````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````&$`````
+M````````````````````````````````````````````````````````````
+M``````````````````!A````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````!A````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````!A````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!A````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````!A````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````!A````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````!A````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````!A````
+M````````````````````````````````````````````````````````````
+M````````````````````80``````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````80``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````80``````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````80``````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````80``````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````80``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````&$`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````!A````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````80``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M`````````````````````````&$`````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````+B]0
+M87A(96%D97)S+C,X-C8S+VYO;BUS<&%R<V4`````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P`#`P,#`P,#`P,#4P`#$P
+M-S,S,3`Q,30S`#`Q-#(U,P`@>```````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````!U<W1A<@`P,```````````
+M````````````````````````````````````````````````````````````
+M```````````````P,#`P,#`P`#`P,#`P,#``````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````R,"!A=&EM93TQ,3DX,CDS-C`Q"C(P(&-T:6UE/3$Q
+M.3@R.3,V,#$*````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````&YO;BUS<&%R<V4`````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````P,#`P
+M-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#`P,#`P,``Q,#<S,S$P,3$T,0`P
+M,3(U,#<`(#``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````=7-T87(`,#!T:6T`````````````````````
+M`````````````````'1I;0``````````````````````````````````````
+M,#`P,#`P,``P,#`P,#`P````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+/````````````````````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
index 2a888af3586..107024f5ede 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_isorr_bz2.c,v 1.2 2007/05/29 01:00:21 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_isorr_bz2.c,v 1.3 2008/01/01 22:28:04 kientzle Exp $");
/*
Execute the following to rebuild the data for this program:
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
index fa20c35dc74..e5165d31fbe 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_mtree.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
/* Single entry with a hardlink. */
static unsigned char archive[] = {
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tar.c b/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
index c3b5212d8e7..1de08495ca9 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_tar.c,v 1.2 2007/07/14 05:35:17 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_tar.c,v 1.3 2008/01/13 23:50:30 kientzle Exp $");
/*
* Each of these archives is a short archive with a single entry. The
@@ -36,6 +36,52 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_tar.c,v 1.2 2007/07
* '2' is a symlink, '5' is a dir, etc.
*/
+/* Empty archive. */
+static unsigned char archiveEmpty[] = {
+ /* 512 zero bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,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,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0
+};
+
+static void verifyEmpty(void)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, archiveEmpty, 512));
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ failure("512 zero bytes should be recognized as a tar archive.");
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
+
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_API_VERSION > 1
+ assert(0 == archive_read_finish(a));
+#else
+ archive_read_finish(a);
+#endif
+}
+
/* Single entry with a hardlink. */
static unsigned char archive1[] = {
'h','a','r','d','l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -411,6 +457,7 @@ static void verify(unsigned char *d, size_t s,
DEFINE_TEST(test_read_format_tar)
{
+ verifyEmpty();
verify(archive1, sizeof(archive1), verify1,
ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
verify(archive2, sizeof(archive2), verify2,
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
index ce065097e42..9829217fc41 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_zip.c,v 1.2 2007/05/29 01:00:21 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_zip.c,v 1.3 2008/01/01 22:28:04 kientzle Exp $");
static unsigned char archive[] = {
'P','K',3,4,10,0,0,0,0,0,'Y','f',179,'6',0,0,0,0,0,0,0,0,0,0,0,0,4,0,21,0,
diff --git a/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
index 2b169c83900..5e2c9c536b4 100644
--- a/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
+++ b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_pax_truncated.c,v 1.1 2007/07/13 15:14:35 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_pax_truncated.c,v 1.2 2008/01/01 22:28:04 kientzle Exp $");
DEFINE_TEST(test_read_pax_truncated)
{
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
index de0b1d0351e..8b83b527733 100644
--- a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
+++ b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_filenames.c,v 1.7 2007/07/14 17:52:01 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_filenames.c,v 1.8 2008/01/01 22:28:04 kientzle Exp $");
/*
* Exercise various lengths of filenames in tar archives,
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_large.c b/archivers/libarchive/files/libarchive/test/test_tar_large.c
index 29e0c833562..c675ac1ee04 100644
--- a/archivers/libarchive/files/libarchive/test/test_tar_large.c
+++ b/archivers/libarchive/files/libarchive/test/test_tar_large.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_large.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
#include <errno.h>
#include <stdlib.h>
@@ -91,10 +91,11 @@ memory_write(struct archive *a, void *_private, const void *buff, size_t size)
(void)a;
/*
- * Since libarchive has zero-copy behavior, if you give a pointer
- * to filedata to the library, a pointer into that data will
- * pop out here. This way, we can tell the difference between
- * filedata and library header and metadata.
+ * Since libarchive tries to behave in a zero-copy manner, if
+ * you give a pointer to filedata to the library, a pointer
+ * into that data will (usually) pop out here. This way, we
+ * can tell the difference between filedata and library header
+ * and metadata.
*/
if ((const char *)filedata <= (const char *)buff
&& (const char *)buff < (const char *)filedata + filedatasize) {
@@ -303,5 +304,6 @@ DEFINE_TEST(test_tar_large)
archive_read_finish(a);
#endif
+ free(memdata.buff);
free(filedata);
}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk.c b/archivers/libarchive/files/libarchive/test/test_write_disk.c
index 4cac97681a7..480cf29b566 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_disk.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.6 2007/09/21 04:52:43 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk.c,v 1.8 2008/01/23 05:47:08 kientzle Exp $");
#if ARCHIVE_VERSION_STAMP >= 1009000
@@ -60,6 +60,24 @@ static void create_reg_file(struct archive_entry *ae, const char *msg)
/* Write the entry to disk. */
assert((ad = archive_write_disk_new()) != NULL);
failure("%s", msg);
+ /*
+ * A touchy API design issue: archive_write_data() does (as of
+ * 2.4.12) enforce the entry size as a limit on the data
+ * written to the file. This was not enforced prior to
+ * 2.4.12. The change was prompted by the refined
+ * hardlink-restore semantics introduced at that time. In
+ * short, libarchive needs to know whether a "hardlink entry"
+ * is going to overwrite the contents so that it can know
+ * whether or not to open the file for writing. This implies
+ * that there is a fundamental semantic difference between an
+ * entry with a zero size and one with a non-zero size in the
+ * case of hardlinks and treating the hardlink case
+ * differently from the regular file case is just asking for
+ * trouble. So, a zero size must always mean that no data
+ * will be accepted, which is consistent with the file size in
+ * the entry being a maximum size.
+ */
+ archive_entry_set_size(ae, sizeof(data));
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
@@ -92,6 +110,11 @@ static void create_reg_file2(struct archive_entry *ae, const char *msg)
/* Write the entry to disk. */
assert((ad = archive_write_disk_new()) != NULL);
failure("%s", msg);
+ /*
+ * See above for an explanation why this next call
+ * is necessary.
+ */
+ archive_entry_set_size(ae, datasize);
assertEqualIntA(ad, 0, archive_write_header(ad, ae));
for (i = 0; i < datasize - 999; i += 1000) {
assertEqualIntA(ad, ARCHIVE_OK,
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c
new file mode 100644
index 00000000000..b21c44b2384
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c
@@ -0,0 +1,165 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_hardlink.c,v 1.1 2008/01/18 05:05:58 kientzle Exp $");
+
+#define UMASK 022
+
+/*
+ * Exercise hardlink recreation.
+ */
+DEFINE_TEST(test_write_disk_hardlink)
+{
+#if ARCHIVE_VERSION_STAMP < 1009000
+ skipping("archive_write_disk_hardlink tests");
+#else
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct archive_entry *ae;
+ struct stat st, st2;
+
+ /* Force the umask to something predictable. */
+ umask(UMASK);
+
+ /* Write entries to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+
+ /*
+ * First, use a tar-like approach; a regular file, then
+ * a separate "hardlink" entry.
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link1a");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link1b");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ archive_entry_copy_hardlink(ae, "link1a");
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(0, archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /*
+ * Second, try an old-cpio-like approach; a regular file, then
+ * another identical one (which has been marked hardlink).
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link2a");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link2b");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_copy_hardlink(ae, "link2a");
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /*
+ * Finally, try a new-cpio-like approach, where the initial
+ * regular file is empty and the hardlink has the data.
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link3a");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(0, archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link3b");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_copy_hardlink(ae, "link3a");
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+ assertEqualInt(0, archive_write_finish(ad));
+
+ /* Test the entries on disk. */
+ assert(0 == stat("link1a", &st));
+ assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_size, sizeof(data));
+ assertEqualInt(st.st_nlink, 2);
+
+ assert(0 == stat("link1b", &st2));
+ assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st2.st_size, sizeof(data));
+ assertEqualInt(st2.st_nlink, 2);
+ assertEqualInt(st.st_ino, st2.st_ino);
+ assertEqualInt(st.st_dev, st2.st_dev);
+
+ assert(0 == stat("link2a", &st));
+ assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_size, sizeof(data));
+ assertEqualInt(st.st_nlink, 2);
+
+ assert(0 == stat("link2b", &st2));
+ assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st2.st_size, sizeof(data));
+ assertEqualInt(st2.st_nlink, 2);
+ assertEqualInt(st.st_ino, st2.st_ino);
+ assertEqualInt(st.st_dev, st2.st_dev);
+
+ assert(0 == stat("link3a", &st));
+ assertEqualInt(st.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st.st_size, sizeof(data));
+ assertEqualInt(st.st_nlink, 2);
+
+ assert(0 == stat("link3b", &st2));
+ assertEqualInt(st2.st_mode, (S_IFREG | 0755) & ~UMASK);
+ assertEqualInt(st2.st_size, sizeof(data));
+ assertEqualInt(st2.st_nlink, 2);
+ assertEqualInt(st.st_ino, st2.st_ino);
+ assertEqualInt(st.st_dev, st2.st_dev);
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c
index af568a0b283..4c03c75b491 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_perms.c,v 1.7 2007/08/12 17:35:05 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_disk_perms.c,v 1.8 2008/01/01 22:28:04 kientzle Exp $");
#if ARCHIVE_VERSION_STAMP >= 1009000
@@ -244,16 +244,18 @@ DEFINE_TEST(test_write_disk_perms)
failure("Opportunistic SUID failure shouldn't return error.");
assertEqualInt(0, archive_write_finish_entry(a));
- assert(archive_entry_clear(ae) != NULL);
- archive_entry_copy_pathname(ae, "file_bad_suid2");
- archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742);
- archive_entry_set_uid(ae, getuid() + 1);
- archive_write_disk_set_options(a,
- ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER);
- assertA(0 == archive_write_header(a, ae));
- /* Owner change should fail here. */
- failure("Non-opportunistic SUID failure should return error.");
- assertEqualInt(ARCHIVE_WARN, archive_write_finish_entry(a));
+ if (getuid() != 0) {
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_suid2");
+ archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742);
+ archive_entry_set_uid(ae, getuid() + 1);
+ archive_write_disk_set_options(a,
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER);
+ assertA(0 == archive_write_header(a, ae));
+ /* Owner change should fail here. */
+ failure("Non-opportunistic SUID failure should return error.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_finish_entry(a));
+ }
/* Write a regular file with ARCHIVE_EXTRACT_PERM & SGID bit */
assert(archive_entry_clear(ae) != NULL);
@@ -403,10 +405,13 @@ DEFINE_TEST(test_write_disk_perms)
failure("file_bad_suid: st.st_mode=%o", st.st_mode);
assert((st.st_mode & 07777) == (0742));
- /* SUID bit should NOT have been set here. */
- assert(0 == stat("file_bad_suid2", &st));
- failure("file_bad_suid2: st.st_mode=%o", st.st_mode);
- assert((st.st_mode & 07777) == (0742));
+ /* Some things don't fail if you're root, so suppress this. */
+ if (getuid() != 0) {
+ /* SUID bit should NOT have been set here. */
+ assert(0 == stat("file_bad_suid2", &st));
+ failure("file_bad_suid2: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+ }
/* SGID should be set here. */
assert(0 == stat("file_perm_sgid", &st));
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
index 7319d0c3cec..dbb9775597a 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio.c,v 1.3 2007/10/12 04:11:31 kientzle Exp $");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio.c,v 1.4 2008/01/01 22:28:04 kientzle Exp $");
/* The version stamp macro was introduced after cpio write support. */
#if ARCHIVE_VERSION_STAMP >= 1009000
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
index 733e4ab26cd..431097b2476 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio_newc.c,v 1.2 2008/01/23 05:43:26 kientzle Exp $");
static int
@@ -68,6 +68,8 @@ DEFINE_TEST(test_write_format_cpio_newc)
* Add various files to it.
* TODO: Extend this to cover more filetypes.
*/
+
+ /* Regular file */
assert((entry = archive_entry_new()) != NULL);
archive_entry_set_mtime(entry, 1, 10);
archive_entry_set_pathname(entry, "file");
@@ -82,6 +84,7 @@ DEFINE_TEST(test_write_format_cpio_newc)
archive_entry_free(entry);
assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+ /* Directory */
assert((entry = archive_entry_new()) != NULL);
archive_entry_set_mtime(entry, 2, 20);
archive_entry_set_pathname(entry, "dir");
@@ -92,6 +95,22 @@ DEFINE_TEST(test_write_format_cpio_newc)
archive_entry_free(entry);
assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+ /* Symlink */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 3, 30);
+ archive_entry_set_pathname(entry, "lnk");
+ archive_entry_set_mode(entry, S_IFLNK | 0664);
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 83);
+ archive_entry_set_gid(entry, 93);
+ archive_entry_set_dev(entry, 13);
+ archive_entry_set_ino(entry, 88);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_symlink(entry,"a");
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+
#if ARCHIVE_API_VERSION > 1
assert(0 == archive_write_finish(a));
#else
@@ -122,7 +141,7 @@ DEFINE_TEST(test_write_format_cpio_newc)
assertEqualMem(e + 110, "file\0\0", 6); /* Name contents */
assertEqualMem(e + 116, "1234567890", 10); /* File body */
assertEqualMem(e + 126, "\0\0", 2); /* Pad to multiple of 4 */
- e += 128;
+ e += 128; /* Must be multiple of four here! */
/* Second entry is "dir" */
assert(is_hex(e, 110));
@@ -142,7 +161,27 @@ DEFINE_TEST(test_write_format_cpio_newc)
assertEqualMem(e + 102, "00000000", 8); /* CRC */
assertEqualMem(e + 110, "dir\0", 4); /* name */
assertEqualMem(e + 114, "\0\0", 2); /* Pad to multiple of 4 */
- e += 116;
+ e += 116; /* Must be multiple of four here! */
+
+ /* Third entry is "lnk" */
+ assert(is_hex(e, 110)); /* Entire header is hex digits. */
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000058", 8); /* ino */
+ assertEqualMem(e + 14, "0000a1b4", 8); /* Mode */
+ assertEqualMem(e + 22, "00000053", 8); /* uid */
+ assertEqualMem(e + 30, "0000005d", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000003", 8); /* mtime */
+ assertEqualMem(e + 54, "00000001", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "0000000d", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000004", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "lnk\0\0\0", 6); /* Name contents */
+ assertEqualMem(e + 116, "a\0\0\0", 4); /* File body + pad */
+ e += 120; /* Must be multiple of four here! */
/* TODO: Verify other types of entries. */
@@ -164,7 +203,7 @@ DEFINE_TEST(test_write_format_cpio_newc)
assertEqualMem(e + 102, "00000000", 8); /* CRC */
assertEqualMem(e + 110, "TRAILER!!!\0", 11); /* Name */
assertEqualMem(e + 121, "\0\0\0", 3); /* Pad to multiple of 4 bytes */
- e += 124;
+ e += 124; /* Must be multiple of four here! */
assertEqualInt(used, e - buff);
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
index 796dd7eace9..e6ed7eed778 100644
--- a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
@@ -23,7 +23,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "test.h"
-__FBSDID("$FreeBSD$");
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_cpio_odc.c,v 1.1 2008/01/01 22:28:04 kientzle Exp $");
static int