From owner-svn-src-vendor@FreeBSD.ORG Mon Dec 26 22:25:58 2011 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D4DD9106566C; Mon, 26 Dec 2011 22:25:58 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BCCCB8FC0A; Mon, 26 Dec 2011 22:25:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pBQMPwSN024609; Mon, 26 Dec 2011 22:25:58 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBQMPwYJ024582; Mon, 26 Dec 2011 22:25:58 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201112262225.pBQMPwYJ024582@svn.freebsd.org> From: Martin Matuska Date: Mon, 26 Dec 2011 22:25:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r228905 - in vendor/libarchive/dist: . cpio libarchive libarchive/test libarchive_fe tar tar/test X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Dec 2011 22:25:58 -0000 Author: mm Date: Mon Dec 26 22:25:58 2011 New Revision: 228905 URL: http://svn.freebsd.org/changeset/base/228905 Log: Update to vendor revision 3982 Obtained from: http://libarchive.googlecode.com/svn/release/2.8 Added: vendor/libarchive/dist/libarchive/test/test_compat_zip_2.zip.uu (contents, props changed) Modified: vendor/libarchive/dist/CMakeLists.txt vendor/libarchive/dist/cpio/bsdcpio.1 vendor/libarchive/dist/cpio/cmdline.c vendor/libarchive/dist/cpio/cpio.c vendor/libarchive/dist/cpio/cpio.h vendor/libarchive/dist/libarchive/archive.h vendor/libarchive/dist/libarchive/archive_entry.3 vendor/libarchive/dist/libarchive/archive_private.h vendor/libarchive/dist/libarchive/archive_read.3 vendor/libarchive/dist/libarchive/archive_read.c vendor/libarchive/dist/libarchive/archive_read_disk.3 vendor/libarchive/dist/libarchive/archive_read_disk.c vendor/libarchive/dist/libarchive/archive_read_extract.c vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c vendor/libarchive/dist/libarchive/archive_util.3 vendor/libarchive/dist/libarchive/archive_virtual.c vendor/libarchive/dist/libarchive/archive_write.3 vendor/libarchive/dist/libarchive/archive_write.c vendor/libarchive/dist/libarchive/archive_write_disk.3 vendor/libarchive/dist/libarchive/archive_write_disk.c vendor/libarchive/dist/libarchive/archive_write_set_format_cpio.c vendor/libarchive/dist/libarchive/cpio.5 vendor/libarchive/dist/libarchive/libarchive-formats.5 vendor/libarchive/dist/libarchive/libarchive.3 vendor/libarchive/dist/libarchive/tar.5 vendor/libarchive/dist/libarchive/test/test_acl_freebsd.c vendor/libarchive/dist/libarchive/test/test_compat_zip.c vendor/libarchive/dist/libarchive_fe/pathmatch.c vendor/libarchive/dist/tar/bsdtar.1 vendor/libarchive/dist/tar/read.c vendor/libarchive/dist/tar/test/test_option_s.c vendor/libarchive/dist/tar/tree.c vendor/libarchive/dist/tar/util.c vendor/libarchive/dist/tar/write.c Modified: vendor/libarchive/dist/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/CMakeLists.txt Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/CMakeLists.txt Mon Dec 26 22:25:58 2011 (r228905) @@ -857,12 +857,6 @@ INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRE IF(MSVC) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) ENDIF(MSVC) -# Especially for early development, we want to be a little -# aggressive about diagnosing build problems; this can get -# relaxed somewhat in final shipping versions. -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - ADD_DEFINITIONS(-Wall -Werror) -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") IF(ENABLE_TEST) ADD_CUSTOM_TARGET(run_all_tests) Modified: vendor/libarchive/dist/cpio/bsdcpio.1 ============================================================================== --- vendor/libarchive/dist/cpio/bsdcpio.1 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/cpio/bsdcpio.1 Mon Dec 26 22:25:58 2011 (r228905) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 21, 2007 +.Dd September 5, 2010 .Dt BSDCPIO 1 .Os .Sh NAME @@ -140,7 +140,7 @@ The POSIX.1 tar format. The default format is .Ar odc . See -.Xr libarchive_formats 5 +.Xr libarchive-formats 5 for more complete information about the formats currently supported by the underlying .Xr libarchive 3 @@ -295,7 +295,7 @@ for more information. .Sh EXAMPLES The .Nm -command is traditionally used to copy file heirarchies in conjunction +command is traditionally used to copy file hierarchies in conjunction with the .Xr find 1 command. Modified: vendor/libarchive/dist/cpio/cmdline.c ============================================================================== --- vendor/libarchive/dist/cpio/cmdline.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/cpio/cmdline.c Mon Dec 26 22:25:58 2011 (r228905) @@ -285,6 +285,8 @@ cpio_getopt(struct cpio *cpio) * A period can be used instead of the colon. * * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified. + * TODO: If the spec uses uname/gname, then return those to the caller + * as well. If the spec provides uid/gid, just return names as NULL. * * Returns NULL if no error, otherwise returns error string for display. * Modified: vendor/libarchive/dist/cpio/cpio.c ============================================================================== --- vendor/libarchive/dist/cpio/cpio.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/cpio/cpio.c Mon Dec 26 22:25:58 2011 (r228905) @@ -273,15 +273,21 @@ main(int argc, char *argv[]) cpio->quiet = 1; break; case 'R': /* GNU cpio, also --owner */ + /* TODO: owner_parse should return uname/gname + * also; use that to set [ug]name_override. */ errmsg = owner_parse(cpio->optarg, &uid, &gid); if (errmsg) { lafe_warnc(-1, "%s", errmsg); usage(); } - if (uid != -1) + if (uid != -1) { cpio->uid_override = uid; - if (gid != -1) + cpio->uname_override = NULL; + } + if (gid != -1) { cpio->gid_override = gid; + cpio->gname_override = NULL; + } break; case 'r': /* POSIX 1997 */ cpio->option_rename = 1; @@ -575,10 +581,14 @@ file_to_archive(struct cpio *cpio, const return (r); } - if (cpio->uid_override >= 0) + if (cpio->uid_override >= 0) { archive_entry_set_uid(entry, cpio->uid_override); - if (cpio->gid_override >= 0) + archive_entry_set_uname(entry, cpio->uname_override); + } + if (cpio->gid_override >= 0) { archive_entry_set_gid(entry, cpio->gid_override); + archive_entry_set_gname(entry, cpio->gname_override); + } /* * Generate a destination path for this entry. Modified: vendor/libarchive/dist/cpio/cpio.h ============================================================================== --- vendor/libarchive/dist/cpio/cpio.h Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/cpio/cpio.h Mon Dec 26 22:25:58 2011 (r228905) @@ -68,7 +68,9 @@ struct cpio { size_t pass_destpath_alloc; char *pass_destpath; int uid_override; + char *uname_override; int gid_override; + char *gname_override; int day_first; /* true if locale prefers day/mon */ /* If >= 0, then close this when done. */ Modified: vendor/libarchive/dist/libarchive/archive.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive.h Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive.h Mon Dec 26 22:25:58 2011 (r228905) @@ -493,11 +493,10 @@ __LA_DECL void archive_read_extract_set /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ -/* Note that archive_read_finish will call archive_read_close for you. */ -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Erroneously declared to return void in libarchive 1.x */ -__LA_DECL void archive_read_finish(struct archive *); -#else +/* Note that archive_read_free will call archive_read_close for you. */ +__LA_DECL int archive_read_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *); #endif @@ -514,7 +513,7 @@ __LA_DECL int archive_read_finish(stru * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output - * 6) archive_write_finish to cleanup the writer and release resources + * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, @@ -595,13 +594,12 @@ __LA_DECL __LA_SSIZE_T archive_write_da #endif __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); -#if ARCHIVE_VERSION_NUMBER < 2000000 -/* Return value was incorrect in libarchive 1.x. */ -__LA_DECL void archive_write_finish(struct archive *); -#else -/* Libarchive 2.x and later returns an error if this fails. */ -/* It can fail if the archive wasn't already closed, in which case - * archive_write_finish() will implicitly call archive_write_close(). */ + +/* This can fail if the archive wasn't already closed, in which case + * archive_write_free() will implicitly call archive_write_close(). */ +__LA_DECL int archive_write_free(struct archive *); +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *); #endif @@ -630,7 +628,7 @@ __LA_DECL int archive_write_set_options * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data - * 4) archive_write_finish to cleanup the writer and release resources + * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. Modified: vendor/libarchive/dist/libarchive/archive_entry.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_entry.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_entry.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $ .\" .Dd May 12, 2008 -.Dt archive_entry 3 +.Dt ARCHIVE_ENTRY 3 .Os .Sh NAME .Nm archive_entry_acl_add_entry , Modified: vendor/libarchive/dist/libarchive/archive_private.h ============================================================================== --- vendor/libarchive/dist/libarchive/archive_private.h Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_private.h Mon Dec 26 22:25:58 2011 (r228905) @@ -58,7 +58,7 @@ struct archive_vtable { int (*archive_close)(struct archive *); - int (*archive_finish)(struct archive *); + int (*archive_free)(struct archive *); int (*archive_write_header)(struct archive *, struct archive_entry *); int (*archive_write_finish_entry)(struct archive *); Modified: vendor/libarchive/dist/libarchive/archive_read.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $ .\" .Dd April 13, 2009 -.Dt archive_read 3 +.Dt ARCHIVE_READ 3 .Os .Sh NAME .Nm archive_read_new , @@ -69,7 +69,7 @@ .Nm archive_read_extract2 , .Nm archive_read_extract_set_progress_callback , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading streaming archives .Sh SYNOPSIS .In archive.h @@ -196,7 +196,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for reading streaming archives. The general process is to first create the @@ -457,7 +457,7 @@ object and the archive_entry object so t can be retrieved for the progress display. .It Fn archive_read_close Complete the archive and invoke the close callback. -.It Fn archive_read_finish +.It Fn archive_read_free Invokes .Fn archive_read_close if it was not invoked manually, then release all resources. @@ -600,7 +600,7 @@ list_archive(const char *name) printf("%s\en",archive_entry_pathname(entry)); archive_read_data_skip(a); } - archive_read_finish(a); + archive_read_free(a); free(mydata); } Modified: vendor/libarchive/dist/libarchive/archive_read.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read.c Mon Dec 26 22:25:58 2011 (r228905) @@ -60,7 +60,7 @@ static int choose_format(struct archive_ static int cleanup_filters(struct archive_read *); static struct archive_vtable *archive_read_vtable(void); static int _archive_read_close(struct archive *); -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static struct archive_vtable * archive_read_vtable(void) @@ -69,7 +69,7 @@ archive_read_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -779,7 +779,7 @@ cleanup_filters(struct archive_read *a) * Release memory and other resources. */ static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; int i; @@ -787,7 +787,7 @@ _archive_read_finish(struct archive *_a) int r = ARCHIVE_OK; __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_finish"); + "archive_read_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_read_close(&a->archive); Modified: vendor/libarchive/dist/libarchive/archive_read_disk.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_disk.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: head/lib/libarchive/archive_read_disk.3 190957 2009-04-12 05:04:02Z kientzle $ .\" .Dd March 10, 2009 -.Dt archive_read_disk 3 +.Dt ARCHIVE_READ_DISK 3 .Os .Sh NAME .Nm archive_read_disk_new , @@ -39,7 +39,7 @@ .Nm archive_read_disk_set_gname_lookup , .Nm archive_read_disk_set_standard_lookup , .Nm archive_read_close , -.Nm archive_read_finish +.Nm archive_read_free .Nd functions for reading objects from disk .Sh SYNOPSIS .In archive.h @@ -81,7 +81,7 @@ .Ft int .Fn archive_read_close "struct archive *" .Ft int -.Fn archive_read_finish "struct archive *" +.Fn archive_read_free "struct archive *" .Sh DESCRIPTION These functions provide an API for reading information about objects on disk. @@ -178,9 +178,9 @@ This affects the file ownership fields a object. .It Fn archive_read_close This currently does nothing. -.It Fn archive_write_finish +.It Fn archive_read_free Invokes -.Fn archive_write_close +.Fn archive_read_close if it was not invoked manually, then releases all resources. .El More information about the @@ -213,7 +213,7 @@ file_to_archive(struct archive *a, const while ((bytes_read = read(fd, buff, sizeof(buff))) > 0) archive_write_data(a, buff, bytes_read); archive_write_finish_entry(a); - archive_read_finish(ard); + archive_read_free(ard); archive_entry_free(entry); } .Ed @@ -276,7 +276,7 @@ and first appeared in The .Nm libarchive library was written by -.An Tim Kientzle Aq kientzle@freebsd.org . +.An Tim Kientzle Aq kientzle@FreeBSD.org . .Sh BUGS The .Dq standard Modified: vendor/libarchive/dist/libarchive/archive_read_disk.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_disk.c Mon Dec 26 22:25:58 2011 (r228905) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_disk_private.h" -static int _archive_read_finish(struct archive *); +static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static const char *trivial_lookup_gname(void *, gid_t gid); static const char *trivial_lookup_uname(void *, uid_t uid); @@ -45,7 +45,7 @@ archive_read_disk_vtable(void) static int inited = 0; if (!inited) { - av.archive_finish = _archive_read_finish; + av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; } return (&av); @@ -129,7 +129,7 @@ archive_read_disk_new(void) } static int -_archive_read_finish(struct archive *_a) +_archive_read_free(struct archive *_a) { struct archive_read_disk *a = (struct archive_read_disk *)_a; Modified: vendor/libarchive/dist/libarchive/archive_read_extract.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_extract.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_extract.c Mon Dec 26 22:25:58 2011 (r228905) @@ -173,10 +173,7 @@ archive_read_extract_cleanup(struct arch { int ret = ARCHIVE_OK; -#if ARCHIVE_API_VERSION > 1 - ret = -#endif - archive_write_finish(a->extract->ad); + ret = archive_write_free(a->extract->ad); free(a->extract); a->extract = NULL; return (ret); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Mon Dec 26 22:25:58 2011 (r228905) @@ -42,6 +42,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ #include "archive_private.h" #include "archive_read_private.h" +#ifdef _MSC_VER +#define __packed +#pragma pack(push, 1) +#endif struct cpio_bin_header { unsigned char c_magic[2]; unsigned char c_dev[2]; @@ -54,7 +58,7 @@ struct cpio_bin_header { unsigned char c_mtime[4]; unsigned char c_namesize[2]; unsigned char c_filesize[4]; -}; +} __packed; struct cpio_odc_header { char c_magic[6]; @@ -68,7 +72,7 @@ struct cpio_odc_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; struct cpio_newc_header { char c_magic[6]; @@ -85,7 +89,12 @@ struct cpio_newc_header { char c_rdevminor[8]; char c_namesize[8]; char c_crc[8]; -}; +} __packed; + +#ifdef _MSC_VER +#undef __packed +#pragma pack(pop) +#endif struct links_entry { struct links_entry *next; Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_iso9660.c Mon Dec 26 22:25:58 2011 (r228905) @@ -302,8 +302,6 @@ struct file_info { struct file_info *first; struct file_info **last; } rede_files; - /* To check a ininity loop. */ - struct file_info *loop_by; }; struct heap_queue { @@ -1799,26 +1797,82 @@ parse_file_info(struct archive_read *a, file->re = 0; parent->subdirs--; } else if (file->re) { - /* This file's parent is not rr_moved, clear invalid - * "RE" mark. */ - if (parent == NULL || parent->rr_moved == 0) - file->re = 0; - else if ((flags & 0x02) == 0) { - file->rr_moved_has_re_only = 0; - file->re = 0; + /* + * Sanity check: file's parent is rr_moved. + */ + if (parent == NULL || parent->rr_moved == 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge RE"); + return (NULL); + } + /* + * Sanity check: file does not have "CL" extension. + */ + if (file->cl_offset) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge RE and CL"); + return (NULL); + } + /* + * Sanity check: The file type must be a directory. + */ + if ((flags & 0x02) == 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge RE"); + return (NULL); } } else if (parent != NULL && parent->rr_moved) file->rr_moved_has_re_only = 0; else if (parent != NULL && (flags & 0x02) && (parent->re || parent->re_descendant)) file->re_descendant = 1; - if (file->cl_offset != 0) { + if (file->cl_offset) { + struct file_info *p; + + if (parent == NULL || parent->parent == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge CL"); + return (NULL); + } + /* + * Sanity check: The file type must be a regular file. + */ + if ((flags & 0x02) != 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge CL"); + return (NULL); + } parent->subdirs++; /* Overwrite an offset and a number of this "CL" entry * to appear before other dirs. "+1" to those is to * make sure to appear after "RE" entry which this * "CL" entry should be connected with. */ file->offset = file->number = file->cl_offset + 1; + + /* + * Sanity check: cl_offset does not point at its + * the parents or itself. + */ + for (p = parent; p; p = p->parent) { + if (p->offset == file->cl_offset) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge CL"); + return (NULL); + } + } + if (file->cl_offset == file->offset || + parent->rr_moved) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Invalid Rockridge CL"); + return (NULL); + } } } @@ -1922,6 +1976,13 @@ parse_rockridge(struct archive_read *a, */ break; } + if (p[0] == 'P' && p[1] == 'L') { + /* + * PL extension won't appear; + * contents are always ignored. + */ + break; + } if (p[0] == 'P' && p[1] == 'N') { if (version == 1 && data_length == 16) { file->rdev = toi(data,4); @@ -2697,15 +2758,12 @@ rede_add_entry(struct file_info *file) { struct file_info *re; + /* + * Find "RE" entry. + */ re = file->parent; - while (re != NULL && !re->re) { - /* Sanity check to prevent a infinity loop - * cause by a currupted iso file. */ - if (re->loop_by == file) - return (-1); - re->loop_by = file; + while (re != NULL && !re->re) re = re->parent; - } if (re == NULL) return (-1); Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_zip.c Mon Dec 26 22:25:58 2011 (r228905) @@ -128,6 +128,7 @@ static int archive_read_format_zip_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 search_next_signature(struct archive_read *); 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, @@ -317,10 +318,17 @@ archive_read_format_zip_read_header(stru signature = (const char *)h; } + /* If we don't see a PK signature here, scan forward. */ if (signature[0] != 'P' || signature[1] != 'K') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Bad ZIP file"); - return (ARCHIVE_FATAL); + r = search_next_signature(a); + if (r != ARCHIVE_OK) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Bad ZIP file"); + return (ARCHIVE_FATAL); + } + if ((h = __archive_read_ahead(a, 4, NULL)) == NULL) + return (ARCHIVE_FATAL); + signature = (const char *)h; } /* @@ -375,6 +383,42 @@ archive_read_format_zip_read_header(stru } static int +search_next_signature(struct archive_read *a) +{ + const void *h; + const char *p, *q; + size_t skip; + ssize_t bytes; + int64_t skipped = 0; + + for (;;) { + h = __archive_read_ahead(a, 4, &bytes); + if (h == NULL) + return (ARCHIVE_FATAL); + p = h; + q = p + bytes; + + while (p + 4 <= q) { + if (p[0] == 'P' && p[1] == 'K') { + 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] == '0' && p[3] == '0')) { + skip = p - (const char *)h; + __archive_read_consume(a, skip); + return (ARCHIVE_OK); + } + } + ++p; + } + skip = p - (const char *)h; + __archive_read_consume(a, skip); + skipped += skip; + } +} + +static int zip_read_file_header(struct archive_read *a, struct archive_entry *entry, struct zip *zip) { @@ -888,6 +932,9 @@ process_extra(const void* extra, struct if (datasize >= 4) zip->gid = archive_le16dec(p + offset + 2); break; + case 0x7875: + /* Info-Zip Unix Extra Field (type 3) "ux". */ + break; default: break; } Modified: vendor/libarchive/dist/libarchive/archive_util.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_util.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_util.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: head/lib/libarchive/archive_util.3 201098 2009-12-28 02:58:14Z kientzle $ .\" .Dd January 8, 2005 -.Dt archive_util 3 +.Dt ARCHIVE_UTIL 3 .Os .Sh NAME .Nm archive_clear_error , Modified: vendor/libarchive/dist/libarchive/archive_virtual.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_virtual.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_virtual.c Mon Dec 26 22:25:58 2011 (r228905) @@ -42,26 +42,35 @@ archive_read_close(struct archive *a) return ((a->vtable->archive_close)(a)); } -#if ARCHIVE_API_VERSION > 1 int -archive_write_finish(struct archive *a) +archive_write_free(struct archive *a) { - return ((a->vtable->archive_finish)(a)); + return ((a->vtable->archive_free)(a)); } -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ -void + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* For backwards compatibility; will be removed with libarchive 4.0. */ +int archive_write_finish(struct archive *a) { - (void)(a->vtable->archive_finish)(a); + return ((a->vtable->archive_free)(a)); } #endif int +archive_read_free(struct archive *a) +{ + return ((a->vtable->archive_free)(a)); +} + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* For backwards compatibility; will be removed with libarchive 4.0. */ +int archive_read_finish(struct archive *a) { - return ((a->vtable->archive_finish)(a)); + return ((a->vtable->archive_free)(a)); } +#endif int archive_write_header(struct archive *a, struct archive_entry *entry) @@ -76,12 +85,7 @@ archive_write_finish_entry(struct archiv return ((a->vtable->archive_write_finish_entry)(a)); } -#if ARCHIVE_API_VERSION > 1 ssize_t -#else -/* Temporarily allow library to compile with either 1.x or 2.0 API. */ -int -#endif archive_write_data(struct archive *a, const void *buff, size_t s) { return ((a->vtable->archive_write_data)(a, buff, s)); Modified: vendor/libarchive/dist/libarchive/archive_write.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_write.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $ .\" .Dd May 11, 2008 -.Dt archive_write 3 +.Dt ARCHIVE_WRITE 3 .Os .Sh NAME .Nm archive_write_new , @@ -55,7 +55,7 @@ .Nm archive_write_data , .Nm archive_write_finish_entry , .Nm archive_write_close , -.Nm archive_write_finish +.Nm archive_write_free .Nd functions for creating archives .Sh SYNOPSIS .In archive.h @@ -125,7 +125,7 @@ .Ft int .Fn archive_write_close "struct archive *" .Ft int -.Fn archive_write_finish "struct archive *" +.Fn archive_write_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for creating streaming archive files. @@ -363,16 +363,16 @@ and as needed. .It Fn archive_write_close Complete the archive and invoke the close callback. -.It Fn archive_write_finish +.It Fn archive_write_free Invokes .Fn archive_write_close -if it was not invoked manually, then releases all resources. -Note that this function was declared to return -.Ft void -in libarchive 1.x, which made it impossible to detect errors when +if necessary, then releases all resources. +If you need detailed information about .Fn archive_write_close -was invoked implicitly from this function. -This is corrected beginning with libarchive 2.0. +failures, you should be careful to call it separately, as +you cannot obtain error information after +.Fn archive_write_free +returns. .El More information about the .Va struct archive @@ -529,7 +529,7 @@ write_archive(const char *outname, const archive_entry_free(entry); filename++; } - archive_write_finish(a); + archive_write_free(a); } int main(int argc, const char **argv) @@ -580,7 +580,7 @@ may include .Fn archive_write_data , .Fn archive_write_close , or -.Fn archive_write_finish . +.Fn archive_write_free . The client callback can call .Fn archive_set_error to provide values that can then be retrieved by Modified: vendor/libarchive/dist/libarchive/archive_write.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_write.c Mon Dec 26 22:25:58 2011 (r228905) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/ static struct archive_vtable *archive_write_vtable(void); static int _archive_write_close(struct archive *); -static int _archive_write_finish(struct archive *); +static int _archive_write_free(struct archive *); static int _archive_write_header(struct archive *, struct archive_entry *); static int _archive_write_finish_entry(struct archive *); static ssize_t _archive_write_data(struct archive *, const void *, size_t); @@ -73,7 +73,7 @@ archive_write_vtable(void) if (!inited) { av.archive_close = _archive_write_close; - av.archive_finish = _archive_write_finish; + av.archive_free = _archive_write_free; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; @@ -383,13 +383,13 @@ _archive_write_close(struct archive *_a) * Destroy the archive structure. */ static int -_archive_write_finish(struct archive *_a) +_archive_write_free(struct archive *_a) { struct archive_write *a = (struct archive_write *)_a; int r = ARCHIVE_OK; __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_finish"); + ARCHIVE_STATE_ANY, "archive_write_free"); if (a->archive.state != ARCHIVE_STATE_CLOSED) r = archive_write_close(&a->archive); Modified: vendor/libarchive/dist/libarchive/archive_write_disk.3 ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk.3 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_write_disk.3 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: src/lib/libarchive/archive_write_disk.3,v 1.4 2008/09/04 05:22:00 kientzle Exp $ .\" .Dd August 5, 2008 -.Dt archive_write_disk 3 +.Dt ARCHIVE_WRITE_DISK 3 .Os .Sh NAME .Nm archive_write_disk_new , @@ -38,7 +38,7 @@ .Nm archive_write_data , .Nm archive_write_finish_entry , .Nm archive_write_close , -.Nm archive_write_finish +.Nm archive_write_free .Nd functions for creating objects on disk .Sh SYNOPSIS .In archive.h @@ -73,7 +73,7 @@ .Ft int .Fn archive_write_close "struct archive *" .Ft int -.Fn archive_write_finish "struct archive *" +.Fn archive_write_free "struct archive *" .Sh DESCRIPTION These functions provide a complete API for creating objects on disk from @@ -239,7 +239,7 @@ The .Nm library maintains a list of all such deferred attributes and sets them when this function is invoked. -.It Fn archive_write_finish +.It Fn archive_write_free Invokes .Fn archive_write_close if it was not invoked manually, then releases all resources. @@ -339,7 +339,7 @@ In particular, the directory .Pa aa is created as well as the final object .Pa bb . -In theory, this can be exploited to create an entire directory heirarchy +In theory, this can be exploited to create an entire directory hierarchy with a single request. Of course, this does not work if the .Cm ARCHIVE_EXTRACT_NODOTDOT @@ -371,5 +371,5 @@ compact implementation when appropriate. .Pp There should be a corresponding .Nm archive_read_disk -interface that walks a directory heirarchy and returns archive +interface that walks a directory hierarchy and returns archive entry objects. \ No newline at end of file Modified: vendor/libarchive/dist/libarchive/archive_write_disk.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_disk.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_write_disk.c Mon Dec 26 22:25:58 2011 (r228905) @@ -252,7 +252,7 @@ static ssize_t write_data_block(struct a static struct archive_vtable *archive_write_disk_vtable(void); static int _archive_write_close(struct archive *); -static int _archive_write_finish(struct archive *); +static int _archive_write_free(struct archive *); static int _archive_write_header(struct archive *, struct archive_entry *); static int _archive_write_finish_entry(struct archive *); static ssize_t _archive_write_data(struct archive *, const void *, size_t); @@ -291,7 +291,7 @@ archive_write_disk_vtable(void) if (!inited) { av.archive_close = _archive_write_close; - av.archive_finish = _archive_write_finish; + av.archive_free = _archive_write_free; av.archive_write_header = _archive_write_header; av.archive_write_finish_entry = _archive_write_finish_entry; av.archive_write_data = _archive_write_data; @@ -1295,7 +1295,7 @@ _archive_write_close(struct archive *_a) } static int -_archive_write_finish(struct archive *_a) +_archive_write_free(struct archive *_a) { struct archive_write_disk *a = (struct archive_write_disk *)_a; int ret; Modified: vendor/libarchive/dist/libarchive/archive_write_set_format_cpio.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_write_set_format_cpio.c Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/archive_write_set_format_cpio.c Mon Dec 26 22:25:58 2011 (r228905) @@ -62,6 +62,11 @@ struct cpio { size_t ino_list_next; }; +#ifdef _MSC_VER +#define __packed +#pragma pack(push, 1) +#endif + struct cpio_header { char c_magic[6]; char c_dev[6]; @@ -74,7 +79,12 @@ struct cpio_header { char c_mtime[11]; char c_namesize[6]; char c_filesize[11]; -}; +} __packed; + +#ifdef _MSC_VER +#undef __packed +#pragma pack(pop) +#endif /* * Set output format to 'cpio' format. Modified: vendor/libarchive/dist/libarchive/cpio.5 ============================================================================== --- vendor/libarchive/dist/libarchive/cpio.5 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/cpio.5 Mon Dec 26 22:25:58 2011 (r228905) @@ -268,31 +268,6 @@ data, including ACLs and extended attrib entries in cpio archives. .Pp XXX Others? XXX -.Sh BUGS -The -.Dq CRC -format is mis-named, as it uses a simple checksum and -not a cyclic redundancy check. -.Pp -The old binary format is limited to 16 bits for user id, -group id, device, and inode numbers. -It is limited to 4 gigabyte file sizes. -.Pp -The old ASCII format is limited to 18 bits for -the user id, group id, device, and inode numbers. -It is limited to 8 gigabyte file sizes. -.Pp -The new ASCII format is limited to 4 gigabyte file sizes. -.Pp -None of the cpio formats store user or group names, -which are essential when moving files between systems with -dissimilar user or group numbering. -.Pp -Especially when writing older cpio variants, it may be necessary -to map actual device/inode values to synthesized values that -fit the available fields. -With very large filesystems, this may be necessary even for -the newer formats. .Sh SEE ALSO .Xr cpio 1 , .Xr tar 5 @@ -323,3 +298,28 @@ license. The character format was adopted as part of .St -p1003.1-88 . XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX +.Sh BUGS +The +.Dq CRC +format is mis-named, as it uses a simple checksum and +not a cyclic redundancy check. +.Pp +The old binary format is limited to 16 bits for user id, +group id, device, and inode numbers. +It is limited to 4 gigabyte file sizes. +.Pp +The old ASCII format is limited to 18 bits for +the user id, group id, device, and inode numbers. +It is limited to 8 gigabyte file sizes. +.Pp +The new ASCII format is limited to 4 gigabyte file sizes. +.Pp +None of the cpio formats store user or group names, +which are essential when moving files between systems with +dissimilar user or group numbering. +.Pp +Especially when writing older cpio variants, it may be necessary +to map actual device/inode values to synthesized values that +fit the available fields. +With very large filesystems, this may be necessary even for +the newer formats. Modified: vendor/libarchive/dist/libarchive/libarchive-formats.5 ============================================================================== --- vendor/libarchive/dist/libarchive/libarchive-formats.5 Mon Dec 26 21:51:53 2011 (r228904) +++ vendor/libarchive/dist/libarchive/libarchive-formats.5 Mon Dec 26 22:25:58 2011 (r228905) @@ -25,7 +25,7 @@ .\" $FreeBSD: head/lib/libarchive/libarchive-formats.5 201077 2009-12-28 01:50:23Z kientzle $ .\" .Dd December 27, 2009 -.Dt libarchive-formats 5 +.Dt LIBARCHIVE-FORMATS 5 *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***