Commit graph

12 commits

Author SHA1 Message Date
Elliott Hughes
008759711f unzip/zipinfo: use float percentages like the RI.
Test: my new test runner, specifically developed for ziptool
Change-Id: I1237d02daaf2939eebc4fd5ec19ccdd0de291ad5
2019-11-12 13:53:43 -08:00
Elliott Hughes
f1b255a6ad Darwin: include <libgen.h> for basename(3).
Test: treehugger
Change-Id: I11858430f13cbb22895c9dd0befb8054308efb19
2019-11-04 19:27:33 -08:00
Elliott Hughes
bcd810622b unzip: fix Mac build.
Turns out the Mac doesn't have <error.h>. Add our own "die" function
instead, and use it everywhere so the Mac isn't using an untested
codepath.

One upside to this is that we'll now call ourselves "unzip" even when
run as `ziptool unzip ...`, which was awkward to fix with <error.h> but
trivial if we're rolling our own anyway.

Test: still works on Linux
Change-Id: I9cb1922595a21cd9f6d55a70d67e30090f8b7f21
2019-11-03 08:30:33 -08:00
Elliott Hughes
d3aee6653f unzip: add -Z for "zipinfo mode".
But don't document it because it's a silly idea. Just call zipinfo
directly if you want zipinfo!

There are multiple uses of `unzip -Z` in the AOSP build, though, so we
may as well support it if people are already using it.

Test: manual
Change-Id: I04b05795badf63febe1210fbeaa96e3bd27237f1
2019-10-29 20:47:16 -07:00
Elliott Hughes
d50952587d zipinfo: support DOS attributes.
golang doesn't include Unix mode by default.

Also show all the deflate variants ("defN" versus "defX").

Cope better with being called directly rather than via symlink.

Test: manual
Change-Id: I23b441c847ce9a557ea866b3c43bdf0542b26f10
2019-10-29 07:55:16 -07:00
Elliott Hughes
2672413d91 libziparchive: add zipinfo(1).
Useful for debugging and hermetic builds. (Various places in the build
check to see that a file was stored uncompressed.)

Test: manual
Change-Id: I127e5689cd493ab06739b765beed50912dc9cc1d
2019-10-25 10:07:08 -07:00
Elliott Hughes
e06a808037 Add a std::string overload to Next.
All but one existing caller actually wants a std::string.

Bug: http://b/129068177
Test: treehugger
Change-Id: I428c4453edaae74451db56e9542e4e462f08d43a
2019-05-22 19:05:44 -07:00
Elliott Hughes
a22ac0f07e libziparchive: start moving to a non-ZipString StartIteration API.
Same issue as with FindEntry: using ZipString in the API forces all
callers to make sure they don't hit the ZipString length limits. Switch
to std::string_view and uniformly use the empty string as a way to
signal no prefix/suffix rather than nullptr.

Also use default arguments to make the common case of no prefix and no
suffix more convenient.

Also just use std::string to increase the lifetime of the provided
prefix/suffix rather than manual memory management.

Bug: http://b/129068177
Test: treehugger
Change-Id: I6675e39ce62fadd766386d77d27423013c17d6f7
2019-05-08 11:00:32 -07:00
Treehugger Robot
5664489a31 Merge "Ziparchive: Enable -Wconversion" 2019-04-19 03:33:19 +00:00
Elliott Hughes
5f8b309883 unzip: support shell globs in include/exclude lists.
Bug: http://b/113928508
Test: manual
Change-Id: Ic9b11486ce07bf3b385e0c1180c4d1bde61d1628
2019-04-08 12:46:56 -07:00
Andreas Gampe
964b95cf61 Ziparchive: Enable -Wconversion
Enable -Wconversion (but not -Wsign-conversion). Fix up code. Handle
some actual error cases:

* too many files
* files too large

Bug: 130039052
Test: atest ziparchive-tests
Change-Id: I632af317b9e65dbc728851efefd0d11a2b5c29b9
2019-04-05 13:50:48 -07:00
Elliott Hughes
55fd293dfe Add libziparchive-based unzip.
Bug: N/A
Test: new toybox unzip.test
Change-Id: I00be388578be9a0a0390a9e2ecfac664c6ab39ca
2017-06-04 11:53:48 -07:00