use borg-tmp as prefix for temporary files / directories

also: remove some unused temp dir. code
This commit is contained in:
Thomas Waldmann 2015-07-11 17:22:12 +02:00
parent 95828c576d
commit a59211f295
5 changed files with 4 additions and 10 deletions

View file

@ -2,8 +2,6 @@ from datetime import datetime
from getpass import getuser
from itertools import groupby
import errno
import shutil
import tempfile
from .key import key_factory
from .remote import cache_if_remote
import msgpack
@ -609,10 +607,6 @@ class ArchiveChecker:
def __init__(self):
self.error_found = False
self.possibly_superseded = set()
self.tmpdir = tempfile.mkdtemp()
def __del__(self):
shutil.rmtree(self.tmpdir)
def check(self, repository, repair=False, last=None):
self.report_progress('Starting archive consistency check...')

View file

@ -313,7 +313,7 @@ class Cache:
self.begin_txn()
print('Synchronizing chunks cache...')
# XXX we have to do stuff on disk due to lacking ChunkIndex api
with tempfile.TemporaryDirectory() as tmp_dir:
with tempfile.TemporaryDirectory(prefix='borg-tmp') as tmp_dir:
repository = cache_if_remote(self.repository)
out_archive = open_out_archive()
in_archive = open_in_archive()

View file

@ -17,7 +17,7 @@ have_fuse_mtime_ns = hasattr(llfuse.EntryAttributes, 'st_mtime_ns')
class ItemCache:
def __init__(self):
self.fd = tempfile.TemporaryFile()
self.fd = tempfile.TemporaryFile(prefix='borg-tmp')
self.offset = 1000000
def add(self, item):

View file

@ -305,7 +305,7 @@ class RepositoryCache:
self.cleanup()
def initialize(self):
self.tmppath = tempfile.mkdtemp()
self.tmppath = tempfile.mkdtemp(prefix='borg-tmp')
self.index = NSIndex()
self.data_fd = open(os.path.join(self.tmppath, 'data'), 'a+b')

View file

@ -11,7 +11,7 @@ from ctypes.util import find_library
def is_enabled(path=None):
"""Determine if xattr is enabled on the filesystem
"""
with tempfile.NamedTemporaryFile(dir=path) as fd:
with tempfile.NamedTemporaryFile(dir=path, prefix='borg-tmp') as fd:
try:
setxattr(fd.fileno(), 'user.name', b'value')
except OSError: