Re: tarfile : secure extract?

2016-02-12 Thread Lars Gustäbel
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 -

Re: tarfile : read from a socket?

2016-02-12 Thread Lars Gustäbel
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 > >

Re: tarfile : read from a socket?

2016-02-11 Thread Lars Gustäbel
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

Re: Inconsistencies between zipfile and tarfile APIs

2011-07-22 Thread Lars Gustäbel
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

Re: [PyWart 1001] Inconsistencies between zipfile and tarfile APIs

2011-07-22 Thread Lars Gustäbel
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

Re: tarfile and progress information

2010-07-14 Thread Lars Gustäbel
, "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

Re: Why tarfile.TarFile.gzopen is not in the online documentation?

2010-02-26 Thread Lars Gustäbel
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

Re: Why tarfile.TarFile.gzopen is not in the online documentation?

2010-02-25 Thread Lars Gustäbel
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

Re: Why tarfile.TarFile.gzopen is not in the online documentation?

2010-02-24 Thread Lars Gustäbel
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

Re: compression level with tarfile (w:gz) ?

2009-08-10 Thread Lars Gustäbel
.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

Re: How to process a very large (4Gb) tarfile from python?

2008-07-19 Thread Lars Gustäbel
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

Re: How to process a very large (4Gb) tarfile from python?

2008-07-17 Thread Lars Gustäbel
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-

Re: Create TarFile using string buffers

2007-03-19 Thread Lars Gustäbel
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/

Re: Best way to determine if a certain PID is still running

2006-02-03 Thread Lars Gustäbel
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

Re: determine if os.system() is done

2005-09-07 Thread Lars Gustäbel
[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

Re: change date format

2005-08-31 Thread Lars Gustäbel
[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

Re: problems with tarfile.open and tar.bz2

2005-08-28 Thread 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

Re: python 2.4: tarfile tell() and seek() seem to be broeken

2005-06-30 Thread Lars Gustäbel
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