duplicity-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Duplicity-tracker] [patch #6299] re-design tempfile handling


From: Peter Schuller
Subject: [Duplicity-tracker] [patch #6299] re-design tempfile handling
Date: Sat, 01 Dec 2007 20:51:36 +0000
User-agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.8.1.8) Gecko/20071030 Firefox/2.0.0.8

URL:
  <http://savannah.nongnu.org/patch/?6299>

                 Summary: re-design tempfile handling
                 Project: duplicity
            Submitted by: scode
            Submitted on: Saturday 12/01/2007 at 20:51
                Category: None
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Relates to bug 21686.

The attached patch re-designs tempfile handling slightly. It does not touch
the file object wrappers and otherwise eliminate the use of mktemp()
semantics, but it does provide a more general backend for tempfile creation
than plain tempfile.mktemp() and tempfile.mkstemp(), and in doing so
eliminates some of the tempfile handling in dup_temp.py.

tempdir.py contains a TemporaryDirectory class (with a single default
instance immediately accessible as tempdir.default()) which provides a
securely created environment (directory) for tempfile creation. Details are in
the class documentation.

Uses of mktemp/mkstemp have been changed to use their tempdir.default().*
counterpart, and the on-delete hooks in dup_temp have been changed to use
tempdir.default().forget() instead.

An atexit handler has been replaced by make-and-forget semantics, relying on
the top-level cleanup done by calling tempdir.default().cleanup(). This means
cleanup will work even when the application is interrupted by signals, which
is not the case for atexit handlers.

I have successfully run backups against file://, rsync://, scp:// and ftp://
URL:s with these patches applied.

One note: I have added testing/tempdirtest.py, but I am not sure right now
how this is supposed to be successfully hooked up into unit testing. Some
caution is recommended before application, in case unit testing has been
broken.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Saturday 12/01/2007 at 20:51  Name: duplicity_tempredesign.patch  Size:
14kB   By: scode

<http://savannah.nongnu.org/patch/download.php?file_id=14530>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?6299>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]