Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #104057

Re: creating zipfile with symlinks

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Larry Martell <larry.martell@gmail.com>
Newsgroups comp.lang.python
Subject Re: creating zipfile with symlinks
Date Fri, 4 Mar 2016 17:09:59 -0500
Lines 67
Message-ID <mailman.199.1457129443.20602.python-list@python.org> (permalink)
References <CACwCsY5CFNVnTw=xpPJXXmYEH6Qb70yA+-XoJ+waFUdKDd6a8w@mail.gmail.com> <CACwCsY6CjDhQn6stT=HgWUT1cePYeYKX44i_K00dBstNhOJBEA@mail.gmail.com> <CACwCsY7KdZDE0qyGwjTa+Vg=f3CtpkGd777mZa+E17kOiDRUmA@mail.gmail.com> <201603040922.03991.gheskett@wdtv.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de pdXy/rudKM5pxcFURS6eGQ/NThTzdVTAkIra9/OoVyKg==
Return-Path <larry.martell@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'broken': 0.03; 'received:209.85.223': 0.03; '---------': 0.05; 'mrab': 0.05; 'thats': 0.07; '-------': 0.09; '7pm': 0.09; 'compression': 0.09; 'filename,': 0.09; 'symlink': 0.09; 'python': 0.10; 'thu,': 0.15; '"zip': 0.16; '(there': 0.16; '08:45': 0.16; '2016': 0.16; 'magic': 0.16; 'magic.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'skip:> 20': 0.16; 'truely': 0.16; 'zipfile': 0.16; 'wrote:': 0.16; 'obviously': 0.16; 'archive': 0.18; 'thanks.': 0.18; '>>>': 0.20; 'handles': 0.20; 'to:name :python-list@python.org': 0.20; 'do.': 0.22; 'file.': 0.22; 'am,': 0.23; 'bit': 0.23; 'wrote': 0.23; 'minutes.': 0.23; 'this:': 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'feature': 0.24; 'module': 0.25; '----------': 0.25; "doesn't": 0.26; 'command': 0.26; 'chris': 0.26; 'external': 0.27; '----': 0.27; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'data,': 0.27; 'module.': 0.27; "skip:' 10": 0.28; 'fine': 0.28; 'regular': 0.29; '(it': 0.29; 'dictionary': 0.29; 'larry': 0.29; '-----': 0.29; "i'm": 0.30; 'system,': 0.30; 'that.': 0.30; 'checked': 0.31; 'seconds': 0.31; 'know.': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'dir': 0.35; 'set.': 0.35; 'but': 0.36; 'too': 0.36; 'received:209.85': 0.36; 'possible': 0.36; 'faster': 0.36; 'mode': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'version': 0.38; 'received:209': 0.38; 'drop': 0.38; 'files': 0.38; 'sure': 0.39; 'does': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.40; 'subject:with': 0.40; 'still': 0.40; 'called': 0.40; 'some': 0.40; 'care': 0.60; 'skip:u 10': 0.61; 'total': 0.62; 'is.': 0.63; 'minutes': 0.64; 'within': 0.64; 'march': 0.64; 'mar': 0.65; 'carefully': 0.72; 'special': 0.73; '10:32': 0.84; 'coffee': 0.84; 'different.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=qbyIxJRYuClEWI5QvLPO7ayKlYkPTtO6hhB9U8wqHEs=; b=lF5d0X0wtFVI0WruFEZCF43vahrPOzKEzNNQ8RpsNFRRnIgFB0oBnui5dLiddD3QXW wPmfVZrLwY4L9aRB+L6ldbogXUDoI9MejOnIydSx7ojml21yPpk8Sqa8kAqHzjx0m/v9 5iqk/drnRH8g/wAT5ULlTV5hCootifwh7Pdu6AVHCh1jWrAGD5+7hzdvMsb8MX129AX0 fVc8QiNt42DdEPwkCqv5I9vuZXOkURJhwa6NB835IW73cPaqye0QndlSROSYUEZzWS9h nFGvlH8ii4sgoaA/fXwgOMq+XI6gOO1jxPsjydz2VPClo6ZRuBIm3ksDGkTnpJVMsmUO Q+uw==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=qbyIxJRYuClEWI5QvLPO7ayKlYkPTtO6hhB9U8wqHEs=; b=gp26Ofc1ehkXC8VraGOUDPOBOPiLoZa+RIxWR33jiQKVQLV+GgNPVXOcNuidztoZxB cMeszcA2TOLqCVJy4hVVxxTYRbq3+Yc8WYOsYF5OXXHVwdsqxAEOi11w8us6mTXGA5qD dxVczkv0E9/yMVXij3eRl8VDDw0+09d6sM1Z8wLhGPCLUw+wbaAi0p6K3862KeH/LsHI aXNaaKg6z0gOWq0bZPDZ5ycvqUVbn3k5jZOF2YpxkbO9aox24wJ94vybg/DVmKq7Z2sp g/cxgda79RahhTzI6pP2+0O/zMJ+a0cq1LqGH8pojIIl0hJg8rrFmQIRxdS3IAnnQc8l AinA==
X-Gm-Message-State AD7BkJJM3sWFBECxtwePsw4QsHgTSKqT23j4zfJVYy0ftgl66xcAjZ3KHabycEAwPGvRIi50iSHgUJqcPtujng==
X-Received by 10.107.38.78 with SMTP id m75mr10638282iom.15.1457129439909; Fri, 04 Mar 2016 14:10:39 -0800 (PST)
In-Reply-To <201603040922.03991.gheskett@wdtv.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:104057

Show key headers only | View raw


On Fri, Mar 4, 2016 at 9:22 AM, Gene Heskett <gheskett@wdtv.com> wrote:
> On Friday 04 March 2016 07:18:57 Larry Martell wrote:
>
>> On Thu, Mar 3, 2016 at 10:32 PM, Larry Martell
> <larry.martell@gmail.com> wrote:
>> > 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.
>>
>> Unfortunately very slow - around 8 minutes to zip a 7GB dir using the
>> command line zip vs. 13 seconds with the python zipfile module.
>
> Obviously the python version is not doing very much, or has enough python
> magic in it to be truely called magic. In any case Larry, the operative
> phrase for any of the various compression methods is TANSTAAFL.
>
> To generate a compressed archive of 7GB of data, is going to take time,
> and I don't care what size that compressors dictionary block is. 13
> seconds is simply not a believeable figure.
>
> I also note carefully that no one has allowed as to what exactly this
> python version does do.  Thats scary...

I clearly did not have enough coffee when I wrote that (it was 7am -
if I had written it at 7pm I would have said I clearly had had too
much gin ;-).

Anyway, I checked again and it was 2 minutes. But still much faster
then the command line zip.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: creating zipfile with symlinks Larry Martell <larry.martell@gmail.com> - 2016-03-04 17:09 -0500

csiph-web