-
Bug
-
Resolution: Fixed
-
P3
-
None
-
b33
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8084355 | emb-9 | Martin Buchholz | P3 | Resolved | Fixed | team |
If you have a jar file with prepended garbage, such as a shell script or ELF file, which is a common practice, then we expect that common commands like "jar" that simply read the file will continue to work.
In fact,
jar tf
always works, but
jar xf only works if some files are specified to extract, and this difference appears to have no reason.
Although there may be performance reasons to use ZipInputStream to ZipFile, if ZipInputStream can find no entries, and the input file is seekable, "jar" should fall back to using ZipFile.
There's a curious hacky workaround for the desparate:
jar xf foo.zip ''
will have the same effect as
jar xf foo.zip
but will additionally work on zip files with prepended garbage (but this relies on implementation details - uses String.startsWith!).
In fact,
jar tf
always works, but
jar xf only works if some files are specified to extract, and this difference appears to have no reason.
Although there may be performance reasons to use ZipInputStream to ZipFile, if ZipInputStream can find no entries, and the input file is seekable, "jar" should fall back to using ZipFile.
There's a curious hacky workaround for the desparate:
jar xf foo.zip ''
will have the same effect as
jar xf foo.zip
but will additionally work on zip files with prepended garbage (but this relies on implementation details - uses String.startsWith!).
- backported by
-
JDK-8084355 jar xf does not work on zip files with leading garbage
- Resolved