Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #104012
| From | Larry Martell <larry.martell@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: creating zipfile with symlinks |
| Date | 2016-03-03 22:32 -0500 |
| Message-ID | <mailman.178.1457062425.20602.python-list@python.org> (permalink) |
| References | <CACwCsY5CFNVnTw=xpPJXXmYEH6Qb70yA+-XoJ+waFUdKDd6a8w@mail.gmail.com> <CACwCsY6cBfO4Wf1SebirMkKVCtm_KaK3vF9OPOfeDF5povscuQ@mail.gmail.com> <56D8AEBB.6060102@mrabarnett.plus.com> <CAPTjJmrDGfTMDdNGH1MWf6dnx--7A+nFHWpYLMp0+pdYmYE_kw@mail.gmail.com> |
On Thu, Mar 3, 2016 at 4:58 PM, Chris Angelico <rosuav@gmail.com> wrote: > On Fri, Mar 4, 2016 at 8:38 AM, MRAB <python@mrabarnett.plus.com> wrote: >> Is it even possible to zip a link? >> >> A quick search came up with this: >> >> Are hard links possible within a zip archive? >> http://stackoverflow.com/questions/8859616/are-hard-links-possible-within-a-zip-archive > > Hard links are different. Symlinks are files containing the target > filename, with a special mode bit set. I'm not sure if it's a standard > feature of all zip archivers, but on my Debian system, I can use "zip > --symlinks" to create such a zip. How that will unzip on a system that > doesn't understand symlinks, I don't know. > > rosuav@sikorsky:~/tmp$ ls -l > total 4 > -rw-r--r-- 1 rosuav rosuav 162 Mar 4 08:48 aaa.zip > lrwxrwxrwx 1 rosuav rosuav 4 Mar 4 08:49 qwer -> asdf > rosuav@sikorsky:~/tmp$ unzip -l aaa.zip > Archive: aaa.zip > Length Date Time Name > --------- ---------- ----- ---- > 4 2016-03-04 08:45 qwer > --------- ------- > 4 1 file > > > That's a broken symlink (there is no "asdf" in the directory), and zip > and unzip are both fine with that. > > Now, how the Python zipfile module handles this, I don't know. The > ZipInfo shows a file mode of 'lrwxrwxrwx', but when I call extract(), > it comes out as a regular file. You might have to do some work > manually, or else just drop to an external command with --symlinks. Thanks. That's what I ended up doing.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: creating zipfile with symlinks Larry Martell <larry.martell@gmail.com> - 2016-03-03 22:32 -0500
csiph-web