InfoZip and the UNZIP Environment Variable

This is just to document a recent frustration I had with a batch file wrapping a call to the InfoZip unzip.exe. (Hint: ever define an UNZIP env. variable?)

Session Transcript

C:\testbin>unzip -v
UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with Microsoft C 13.10 (Visual C++ 7.1) for
Windows 9x / Windows NT/2K/XP/2K3 (32-bit) on Apr 20 2009.

UnZip special compilation options:
        ASM_CRC
        COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
        NTSD_EAS
        SET_DIR_ATTRIB
        TIMESTAMP
        UNIXBACKUP
        USE_EF_UT_TIME
        USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
        USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
        UNICODE_SUPPORT [wide-chars] (handle UTF-8 paths)
        MBCS-support (multibyte character support, MB_CUR_MAX = 1)
        LARGE_FILE_SUPPORT (large files over 2 GiB supported)
        ZIP64_SUPPORT (archives using Zip64 for large files supported)
        USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.5, 10-Dec-2007)
        VMS_TEXT_CONV
        [decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
           UNZIP:  [none]
        UNZIPOPT:  [none]
         ZIPINFO:  [none]
      ZIPINFOOPT:  [none]

C:\testbin>set UNZIP=c:\testbin\unzip.exe

C:\testbin>unzip -v
Archive:  c:/testbin/unzip.exe
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
note:  c:/testbin/unzip.exe may be a plain executable, not an archive
unzip:  cannot find zipfile directory in c:/testbin/unzip.exe,
        and cannot find c:/testbin/unzip.exe.zip, period.

Conclusion

unzip.exe will use the UNZIP environment variable as flags to every invocation. Notice that it shows up in the Version output? Turns out, this is a documented feature to allow you to define system-wide options to unzip, such as converting line endings.

In case you'd like to know more, here is the documentation: http://www.info-zip.org/mans/unzip.html#ENVIRONMENT%20OPTIONS

Hope this doesn't bite you like it did me.

 
blog/20111122_infozip_and_the_unzip_environment_variable.txt · Last modified: 2011/11/22 18:42 by Jeremy Murray · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki