Commit 10c52d2
Plamen Totev
Fix file mode handling for zip entries with non-Unix platform
Let's say you have a zip archive created under windows or with tool
that does not support unix files modes.
org.apache.commons.compress.archivers.zip.ZipArchiveEntry::getUnixMode
will return 0 for any entry that does not have platform set to Unix.
On the other hand ZipResource::getAttributes does not check for this
case and will return 0 (this is valid Unix mode).
As a result if you add zip archive using
AbstractArchiver::addArchivedFileSet the resulting archive
will have entries with file mode set to 0. That's quite bad because
when unpacked on some Unix platforms the files will be
accessible only by the root user.
Instead ZipResource::getAttributes should return -1 so the rest of
plexus-archiver code could handle the case properly and distinguish it
from the 0 file mode.
Add check in the ZipResource::getAttributes to properly handle
non-Unix platform entries.1 parent fc80ceb commit 10c52d2
File tree
3 files changed
+33
-7
lines changed- src
- main/java/org/codehaus/plexus/archiver/zip
- test
- java/org/codehaus/plexus/archiver/zip
- resources/zeroFileMode
3 files changed
+33
-7
lines changedLines changed: 8 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
7 | 9 | | |
| 10 | + | |
8 | 11 | | |
9 | 12 | | |
| 13 | + | |
10 | 14 | | |
11 | 15 | | |
12 | 16 | | |
| |||
33 | 37 | | |
34 | 38 | | |
35 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
36 | 61 | | |
Binary file not shown.
0 commit comments