members that
> have absolute filenames starting with "/" or filenames with two dots
> "..".
>
> My program has to extract tar archives from untrusted sources :-}
Read the discussion in this issue on why this might be a bad idea:
http://bugs.python.org/issue21109
-
On Fri, Feb 12, 2016 at 09:35:40AM +0100, Antoon Pardon wrote:
> On 02/11/2016 06:27 PM, Lars Gustäbel wrote:
> > What about using an iterator?
> >
> > def myiter(tar):
> > for t in tar:
> > print "extracting", t.name
> >
ting", t.name
yield t
sfo = sock.makefile('r')
taro = tarfile.open(fileobj=sfo,mode='r|')
taro.extractall(members=myiter(taro),path=edir)
Cheers,
--
Lars Gustäbel
l...@gustaebel.de
--
https://mail.python.org/mailman/listinfo/python-list
ython 4000 rolls out.
>
> That's just step one people, we have a long way to go!
archive.py is no new idea. Unfortunately, to this day, nobody had the time to
come up with an implementation.
Let me say it again: less false pathos, more code. Please.
--
Lars Gustäbel
l...@gustaebel.de
To a man with a hammer, everything looks like a nail.
(Mark Twain)
--
http://mail.python.org/mailman/listinfo/python-list
o odd things myself from time
to time, I think the stdlib as a whole is great, usable and powerful.
The stdlib surely needs our attention. Instead of answering your post, I should
have been writing code and fixing bugs ...
--
Lars Gustäbel
l...@gustaebel.de
Seek simplicity, and distrust it.
(Alfred North Whitehead)
--
http://mail.python.org/mailman/listinfo/python-list
, "w:gz")
for filename in filenames:
tarinfo = tar.gettarinfo(filename)
fobj = FileProxy(open(filename, "rb"), callback)
tar.addfile(tarinfo, fobj)
fobj.close()
I hope this helps.
Regards,
--
Lars Gustäbel
l...@gustaebel.de
The power of accurate observation
On Fri, Feb 26, 2010 at 09:28:04AM +0100, Baptiste Lepilleur wrote:
> 2010/2/24 Lars Gustäbel
>
> > On Wed, Feb 24, 2010 at 09:37:19AM +0100, Baptiste Lepilleur wrote:
> > > I stumbled uppon this and find it somewhat odd: some class methods of
> > > TarFile and Ta
On Wed, Feb 24, 2010 at 04:29:18PM -0500, Terry Reedy wrote:
> On 2/24/2010 5:14 AM, Lars Gustäbel wrote:
>> On Wed, Feb 24, 2010 at 09:37:19AM +0100, Baptiste Lepilleur wrote:
>>> I stumbled uppon this and find it somewhat odd: some class methods of
>>> TarFile an
en()
method is the one that is publicly documented and supposed to be used. It
decides which of the three methods to use based on the mode argument and
does many more other high-level things as well.
Regards,
--
Lars Gustäbel
l...@gustaebel.de
I do not care to belong to a club that
acce
.PIPE, stdout=fobj)
tar = tarfile.open(fileobj=proc.stdin, mode="w|")
tar.add(...)
tar.close()
proc.stdin.close()
fobj.close()
Cheers,
--
Lars Gustäbel
l...@gustaebel.de
A physicist is an atom's way of knowing about atoms.
(George Wald)
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Jul 17, 2008 at 11:41:50PM -0700, Uwe Schmitt wrote:
> On 17 Jul., 22:21, Lars Gustäbel <[EMAIL PROTECTED]> wrote:
> >
> > > Maybe we should post this issue to python-dev mailing list.
> > > Parsing large tar-files is not uncommon.
> >
> > Thi
s a dirty hack !
> >
> > Thanks, Uwe. That works fine for me. It now reads through all 2.5
> > million members, in about 30 minutes, never going above a 4M working
> > set.
>
> Maybe we should post this issue to python-dev mailing list.
> Parsing large tar-
tarinfo.size attribute. You could let your program write its
data to a StringIO object and pass that object to addfile().
http://docs.python.org/lib/tarfile-objects.html
--
Lars Gustäbel
[EMAIL PROTECTED]
Linux is like a wigwam - no Gates, no Windows, Apache inside.
--
http://mail.python.org/
you from getting false
positives with reused pids.
The IMO better way is to use the subprocess module that comes
with Python 2.4. How to replace os.spawn* calls is described
here: http://www.python.org/doc/2.4.2/lib/node244.html
--
Lars Gustäbel
[EMAIL PROTECTED]
To a man with a hammer, ev
[Fredrik Lundh]
> han har försökt, men hans tourette tog överhanden:
IMHO it's more likely an Asperger's syndrome.
http://en.wikipedia.org/wiki/Asperger_Syndrome
--
Lars Gustäbel
[EMAIL PROTECTED]
Any sufficiently advanced technology is indistinguishable
from magic.
(Art
[Xah Lee]
> Apache by default uses the following format for date:
> 30/Aug/2005
>
> is there a module that turn this directly into mmdd?
Use time.strptime() and time.strftime().
Not a single occurrence of the f**k word. You're making progress. Keep it up!
--
Lars Gustäbel
t; stream mode:
tar_archive = tarfile.open(mode="r|bz2", fileobj=StringIO.StringIO(attach))
for tarinfo in tar_archive:
print tarinfo.name
print tar_archive.extractfile(tarinfo).read()
tar_archive.close()
--
Lars Gustäbel
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, 02 Jun 2005 19:52:24 +0200, N. Volbers wrote:
> Thanks for taking care of it ;-)
I submitted patch #1230446 today which ought to fix the problem.
--
Lars Gustäbel
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-list
18 matches
Mail list logo