On 1/22/2010 2:44 PM, Tarek Ziadé wrote:
On Fri, Jan 22, 2010 at 11:17 PM, Sridhar Ratnakumar
<sridh...@activestate.com> wrote:
[..]
> 3) Patch Lib/tarfile.py to fix issue6196
>
> I am hoping that (1) and (2) will get accepted. But not (3) - in which case,
> should this go as a workarond (_ensure_read_write_access in
> http://gist.github.com/279606) in the new, say, shutil.extract function?
I agree with Lars conclusions on this issue, I don't think this
permission feature fits the sdtlib because its a very specific use
case.
Do you think anyone would want to use `shutil.unpack_archive` but
*retain* the u-x,u-r permissions? I presume that one would - in most
cases - want to *process* the unpacked archive .. especially when doing
all this by writing a script.
To give an example, what if when Distribute uses `shutil.unpack_archive`
to unpack a sdist from PyPI (the author generated the archive with
u-r,u-x set on files/directoreis -- I've seen this happening before),
the subsequent "python setup.py install" would fail due to permission issue?
Now, for shutil.unpack_archive, we could add a callable option (like
the progress_filter one)
that would be called with each newly extracted file, so one may apply
any process on it.
How about having an extra argument that would fix the permission?
(Fixing the permission is only applicable for tarfile, not zipfile,
hence even our callable will become specific to tarfile).
>>> shutil.unpack_archive("/tmp/foo.tgz", "/tmp", make_readable=True)
>>> help(shutil.unpack_archive)
[...]
If `make_readable` is True, then files with limited permission (cannot
be read) will be fixed to make them readable by the current user.
-srid
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com