Imported Upstream version 1.1.2 34/94134/1
authorDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 27 Oct 2016 06:26:27 +0000 (15:26 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Thu, 27 Oct 2016 06:26:28 +0000 (15:26 +0900)
Change-Id: Ie09810d042ce3d099e0bb6b6cdb4500cf9a62908
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
17 files changed:
CMakeLists.txt
Makefile.in
NEWS
README [deleted file]
THANKS
TODO [deleted file]
configure
configure.ac
lib/zip_open.c
regress/CMakeLists.txt
regress/Makefile.am
regress/Makefile.in
regress/NiHTest.pm
regress/multidisk.zip [new file with mode: 0644]
regress/open_multidisk.test [new file with mode: 0644]
regress/open_zip64_3mf.test [new file with mode: 0644]
regress/zip64-3mf.zip [new file with mode: 0644]

index 7c61556..9e20bce 100644 (file)
@@ -20,9 +20,9 @@ SET(PACKAGE "libzip")
 SET(PACKAGE_NAME ${PACKAGE})
 SET(PACKAGE_VERSION_MAJOR "1")
 SET(PACKAGE_VERSION_MINOR "1")
-SET(PACKAGE_VERSION_PATCH "1")
-SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
-#SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
+SET(PACKAGE_VERSION_PATCH "2")
+#SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}")
+SET(VERSION "${PACKAGE_VERSION_MAJOR}.${PACKAGE_VERSION_MINOR}.${PACKAGE_VERSION_PATCH}")
 SET(PACKAGE_VERSION ${VERSION})
 SET(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
 
index a976b33..1a33b3d 100644 (file)
@@ -192,8 +192,8 @@ CSCOPE = cscope
 DIST_SUBDIRS = $(SUBDIRS)
 am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
        $(srcdir)/libzip-uninstalled.pc.in $(srcdir)/libzip.pc.in \
-       AUTHORS INSTALL NEWS README THANKS TODO compile config.guess \
-       config.sub depcomp install-sh ltmain.sh missing
+       AUTHORS INSTALL NEWS THANKS compile config.guess config.sub \
+       depcomp install-sh ltmain.sh missing
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 distdir = $(PACKAGE)-$(VERSION)
 top_distdir = $(distdir)
diff --git a/NEWS b/NEWS
index 1ac8ea9..3a3ee2e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,7 @@
+1.1.2 [2016/02/19]
+
+* Improve support for 3MF files
+
 1.1.1 [2016/02/07]
 
 * Build fixes for Linux
diff --git a/README b/README
deleted file mode 100644 (file)
index 54ba818..0000000
--- a/README
+++ /dev/null
@@ -1,37 +0,0 @@
-  This is libzip, a C library for reading, creating, and modifying zip
-archives.  Files can be added from data buffers, files, or compressed
-data copied directly from other zip archives.  Changes made without
-closing the archive can be reverted.  The API is documented by man
-pages.
-
-  For more information, take a look at the included man pages.  You
-can start with libzip(3), which lists all others.  Example source code
-is in the src/ subdirectory.
-
-  If you have developed an application using libzip, you can find out
-about API changes and how to adapt your code for them in the included
-file API-CHANGES.
-
-  For generic installation instructions, see file 'INSTALL', which
-describes the approach using autoconf; alternatively, you can
-use cmake to build.
-
-  Additionally, you'll need zlib (at least version 1.1.2). It comes
-with most operating systems nowadays, or you can get it at
-       http://www.zlib.net/
-
-  When using a static Windows library, you need to define ZIP_STATIC
-when compiling packages using libzip.
-
-  If you make a binary distribution, please include a pointer to the
-distribution site:
-       http://www.nih.at/libzip/
-       ftp.nih.at /pub/nih/libzip
-The latest version can always be found there.
-
-  There is a mailing list for developers using libzip.  You can
-subscribe to it by sending a mail with the subject "subscribe
-libzip-discuss" to minimalist at nih.at. List mail should be sent
-to libzip-discuss at nih.at. Use this for bug reports or questions.
-
-  If you want to reach the authors in private, use <libzip@nih.at>.
diff --git a/THANKS b/THANKS
index 7a65068..10b237a 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -50,6 +50,7 @@ Tarmo Pikaro <tapika@yahoo.com>
 Timo Warns <warns@pre-sense.de>
 Tom Callaway <tcallawa@redhat.com>
 Tomas Hoger <thoger@redhat.com>
+Torsten Paul <Torsten.Paul@gmx.de>
 Vassili Courzakis <vcoxvco@googlemail.com>
 Wojciech Michalski <wmichalski@quay.pl>
 Wolfgang Glunz <Wolfgang.Glunz@gmx.de>
diff --git a/TODO b/TODO
deleted file mode 100644 (file)
index 3dca4ec..0000000
--- a/TODO
+++ /dev/null
@@ -1,170 +0,0 @@
-API Plans
-=========
-
-Encryption
-----------
-* struct zip *zip_open_encrypted(const char *path, int flags, const char *password, int *errorp);
-* int zip_set_encryption(struct zip *archive, zip_uint64_t idx, zip_uint16_t method, const char *password);
-* void zip_set_archive_encryption(struct zip *archive, zip_uint16_t method, const char *password);
-
-Prefixes
---------
-For example for adding extractors for self-extracting zip archives.
-* zip_set_archive_prefix(struct zip *za, const zip_uint8_t *data, zip_uint64_t length);
-* const zip_uint8_t *zip_get_archive_prefix(struct zip *za, zip_uint64_t *lengthp);
-
-Progress Callback
------------------
-Register callback; will be called from zip_close() after each file has been processed.
-typedef void (*zip_progress_callback_t)(double);
-void zip_register_progress_callback(zip_t *, zip_progress_callback_t);
-
-API Issues
-==========
-! D zip_get_archive_comment has int *lenp argument.  Cleaner would be zip_uint32_t *.
-       rename and fix.  which other functions for naming consistency?
-! D rename remaining zip_XXX_{file,archive}_* to zip_{file,archive}_XXX_*?
-* compression/crypt implementations: how to set error code on failure
-* compression/crypt error messages a la ZIP_ER_ZLIB (no detailed info passing)
-* check arguments for every entry point into libzip
-
-
-Features
-========
-* support setting extra fields from zip_source
-  . introduce layers of extra fields:
-    . original
-    . from zip_source
-    . manually set
-  . when querying extra fields, search all of them in reverse order
-  . add whiteout (deleted) flag
-  . allow invalid data flag, used when computing extra field size before writing data
-  . new command ZIP_SOURCE_EXTRA_FIELDS
-  . no support for multiple copies of same extra field
-* delete all extra fields during zip_replace()
-* function to copy file from one archive to another
-* set O_CLOEXEC flag after fopen and mkstemp
-* configure: use windows backends on windows
-* add append-only mode writing file to disk incrementally to keep memory usage low
-* zip_file_set_mtime: support InfoZIP time stamps
-
-* support streaming output (creating new archive to e.g. stdout)
-* add functions to:
-  . read/set ASCII file flag? (wiz: more general options?)
-* zip_commit (to finish changes without closing archive)
-* add custom compression function support
-* zip_fseek
-* zip_source_zip: allow rewinding
-* zipcmp: add option for file content comparison
-* zipcmp: compare bit flags if paranoid
-* zipcmp: compare external attributes/opsys if paranoid
-* zipcmp: compare last_mod if paranoid (or with separate flag?)
-* consistency
-  . for stored files, test compressed = uncompressed
-  . data descriptor
-  . local headers come before central dir
-
-* support for old compression methods?????
-
-
-Bugs
-====
-* support InfoZIP encryption header extension (copy data descriptor for encrypted files)
-! ensure that nentries is small enough not to cause overflow (size_t for entry, uint64 for CD on disk)
-* fix OpenSUSE i686 regression failures
-* fix open_filename_duplicate_consistency.test to fail
-* check for limits imposed by format (central dir size, file size, extra fields, ...)
-* _zip_u2d_time: handle localtime(3) failure
-* POSIX: zip_open: check whether file can be created and fail if not
-* fix inconsistent usage of valid flags (not checked in many places)
-* cdr == NULL -> ER_NOENT vs. idx > cdir->nentry -> ER_INVAL inconsistent (still there?)
-
-
-Cleanup
-=======
-* use bool
-* use ZIP_SOURCE_SUPPORTS_{READABLE,SEEKABLE,WRITABLE}
-* use zip_source_seek_compute_offset
-* move compat refs from zipint.h to own file, and include that in zipint.h and src
-* get rid of zip_get_{compression,encryption}_implementation
-* use zip_*int*_t internally
-
-
-Analysis
-========
-* pass through coverity
-
-
-Infrastructure
-==============
-* create CMakefile.txt man page linking from links file
-
-
-Test Case Issues
-================
-* unchange on added file
-* test seek in zip_source_crc
-* test cases for set_extra*, delete_extra*, *extra_field*
-* test cases for in memory archives
-  add
-  delete
-  delete all
-  modify
-* use gcov output to increase test coverage
-* merge most tools into modify
-* add test case to change values for newly added files (name, compression method, comment, mtime, . . .)
-* zip_open file less than EOCDLEN bytes long
-* test calls against old API
-* run regression tests also from CMake framework
-* rename file to dir/ and vice versa (fails)
-* fix comment test to be newline insensitive
-* check if http://bugs.python.org/issue20078 provides ideas for new tests
-
-* (add, replace)
-       add to empty zip
-       add to existing zip
-       add w/ existing file name [E]
-       replace ok
-       replace w/ illegal index [E]
-       replace w/ deleted name [E]
-       unchange added/replaced file
-* (close)
-       copy zip file
-       open copy
-       rename, delete, replace, add w/ new name, add w/ deleted name
-       close
-       zipcmp copy expected
-       remove copy
-* (error_get)
-* (error_get_sys_type)
-* (error_to_str)
-* (extra_fields)
-* (file_error_get)
-* (file_strerror)
-* (replace)
-* (source_buffer)
-* (source_file)
-* (source_filep)
-* (source_free)
-* (source_function)
-* (source_zip)
-* (strerror)
-* (unchange)
-* (unchange_all)
-* open(ZIP_RDONLY)
-* I/O abstraction layer
-    zip_open_from_source
-* read two zip entries interleaved
-
-
-Unsorted
-========
-* zip_source_file: don't allow write if start/len specify a part of the file
-* script to check if all exported symbols are marked with ZIP_EXTERN, add to make distcheck
-
-D re-implement fix for OS X sandboxing (zip_archive_set_tempdir).
-
-* document: zip_source_write: length can't be > ZIP_INT64_MAX
-* document: ZIP_SOURCE_CLOSE implementation can't return error
-* keep error codes in man pages in sync
-* document error codes in new man pages
index d65dd3d..f9e6ba9 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libzip 1.1.1.
+# Generated by GNU Autoconf 2.69 for libzip 1.1.2.
 #
 # Report bugs to <libzip@nih.at>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libzip'
 PACKAGE_TARNAME='libzip'
-PACKAGE_VERSION='1.1.1'
-PACKAGE_STRING='libzip 1.1.1'
+PACKAGE_VERSION='1.1.2'
+PACKAGE_STRING='libzip 1.1.2'
 PACKAGE_BUGREPORT='libzip@nih.at'
 PACKAGE_URL=''
 
@@ -1316,7 +1316,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libzip 1.1.1 to adapt to many kinds of systems.
+\`configure' configures libzip 1.1.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1386,7 +1386,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libzip 1.1.1:";;
+     short | recursive ) echo "Configuration of libzip 1.1.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1493,7 +1493,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libzip configure 1.1.1
+libzip configure 1.1.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2202,7 +2202,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libzip $as_me 1.1.1, which was
+It was created by libzip $as_me 1.1.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3069,7 +3069,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libzip'
- VERSION='1.1.1'
+ VERSION='1.1.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13157,7 +13157,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libzip $as_me 1.1.1, which was
+This file was extended by libzip $as_me 1.1.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -13223,7 +13223,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libzip config.status 1.1.1
+libzip config.status 1.1.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index a6c9d12..deb0e87 100644 (file)
@@ -1,5 +1,5 @@
 AC_PREREQ([2.60])
-AC_INIT([libzip],[1.1.1],[libzip@nih.at])
+AC_INIT([libzip],[1.1.2],[libzip@nih.at])
 AC_CONFIG_SRCDIR([lib/zip_add.c])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
index 3f866a9..d6209ee 100644 (file)
@@ -293,11 +293,6 @@ _zip_read_cdir(zip_t *za, zip_buffer_t *buffer, zip_uint64_t buf_offset, zip_err
        return NULL;
     }
 
-    if (_zip_buffer_get_32(buffer) != 0) {
-       zip_error_set(error, ZIP_ER_MULTIDISK, 0);
-       return NULL;
-    }
-
     if (eocd_offset >= EOCD64LOCLEN && memcmp(_zip_buffer_data(buffer) + eocd_offset - EOCD64LOCLEN, EOCD64LOC_MAGIC, 4) == 0) {
         _zip_buffer_set_offset(buffer, eocd_offset - EOCD64LOCLEN);
         cd = _zip_read_eocd64(za->src, buffer, buf_offset, za->flags, error);
@@ -668,7 +663,8 @@ _zip_memmem(const unsigned char *big, size_t biglen, const unsigned char *little
 }
 
 
-static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error)
+static zip_cdir_t *
+_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset, unsigned int flags, zip_error_t *error)
 {
     zip_cdir_t *cd;
     zip_uint64_t i, nentry, size, offset, eocd_offset;
@@ -680,7 +676,12 @@ static zip_cdir_t *_zip_read_eocd(zip_buffer_t *buffer, zip_uint64_t buf_offset,
     
     eocd_offset = _zip_buffer_offset(buffer);
 
-    _zip_buffer_get(buffer, 8); /* magic and number of disks already verified */
+    _zip_buffer_get(buffer, 4); /* magic already verified */
+
+    if (_zip_buffer_get_32(buffer) != 0) {
+       zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+       return NULL;
+    }
 
     /* number of cdir-entries on this disk */
     i = _zip_buffer_get_16(buffer);
@@ -730,10 +731,14 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
     zip_uint64_t eocd_offset;
     zip_uint64_t size, nentry, i, eocdloc_offset;
     bool free_buffer;
+    zip_uint32_t num_disks, num_disks64, eocd_disk, eocd_disk64;
 
     eocdloc_offset = _zip_buffer_offset(buffer);
     
-    _zip_buffer_get(buffer, 8); /* magic and single disk already verified */
+    _zip_buffer_get(buffer, 4); /* magic already verified */
+
+    num_disks = _zip_buffer_get_16(buffer);
+    eocd_disk = _zip_buffer_get_16(buffer);
     eocd_offset = _zip_buffer_get_64(buffer);
     
     if (eocd_offset > ZIP_INT64_MAX || eocd_offset + EOCD64LEN < eocd_offset) {
@@ -779,8 +784,29 @@ _zip_read_eocd64(zip_source_t *src, zip_buffer_t *buffer, zip_uint64_t buf_offse
         return NULL;
     }
 
-    _zip_buffer_get(buffer, 12); /* skip version made by/needed and num disks */
-    
+    _zip_buffer_get(buffer, 4); /* skip version made by/needed */
+
+    num_disks64 = _zip_buffer_get_32(buffer);
+    eocd_disk64 = _zip_buffer_get_32(buffer);
+
+    /* if eocd values are 0xffff, we have to use eocd64 values.
+       otherwise, if the values are not the same, it's inconsistent;
+       in any case, if the value is not 0, we don't support it */
+    if (num_disks == 0xffff) {
+       num_disks = num_disks64;
+    }
+    if (eocd_disk == 0xffff) {
+       eocd_disk = eocd_disk64;
+    }
+    if ((flags & ZIP_CHECKCONS) && (eocd_disk != eocd_disk64 || num_disks != num_disks64)) {
+       zip_error_set(error, ZIP_ER_INCONS, 0);
+       return NULL;
+    }
+    if (num_disks != 0 || eocd_disk != 0) {
+       zip_error_set(error, ZIP_ER_MULTIDISK, 0);
+       return NULL;
+    }
+
     nentry = _zip_buffer_get_64(buffer);
     i = _zip_buffer_get_64(buffer);
 
index 8d7816e..332530f 100644 (file)
@@ -72,6 +72,7 @@ SET(EXTRA_TESTS
        open_filename_empty.test
        open_incons.test
        open_many_ok.test
+       open_multidisk.test
        open_new_but_exists.test
        open_new_ok.test
        open_nonarchive.test
@@ -79,6 +80,7 @@ SET(EXTRA_TESTS
        open_ok.test
        open_too_short.test
        open_truncate.test
+       open_zip64_3mf.test
        open_zip64_ok.test
        rename_ascii.test
        rename_cp437.test
index 065e15e..0fb4c06 100644 (file)
@@ -86,6 +86,7 @@ EXTRA_DIST= \
        incons-local-size-larger.zip \
        large-uncompressable \
        manyfiles-zip.zip \
+       multidisk.zip \
        rename_ok.zip \
        streamed.zip \
        streamed-zip64.zip \
@@ -119,7 +120,8 @@ EXTRA_DIST= \
        utf-8-standardization-input.zip \
        utf-8-standardization-output.zip \
        zip-in-archive-comment.zip \
-       zip64.zip
+       zip64.zip \
+       zip64-3mf.zip
 
 TESTS_ENVIRONMENT=     ZIPCMP=${top_builddir}/src/zipcmp
 # ${srcdir}/runtest
@@ -186,6 +188,7 @@ TESTS= \
        open_filename_empty.test \
        open_incons.test \
        open_many_ok.test \
+       open_multidisk.test \
        open_new_but_exists.test \
        open_new_ok.test \
        open_nonarchive.test \
@@ -193,6 +196,7 @@ TESTS= \
        open_ok.test \
        open_too_short.test \
        open_truncate.test \
+       open_zip64_3mf.test \
        open_zip64_ok.test \
        rename_ascii.test \
        rename_cp437.test \
index 32edd31..a7f6f29 100644 (file)
@@ -595,6 +595,7 @@ EXTRA_DIST = \
        incons-local-size-larger.zip \
        large-uncompressable \
        manyfiles-zip.zip \
+       multidisk.zip \
        rename_ok.zip \
        streamed.zip \
        streamed-zip64.zip \
@@ -628,7 +629,8 @@ EXTRA_DIST = \
        utf-8-standardization-input.zip \
        utf-8-standardization-output.zip \
        zip-in-archive-comment.zip \
-       zip64.zip
+       zip64.zip \
+       zip64-3mf.zip
 
 TESTS_ENVIRONMENT = ZIPCMP=${top_builddir}/src/zipcmp
 # ${srcdir}/runtest
@@ -694,6 +696,7 @@ TESTS = \
        open_filename_empty.test \
        open_incons.test \
        open_many_ok.test \
+       open_multidisk.test \
        open_new_but_exists.test \
        open_new_ok.test \
        open_nonarchive.test \
@@ -701,6 +704,7 @@ TESTS = \
        open_ok.test \
        open_too_short.test \
        open_truncate.test \
+       open_zip64_3mf.test \
        open_zip64_ok.test \
        rename_ascii.test \
        rename_cp437.test \
index dbc3506..ee85e1d 100644 (file)
@@ -6,6 +6,7 @@ use warnings;
 use Cwd;
 use File::Copy;
 use File::Path qw(mkpath remove_tree);
+use Getopt::Long qw(:config posix_default bundling no_ignore_case);
 use IPC::Open3;
 use Symbol 'gensym';
 use UNIVERSAL;
@@ -13,7 +14,7 @@ use UNIVERSAL;
 use Data::Dumper qw(Dumper);
 
 #  NiHTest -- package to run regression tests
-#  Copyright (C) 2002-2015 Dieter Baron and Thomas Klausner
+#  Copyright (C) 2002-2016 Dieter Baron and Thomas Klausner
 #
 #  This file is part of ckmame, a program to check rom sets for MAME.
 #  The authors can be contacted at <ckmame@nih.at>
@@ -349,12 +350,25 @@ sub runtest {
 
 sub setup {
        my ($self, @argv) = @_;
-       
-       if (scalar(@argv) != 1) {
-               print STDERR "Usage: $0 testcase\n";
+
+       my @save_argv = @ARGV;
+       @ARGV = @argv;
+       my $ok = GetOptions(
+               'help|h' => \my $help,
+               'keep-broken' => \$self->{keep_broken},
+               'no-cleanup' => \$self->{no_cleanup},
+               # 'run-gdb' => \$self->{run_gdb},
+               'setup-only' => \$self->{setup_only},
+               'verbose|v' => \$self->{verbose}
+       );
+       @argv = @ARGV;
+       @ARGV = @save_argv;
+
+       if (!$ok || scalar(@argv) != 1 || $help) {
+               print STDERR "Usage: $0 [-hv] [--keep-broken] [--no-cleanup] [--setup-only] testcase\n";
                exit(1);
        }
-       
+
        my $testcase = shift @argv;
 
        $testcase .= '.test' unless ($testcase =~ m/\.test$/);
@@ -369,6 +383,8 @@ sub setup {
        $self->die("error in test case definition") unless $self->parse_case($testcase_file);
        
        $self->check_features_requirement() if ($self->{test}->{features});
+
+       $self->end_test('SKIP') if ($self->{test}->{preload} && $^O eq 'darwin');
 }
 
 
@@ -483,6 +499,7 @@ sub compare_file($$$) {
        return $ok;
 }
 
+
 sub compare_files() {
        my ($self) = @_;
        
@@ -662,9 +679,24 @@ sub parse_args {
                }
                my @types = split /\s+/, $type;
                my @strs = split /\s+/, $str;
-               
-               if (!$ellipsis && scalar(@types) != scalar(@strs)) {
-                       $self->warn_file_line("expected " . (scalar(@types)) . " arguments, got " . (scalar(@strs)));
+               my $optional = 0;
+               for (my $i = scalar(@types) - 1; $i >= 0; $i--) {
+                       last unless ($types[$i] =~ m/(.*)\?$/);
+                       $types[$i] = $1;
+                       $optional++;
+               }
+
+               if ($ellipsis && $optional > 0) {
+                       # TODO: check this when registering a directive
+                       $self->warn_file_line("can't use ellipsis together with optional arguments");
+                       return undef;
+               }
+               if (!$ellipsis && (scalar(@strs) < scalar(@types) - $optional || scalar(@strs) > scalar(@types))) {
+                       my $expected = scalar(@types);
+                       if ($optional > 0) {
+                               $expected = ($expected - $optional) . "-$expected";
+                       }
+                       $self->warn_file_line("expected $expected arguments, got " . (scalar(@strs)));
                        return undef;
                }
                
@@ -737,8 +769,8 @@ sub parse_case() {
                }
                
                my $args = $self->parse_args($def->{type}, $argstring);
-
-               if (!defined($args)) {
+            
+               unless (defined($args)) {
                        $ok = 0;
                        next;
                }
@@ -870,9 +902,9 @@ sub run_hook {
        
        return $ok;
 }
+sub backslash_decode {
 
 
-sub backslash_decode {
        my ($str) = @_;
 
        if ($str =~ m/\\/) {
@@ -894,9 +926,7 @@ sub backslash_decode {
 
 sub run_program {
        my ($self) = @_;
-
        goto &pipein_win32 if $^O eq 'MSWin32' && $self->{test}->{pipein};
-
        my ($stdin, $stdout, $stderr);
        $stderr = gensym;
 
diff --git a/regress/multidisk.zip b/regress/multidisk.zip
new file mode 100644 (file)
index 0000000..28dafb9
Binary files /dev/null and b/regress/multidisk.zip differ
diff --git a/regress/open_multidisk.test b/regress/open_multidisk.test
new file mode 100644 (file)
index 0000000..1da4a5c
--- /dev/null
@@ -0,0 +1,7 @@
+# zip_open: file is part of a multi-disk zip archive
+program tryopen
+args test.piz
+return 1
+file test.piz multidisk.zip multidisk.zip
+stdout opening 'test.piz' returned error 1
+stderr 1 errors
diff --git a/regress/open_zip64_3mf.test b/regress/open_zip64_3mf.test
new file mode 100644 (file)
index 0000000..4a57154
--- /dev/null
@@ -0,0 +1,6 @@
+# zip_open: ZIP64 file opens fine even when most eocd entries are 0xff (3MF format)
+program tryopen
+args test.zip
+return 0
+file test.zip zip64-3mf.zip zip64-3mf.zip
+stdout opening 'test.zip' succeeded, 1 entries
diff --git a/regress/zip64-3mf.zip b/regress/zip64-3mf.zip
new file mode 100644 (file)
index 0000000..a2ccf24
Binary files /dev/null and b/regress/zip64-3mf.zip differ