tmp directory was removed before duplicity was finished with it (lp:#922101)

[Original report](https://bugs.launchpad.net/bugs/922101) created by **sirhc (sirhc808)**
```
On Thu, Jan 26, 2012 at 8:04 AM, sirhc808@gmail.com <sirhc808@gmail.com>
wrote:
Hello - I'm new to Duplicity and I'm likely making a user error, however
I've been unable to find a path around this issue.  I've built Duplicity
0.6.17 and continue to receive the error message below when I attempt my
first full backup using the local file backend.  Perhaps the real issue is
that my backup config is invalid and is not generating a tmp file, but is
exposing a minor bug.  At any rate, the same backup with "--dry-run" does
not produce the same error.  Details below.

Any suggestions?  Thanks!

-Chris


debussy> duplicity --verbosity debug /volume1/sirhc
file:///volume2/backup/test
Using archive dir: /root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc
Using backup name: 353fa2a1d4f631ce7e04f457ad0ca9bc
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ftpsbackend Succeeded
Import of duplicity.backends.u1backend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.botobackend Failed: No module named py
Import of duplicity.backends.giobackend Failed: No module named gio
Import of duplicity.backends.cloudfilesbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.sshbackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.ftpbackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Main action: inc
================================================================================
duplicity 0.6.17 (November 25, 2011)
Args: /opt/bin/duplicity --verbosity debug /volume1/sirhc
file:///volume2/backup/test
Linux debussy 2.6.32.12 #1955 SMP Sat Nov 26 14:52:27 CST 2011 x86_64
/opt/bin/python 2.6.7 (r267:88850, Jun  8 2011, 23:10:54)
[GCC 4.2.1]
================================================================================
Using temporary directory /tmp/duplicity-Q73Bx6-tempdir
Registering (mkstemp) temporary file /tmp/duplicity-Q73Bx6-tempdir/mkstemp-
qrYQ7V-1
Temp has 520413184 available, backup will use approx 34078720.
Local and Remote metadata are synchronized, no sync needed.
0 files exist on backend
0 files exist in cache
Extracting backup chains from list of files: []
Last full backup date: none
Collection Status
-----------------
Connecting with backend: LocalBackend
Archive dir: /root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc

Found 0 secondary backup chains.
No backup chains with active signatures found
No orphaned or incomplete backup sets found.
PASSPHRASE variable not set, asking user.
GnuPG passphrase:
PASSPHRASE variable not set, asking user.
Retype passphrase to confirm:
No signatures found, switching to full backup.
Using temporary directory
/root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc/duplicity-
sA6J8t-tempdir
Registering (mktemp) temporary file
/root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc/duplicity-
sA6J8t-tempdir/mktemp-mj6VZN-1
Using temporary directory
/root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc/duplicity-2o67Sb-
tempdir
Registering (mktemp) temporary file
/root/.cache/duplicity/353fa2a1d4f631ce7e04f457ad0ca9bc/duplicity-2o67Sb-
tempdir/mktemp-QkpxIF-1
AsyncScheduler: instantiating at concurrency 0
Registering (mktemp) temporary file /tmp/duplicity-Q73Bx6-tempdir/mktemp-
bWLIa5-2
Selecting /volume1/sirhc
GPG process 16825 terminated before wait()
Comparing () and None
Getting delta of (() /volume1/sirhc dir) and None
A .
Removing still remembered temporary file
/tmp/duplicity-Q73Bx6-tempdir/mktemp-bWLIa5-2
Cleanup of temporary file /tmp/duplicity-Q73Bx6-tempdir/mktemp-bWLIa5-2
failed
Removing still remembered temporary file
/tmp/duplicity-Q73Bx6-tempdir/mkstemp-qrYQ7V-1
Cleanup of temporary file /tmp/duplicity-Q73Bx6-tempdir/mkstemp-qrYQ7V-1
failed
Cleanup of temporary directory /tmp/duplicity-Q73Bx6-tempdir failed - this
is probably a bug.
Traceback (most recent call last):
 File "/opt/bin/duplicity", line 1377, in <module>
   with_tempdir(main)
 File "/opt/bin/duplicity", line 1370, in with_tempdir
   fn()
 File "/opt/bin/duplicity", line 1345, in main
   full_backup(col_stats)
 File "/opt/bin/duplicity", line 500, in full_backup
   globals.backend)
 File "/opt/bin/duplicity", line 378, in write_multivol
   globals.gpg_profile, globals.volsize)
 File "/opt/lib/python2.6/site-packages/duplicity/gpg.py", line 316, in
GPGWriteFile
   bytes_to_go = data_size - get_current_size()
 File "/opt/lib/python2.6/site-packages/duplicity/gpg.py", line 308, in
get_current_size
   return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory:
'/tmp/duplicity-Q73Bx6-tempdir/mktemp-bWLIa5-2'

This is a bug!  The directory was removed before duplicity was finished
with it.

Please report this to https://bugs.launchpad.net/duplicity.

...Thanks,
...Ken
```

Story points: 44.0