Commit Graph

25 Commits

Author SHA1 Message Date
Yoshihiro Takahashi
a1f28ec729 unzip: Document optional member list
Submitted by:	Pat Maddox (man page)
PR:		267426
MFC after:	2 weeks
2023-01-02 13:17:27 +09:00
Yoshihiro Takahashi
2c614481fd unzip: Fix segmentation fault if a zip file contains buggy filename.
PR:             259011
Reported by:    Robert Morris
Submitted by:   ak
MFC after::     1 week
2021-10-10 20:49:19 +09:00
Yoshihiro Takahashi
a4724ff481 unzip: sync with NetBSD upstream to add passphrase support
- Add support for password protected zip archives.
  We use memset_s() rather than explicit_bzero() for more portable
  (See PR).
- Use success/failure macro in exit()
- Mention ZIPX format in unzip(1)

Submitted by:	Mingye Wang and Alex Kozlov (ak@)
PR:		244181
Reviewed by:	mizhka
Obtained from:	NetBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28892
2021-09-26 01:32:42 +09:00
Yoshihiro Takahashi
0cdfa49564 unzip: Sync with NetBSD upstream.
- Ignore malformed directory entries as created by Dropbox ("/").
  (rev 1.24)
- Use libarchive 3.x interface: check result for archive_read_free()
  and don't call archive_read_close manually. (rev 1.23)
- Always overwrite symlinks on extraction, ever if they're newer than
  entries in archive.
- Use getline() rather than getdelim().

PR:		231827
Submitted by:	ak
Reviewed by:	mm
Obtained from:	NetBSD
MFC after:	2 weeks
2021-01-02 10:50:08 +09:00
Pedro F. Giffuni
1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Alex Kozlov
b5acc1891f - Match directory extraction message with Infozip [1]
- Add comment explaining masks in check_binary()

Obtained from:	NetBSD [1]
Approved by:	des
2016-01-15 23:04:36 +00:00
Alex Kozlov
b2a265d3cd - Extract common code from extract()/extract_stdout() to extract2fd()
- Update information about central directory handling

Obtained from:	NetBSD
Approved by:	des
2016-01-15 22:58:23 +00:00
Alex Kozlov
46021e0128 - Properly set mode and atime/ctime for symlinks
Approved by:	des
2015-12-13 21:31:45 +00:00
Alex Kozlov
04e17b6a6d - Allow to extract symlinks
- Implement 4-digit year format listing (-y option)
- Improve detection of text files
- Use %ju for error_count as it is unsigned

Obtained from:	NetBSD
Approved by:	des
2015-12-11 23:52:08 +00:00
Alex Kozlov
2aa7d573a0 - Remove stray whitespaces
Approved by:	des
2015-12-11 23:46:33 +00:00
Jilles Tjoelker
7a970ca937 unzip: Don't subvert vfs.timestamp_precision when setting atime to now.
Also, preserve nanoseconds from libarchive, even though the zip file format
does not currently support nanoseconds in timestamps.
2015-03-15 21:29:20 +00:00
Martin Matuska
ebb8fc42be Replace deprecated (or remove obsolete) libarchive 2.8 functions
with libarchive 3.0 counterparts
2013-03-22 10:17:42 +00:00
Dag-Erling Smørgrav
5fca4d10aa Pass a filename, rather than a file descriptor, to libarchive.
Submitted by:	Alex Kozlov <spam@rm-rf.kiev.ua>
MFC after:	1 week
2012-05-29 09:11:19 +00:00
Dag-Erling Smørgrav
3664268885 Correct my name in the copyright statement. 2012-04-15 13:39:39 +00:00
Kevin Lo
308633f39e Partially implement zipinfo (-Z) support.
This fixes some test failures seen with perl 5.12 and 5.14.

PR:	bin/166895
Submitted by:	swills
MFC after:	3 days
2012-04-13 06:15:51 +00:00
Kevin Lo
a3a2bf4b67 fgets(3) returns a pointer, so compare against NULL, not integer 0. 2012-01-13 06:51:15 +00:00
Ulrich Spörlein
fb2ad9d3a4 Reencode files from latin1 to UTF-8.
This makes a tiny percentage of entries in calendars ugly for latin1
users, but fixes them for UTF-8 users.

This badly needs a solution involving locale-dependent re-encoding.
2011-12-30 10:59:15 +00:00
Gleb Smirnoff
85080d2d68 Make it possible to read input from stdin.
Without this change I don't see a way to
unpack a multivolume archive without wasting
disk space for a temporary file.
2010-10-21 17:05:15 +00:00
Xin LI
d994242647 Check return value from archive_read_new().
Found with:	Coverity Prevent(tm)
CID:		8462
Reviewed by:	des
MFC after:	1 week
2010-06-09 18:59:07 +00:00
Gavin Atkinson
cf4bd0f272 Implement the rename query, for when a file with the same name as the one
about to be extracted already exists.  The question, and interpretation
of the response is deliberately compatible with Info-Zip.

This change was originally obtained from NetBSD, but has three changes:
 - better compatibility with Info-Zip in the handling of ^D
 - Use getdelim() rather than getline()
 - bug fix: != changed to == in the "file rename" code

I suspect the latter is also a bug in NetBSD, but I can't easily confirm
this.

PR:		bin/143307
Reviewed by:	rdivacky (change to unzip.c only)
Obtained from:	NetBSD src/usr.bin/unzip/unzip.c 1.8
MFC after:	1 month
2010-02-16 22:53:18 +00:00
Tim Kientzle
12255fe0d9 When restoring files, use the mode for the mode.
Thanks to: Jun Kuriyama for pointing this out
2010-01-06 06:35:10 +00:00
Jaakko Heinonen
a49365ac09 Don't print the archive name with -p and -q options.
PR:		bin/141280
Approved by:	des, trasz (mentor)
2009-12-22 15:13:16 +00:00
Roman Divacky
d77fa17750 Add C/c/f/p/v switches plus a bunch of minor fixes and cleanups.
Obtained from:	NetBSD
Approved by:	des (maintainer)
Approved by:	ed (mentor, implicit)
2009-09-08 15:55:13 +00:00
Dag-Erling Smørgrav
ec7bd62201 Quick shot at implementing -t (test).
Requested by:	ache
MFC after:	2 weeks
2008-06-30 17:11:27 +00:00
Dag-Erling Smørgrav
497a8b25b5 Welcome unzip(1), a pure BSD drop-in replacement for ports/unzip. In its
current state, it can handle all but four of the 991 zip files (including
jar files) I was able to identify in the ports tree.  The remaining four
are two self-extracting archives and two which have garbage preceding the
first local header.  This limitation is a feature of libarchive(3) which
I am currently working to resolve.

The code is unnecessarily large due to the need to emulate the exact
command-line syntax and behaviour of ports/unzip.  My initial incompatible
implementation was one quarter the size of the one I am committing here.
2008-01-08 08:00:06 +00:00