~ubuntu-branches/ubuntu/karmic/unzip/karmic

« back to all changes in this revision

Viewing changes to man/unzip.1

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-09-29 17:02:50 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050929170250-my63eoy88vv1gd7e
Tags: 5.52-3ubuntu2
* SECURITY UPDATE: Fix file permission modification race.
* unix/unix.c: Use fchmod() instead of chmod() to change permissions on the
  files unzip actually created, not the files another attacker might have
  hardlinked to in the meantime.
* CAN-2005-2475

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\"  Copyright (c) 1990-2004 Info-ZIP.  All rights reserved.
 
1
.\"  Copyright (c) 1990-2005 Info-ZIP.  All rights reserved.
2
2
.\"
3
3
.\"  See the accompanying file LICENSE, version 2000-Apr-09 or later
4
4
.\"  (the contents of which are also included in unzip.h) for terms of use.
20
20
.in -4n
21
21
..
22
22
.\" =========================================================================
23
 
.TH UNZIP 1L "22 May 2004 (v5.51)" "Info-ZIP"
 
23
.TH UNZIP 1 "28 February 2005 (v5.52)" "Info-ZIP"
24
24
.SH NAME
25
25
unzip \- list, test and extract compressed files in a ZIP archive
26
26
.PD
27
27
.SH SYNOPSIS
28
 
\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptuvz\fP[\fBabjnoqsCLMVX$/:\fP]]
 
28
\fBunzip\fP [\fB\-Z\fP] [\fB\-cflptTuvz\fP[\fBabjnoqsCKLMVWX$/:\fP]]
29
29
\fIfile\fP[\fI.zip\fP] [\fIfile(s)\fP\ .\|.\|.]
30
30
[\fB\-x\fP\ \fIxfile(s)\fP\ .\|.\|.] [\fB\-d\fP\ \fIexdir\fP]
31
31
.PD
34
34
\fIunzip\fP will list, test, or extract files from a ZIP archive, commonly
35
35
found on MS-DOS systems.  The default behavior (with no options) is to extract
36
36
into the current directory (and subdirectories below it) all files from the
37
 
specified ZIP archive.  A companion program, \fIzip\fP(1L), creates ZIP
 
37
specified ZIP archive.  A companion program, \fIzip\fP(1), creates ZIP
38
38
archives; both programs are compatible with archives created by PKWARE's
39
39
\fIPKZIP\fP and \fIPKUNZIP\fP for MS-DOS, but in many cases the program
40
40
options or default behaviors differ.
58
58
by a beginning character, a hyphen, and an ending character.  If an exclamation
59
59
point or a caret (`!' or `^') follows the left bracket, then the range of
60
60
characters within the brackets is complemented (that is, anything \fIexcept\fP
61
 
the characters inside the brackets is considered a match).
 
61
the characters inside the brackets is considered a match).  To specify a
 
62
verbatim left bracket, the three-character sequence ``[[]'' has to be used.
62
63
.RE
63
64
.IP
64
65
(Be sure to quote any character that might otherwise be interpreted or
76
77
or modified by the operating system.
77
78
.IP [\fB\-x\fP\ \fIxfile(s)\fP]
78
79
An optional list of archive members to be excluded from processing.
79
 
Since wildcard characters match directory separators (`/'), this option
80
 
may be used to exclude any files that are in subdirectories.  For
 
80
Since wildcard characters normally match (`/') directory separators
 
81
(for exceptions see the option \fb\-W\fp\), this option may be used
 
82
to exclude any files that are in subdirectories.  For
81
83
example, ``\fCunzip foo *.[ch] -x */*\fR'' would extract all C source files
82
84
in the main directory, but none in any subdirectories.  Without the \fB\-x\fP
83
85
option, all C source files in all directories within the zipfile would be
103
105
list of all possible flags.  The exhaustive list follows:
104
106
.TP
105
107
.B \-Z
106
 
\fIzipinfo\fP(1L) mode.  If the first option on the command line is \fB\-Z\fP,
107
 
the remaining options are taken to be \fIzipinfo\fP(1L) options.  See the
 
108
\fIzipinfo\fP(1) mode.  If the first option on the command line is \fB\-Z\fP,
 
109
the remaining options are taken to be \fIzipinfo\fP(1) options.  See the
108
110
appropriate manual page for a description of these options.
109
111
.TP
110
112
.B \-A
169
171
now behaves as both an option and a modifier.  As an option it has two
170
172
purposes:  when a zipfile is specified with no other options, \fB\-v\fP lists
171
173
archive files verbosely, adding to the basic \fB\-l\fP info the compression
172
 
method, compressed size, compression ratio and 32-bit CRC.  When no zipfile
173
 
is specified (that is, the complete command is simply ``\fCunzip \-v\fR''), a
174
 
diagnostic screen is printed.  In addition to the normal header with release
175
 
date and version, \fIunzip\fP lists the home Info-ZIP ftp site and where to
176
 
find a list of other ftp and non-ftp sites; the target operating system for
177
 
which it was compiled, as well as (possibly) the hardware on which it was
178
 
compiled, the compiler and version used, and the compilation date; any special
179
 
compilation options that might affect the program's operation (see also
180
 
\fBDECRYPTION\fP below); and any options stored in environment variables
181
 
that might do the same (see \fBENVIRONMENT OPTIONS\fP below).  As a
182
 
modifier it works in conjunction with other options (e.g., \fB\-t\fP) to
183
 
produce more verbose or debugging output; this is not yet fully implemented
 
174
method, compressed size, compression ratio and 32-bit CRC.  In contrast to
 
175
most of the competing utilities, \fIunzip\fP removes the 12 additional header
 
176
bytes of encrypted entries from the compressed size numbers.  Therefore,
 
177
compressed size and compression ratio figures are independent of the entry's
 
178
encryption status and show the correct compression performance.  (The complete
 
179
size of the encrypted compressed data stream for zipfile entries is reported
 
180
by the more verbose \fIzipinfo\fP(1) reports, see the separate manual.)
 
181
When no zipfile is specified (that is, the complete command is simply
 
182
``\fCunzip \-v\fR''), a diagnostic screen is printed.  In addition to
 
183
the normal header with release date and version, \fIunzip\fP lists the
 
184
home Info-ZIP ftp site and where to find a list of other ftp and non-ftp
 
185
sites; the target operating system for which it was compiled, as well
 
186
as (possibly) the hardware on which it was compiled, the compiler and
 
187
version used, and the compilation date; any special compilation options
 
188
that might affect the program's operation (see also \fBDECRYPTION\fP below);
 
189
and any options stored in environment variables that might do the same
 
190
(see \fBENVIRONMENT OPTIONS\fP below).  As a modifier it works in
 
191
conjunction with other options (e.g., \fB\-t\fP) to produce more
 
192
verbose or debugging output; this is not yet fully implemented
184
193
but will be in future releases.
185
194
.TP
186
195
.B \-z
230
239
behavior of \fIemacs\fP(1) in many locations.
231
240
.TP
232
241
.B \-C
233
 
match filenames case-insensitively.  \fIunzip\fP's philosophy is ``you get
234
 
what you ask for'' (this is also responsible for the \fB\-L\fP/\fB\-U\fP
235
 
change; see the relevant options below).  Because some file systems are fully
236
 
case-sensitive (notably those under the Unix operating system) and because
 
242
use case-insensitive matching for the selection of archive entries
 
243
from the command-line list of extract selection patterns.
 
244
\fIunzip\fP's philosophy is ``you get what you ask for'' (this is
 
245
also responsible for the \fB\-L\fP/\fB\-U\fP change; see the relevant
 
246
options below).  Because some file systems are fully case-sensitive
 
247
(notably those under the Unix operating system) and because
237
248
both ZIP archives and \fIunzip\fP itself are portable across platforms,
238
 
\fIunzip\fP's default behavior is to match both wildcard and literal filenames
239
 
case-sensitively.  That is, specifying ``\fCmakefile\fR'' on the command line
240
 
will \fIonly\fP match ``makefile'' in the archive, not ``Makefile'' or
241
 
``MAKEFILE'' (and similarly for wildcard specifications).  Since this does
242
 
not correspond to the behavior of many other operating/file systems (for
243
 
example, OS/2 HPFS, which preserves mixed case but is not sensitive to it),
244
 
the \fB\-C\fP option may be used to force all filename matches to be
245
 
case-insensitive.  In the example above, all three files would then match
246
 
``\fCmakefile\fR'' (or ``\fCmake*\fR'', or similar).  The \fB\-C\fP option
247
 
affects files in both the normal file list and the excluded-file list (xlist).
 
249
\fIunzip\fP's default behavior is to match both wildcard and literal
 
250
filenames case-sensitively.  That is, specifying ``\fCmakefile\fR''
 
251
on the command line will \fIonly\fP match ``makefile'' in the archive,
 
252
not ``Makefile'' or ``MAKEFILE'' (and similarly for wildcard specifications).
 
253
Since this does not correspond to the behavior of many other
 
254
operating/file systems (for example, OS/2 HPFS, which preserves
 
255
mixed case but is not sensitive to it), the \fB\-C\fP option may be
 
256
used to force all filename matches to be case-insensitive.  In the
 
257
example above, all three files would then match ``\fCmakefile\fR''
 
258
(or ``\fCmake*\fR'', or similar).  The \fB\-C\fP option affects
 
259
file specs in both the normal file list and the excluded-file list (xlist).
 
260
.IP
 
261
Please note that the \fB\-L\fP option does neither affect the search for
 
262
the zipfile(s) nor the matching of archive entries to existing files on
 
263
the extraction path.  On a case-sensitive file system, \fIunzip\fP will
 
264
never try to overwrite a file ``FOO'' when extracting an entry ``foo''!
248
265
.TP
249
266
.B \-E
250
267
[MacOS only] display contents of MacOS extra field during restore operation.
277
294
[MacOS only] ignore MacOS extra fields.  All Macintosh specific info
278
295
is skipped. Data-fork and resource-fork are restored as separate files.
279
296
.TP
 
297
.B \-K
 
298
[AtheOS, BeOS, Unix only] retain SUID/SGID/Tacky file attributes.  Without
 
299
this flag, these attribute bits are cleared for security reasons.
 
300
.TP
280
301
.B \-L
281
302
convert to lowercase any filename originating on an uppercase-only operating
282
303
system or file system.  (This was \fIunzip\fP's default behavior in releases
314
335
.TP
315
336
.B \-N
316
337
[Amiga] extract file comments as Amiga filenotes.  File comments are created
317
 
with the \-c option of \fIzip\fP(1L), or with the \-N option of the Amiga port
318
 
of \fIzip\fP(1L), which stores filenotes as comments.
 
338
with the \-c option of \fIzip\fP(1), or with the \-N option of the Amiga port
 
339
of \fIzip\fP(1), which stores filenotes as comments.
319
340
.TP
320
341
.B \-o
321
342
overwrite existing files without prompting.  This is a dangerous option, so
358
379
file systems that limit filenames to particularly short lengths, the version
359
380
numbers may be truncated or stripped regardless of this option.)
360
381
.TP
 
382
.B \-W
 
383
[only when WILD_STOP_AT_DIR compile-time option enabled]
 
384
modifies the pattern matching routine so that both `?' (single-char wildcard)
 
385
and `*' (multi-char wildcard) do not match the directory separator character
 
386
`/'.  (The two-character sequence ``**'' acts as a multi-char wildcard that
 
387
includes the directory separator in its matched characters.)  Examples:
 
388
.PP
 
389
.EX
 
390
    "*.c" matches "foo.c" but not "mydir/foo.c"
 
391
    "**.c" matches both "foo.c" and "mydir/foo.c"
 
392
    "*/*.c" matches "bar/foo.c" but not "baz/bar/foo.c"
 
393
    "??*/*" matches "ab/foo" and "abc/foo"
 
394
            but not "a/foo" or "a/b/foo"
 
395
.EE
 
396
.IP
 
397
This modified behaviour is equivalent to the pattern matching style
 
398
used by the shells of some of UnZip's supported target OSs (one
 
399
example is Acorn RISC OS).  This option may not be available on systems
 
400
where the Zip archive's internal directory separator character `/' is
 
401
allowed as regular character in native operating system filenames.
 
402
(Currently, UnZip uses the same pattern matching rules for both wildcard
 
403
zipfile specifications and zip entry selection patterns in most ports.
 
404
For systems allowing `/' as regular filename character, the -W option
 
405
would not work as expected on a wildcard zipfile specification.)
 
406
.TP
361
407
.B \-X
362
408
[VMS, Unix, OS/2, NT] restore owner/protection info (UICs) under VMS, or user
363
409
and group info (UID/GID) under Unix, or access control lists (ACLs) under
400
446
root directory (``/'').  To achieve this, it is necessary to set the
401
447
extraction target folder to root (e.g. \fB\-d / \fP).  However, when the
402
448
\fB\-:\fP option is specified, it is still possible to implicitly write to
403
 
the root directory by specifiying enough ``../'' path components within the
404
 
zip file.
 
449
the root directory by specifying enough ``../'' path components within the
 
450
zip archive.
405
451
Use this option with extreme caution.
406
 
 
407
452
.PD
408
453
.\" =========================================================================
409
454
.SH "ENVIRONMENT OPTIONS"
457
502
As suggested by the examples above, the default variable names are UNZIP_OPTS
458
503
for VMS (where the symbol used to install \fIunzip\fP as a foreign command
459
504
would otherwise be confused with the environment variable), and UNZIP
460
 
for all other operating systems.  For compatibility with \fIzip\fP(1L),
 
505
for all other operating systems.  For compatibility with \fIzip\fP(1),
461
506
UNZIPOPT is also accepted (don't ask).  If both UNZIP and UNZIPOPT
462
507
are defined, however, UNZIP takes precedence.  \fIunzip\fP's diagnostic
463
508
option (\fB\-v\fP with no zipfile name) can be used to check the values
466
511
The timezone variable (TZ) should be set according to the local timezone
467
512
in order for the \fB\-f\fP and \fB\-u\fP to operate correctly.  See the
468
513
description of \fB\-f\fP above for details.  This variable may also be
469
 
necessary in order for timestamps on extracted files to be set correctly.
470
 
Under Windows 95/NT \fIunzip\fP should know the correct timezone even if
471
 
TZ is unset, assuming the timezone is correctly set in the Control Panel.
 
514
necessary to get timestamps of extracted files to be set correctly.
 
515
The WIN32 (Win9x/ME/NT4/2K/XP/2K3) port of \fIunzip\fP gets the timezone
 
516
configuration from the registry, assuming it is correctly set in the
 
517
Control Panel.  The TZ variable is ignored for this port.
472
518
.PD
473
519
.\" =========================================================================
474
520
.SH DECRYPTION
506
552
a password is not known, entering a null password (that is, just a carriage
507
553
return or ``Enter'') is taken as a signal to skip all further prompting.
508
554
Only unencrypted files in the archive(s) will thereafter be extracted.  (In
509
 
fact, that's not quite true; older versions of \fIzip\fP(1L) and
510
 
\fIzipcloak\fP(1L) allowed null passwords, so \fIunzip\fP checks each encrypted
 
555
fact, that's not quite true; older versions of \fIzip\fP(1) and
 
556
\fIzipcloak\fP(1) allowed null passwords, so \fIunzip\fP checks each encrypted
511
557
file to see if the null password works.  This may result in ``false positives''
512
558
and extraction errors, as noted above.)
513
559
.PP
790
836
.PD
791
837
.\" =========================================================================
792
838
.SH "SEE ALSO"
793
 
\fIfunzip\fP(1L), \fIzip\fP(1L), \fIzipcloak\fP(1L), \fIzipgrep\fP(1L),
794
 
\fIzipinfo\fP(1L), \fIzipnote\fP(1L), \fIzipsplit\fP(1L)
 
839
\fIfunzip\fP(1), \fIzip\fP(1), \fIzipcloak\fP(1), \fIzipgrep\fP(1),
 
840
\fIzipinfo\fP(1), \fIzipnote\fP(1), \fIzipsplit\fP(1)
795
841
.PD
796
842
.\" =========================================================================
797
843
.SH URL
807
853
.\" =========================================================================
808
854
.SH AUTHORS
809
855
The primary Info-ZIP authors (current semi-active members of the Zip-Bugs
810
 
workgroup) are:  Onno van der Linden (Zip);
811
 
Christian Spieler (UnZip maintenance coordination, VMS, MS-DOS, Win32,
812
 
shared code, general Zip and UnZip integration and optimization);
813
 
Mike White (Windows GUI, Windows DLLs); Kai Uwe Rommel (OS/2);
814
 
Paul Kienitz (Amiga, Win32); Chris Herborth (BeOS, QNX, Atari);
815
 
Jonathan Hudson (SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald
816
 
Denker (Atari, MVS); John Bush (Solaris, Amiga); Hunter Goatley (VMS); Steve
817
 
Salisbury (Win32); Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS,
818
 
Win32); and Dave Smith (Tandem NSK).
 
856
workgroup) are:  Ed Gordon (Zip, general maintenance, shared code, Zip64,
 
857
Win32, Unix); Christian Spieler (UnZip maintenance coordination, VMS, MS-DOS,
 
858
Win32, shared code, general Zip and UnZip integration and optimization);
 
859
Onno van der Linden (Zip); Mike White (Win32, Windows GUI, Windows DLLs);
 
860
Kai Uwe Rommel (OS/2, Win32); Steven M. Schweda (VMS, support of new features);
 
861
Paul Kienitz (Amiga, Win32); Chris Herborth (BeOS, QNX, Atari); Jonathan Hudson
 
862
(SMS/QDOS); Sergio Monesi (Acorn RISC OS); Harald Denker (Atari, MVS);
 
863
John Bush (Solaris, Amiga); Hunter Goatley (VMS, Info-ZIP Site maintenance);
 
864
Steve Salisbury (Win32); Steve Miller (Windows CE GUI), Johnny Lee (MS-DOS,
 
865
Win32, Zip64); and Dave Smith (Tandem NSK).
819
866
.PP
820
867
The following people were former members of the Info-ZIP development group
821
868
and provided major contributions to key parts of the current code:
878
925
Info-ZIP (Zip-Bugs subgroup, SPC)
879
926
.IP "v5.51\t22 May 04"
880
927
Info-ZIP (Zip-Bugs subgroup, SPC)
 
928
.IP "v5.52\t28 Feb 05"
 
929
Info-ZIP (Zip-Bugs subgroup, SPC)
881
930
.PD