You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created one directory with a symlink to it and a regular file with a symlink to it like so:
$ mkdir tmp
$ cd tmp
$ mkdir a; ln -s a b; touch c; ln -s c d
$ cd ..
$ tree tmptmp├── a├── b -> a├── c└── d -> c
Ideally what would happen is the following:
$ zip -yr tmp.zip tmp
$ unzip tmp.zip -d newtmpArchive: tmp.zip creating: newtmp/tmp/ creating: newtmp/tmp/a/ extracting: newtmp/tmp/c linking: newtmp/tmp/d -> c linking: newtmp/tmp/b -> a finishing deferred symbolic links: newtmp/tmp/d -> c newtmp/tmp/b -> a
$ tree newtmp newtmp└── tmp ├── a ├── b -> a ├── c └── d -> c
I then attempted to use Zip4j to zip these files.
First attempt is a naive approach. Just setSymbolicLinkAction to INCLUDE_LINK_ONLY:
$ unzip test.zip -d test&& tree testArchive: test.zip creating: test/tmp/ creating: test/tmp/a/ extracting: test/tmp/c linking: test/tmp/d -> c extracting: test/tmp/b finishing deferred symbolic links: test/tmp/d -> ctest└── tmp ├── a ├── b ├── c └── d -> c2 directories, 3 files
That didn't work. The symlink b to directory a, did not stay a symlink.
Then I tried only setting INCLUDE_LINK_ONLY for paths tested to be symlinks, and manually set CompressionLevel.NO_COMPRESSION and CompressionMethod.STORE.
Thanks for the detailed analysis of the issue. It always helps to have a detailed description and a code sample to reproduce the issue. I am looking into this issue.
Toy example:
I created one directory with a symlink to it and a regular file with a symlink to it like so:
Ideally what would happen is the following:
I then attempted to use Zip4j to zip these files.
First attempt is a naive approach. Just
setSymbolicLinkAction
toINCLUDE_LINK_ONLY
:Let's see what it contains:
That didn't work. The symlink
b
to directorya
, did not stay a symlink.Then I tried only setting
INCLUDE_LINK_ONLY
for paths tested to be symlinks, and manually setCompressionLevel.NO_COMPRESSION
andCompressionMethod.STORE
.Unzipping output:
It still won't link
b
toa
!The text was updated successfully, but these errors were encountered: