[ostree/wip/ostbuild-v2: 5/10] ostbuild: Fix DB saving with /tmp and builddir in different volumes
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree/wip/ostbuild-v2: 5/10] ostbuild: Fix DB saving with /tmp and builddir in different volumes
- Date: Wed, 2 May 2012 00:53:02 +0000 (UTC)
commit 67ab6f9372935f85af58d33bba687826ff7e1b61
Author: Adrian Perez <aperez igalia com>
Date: Thu Apr 26 18:21:27 2012 +0300
ostbuild: Fix DB saving with /tmp and builddir in different volumes
This fixes the case where /tmp resides in one volume, and the build
directory in a different one: by storing the temporary file in the
same directory as the target one, we avoid the case in which os.rename()
would cross file system boundaries.
Reviewed-by: Colin Walters <walters verbum org>
src/ostbuild/pyostbuild/jsondb.py | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/ostbuild/pyostbuild/jsondb.py b/src/ostbuild/pyostbuild/jsondb.py
index aecee35..6d7906e 100644
--- a/src/ostbuild/pyostbuild/jsondb.py
+++ b/src/ostbuild/pyostbuild/jsondb.py
@@ -79,7 +79,8 @@ class JsonDB(object):
current_time = time.gmtime()
- (fd, tmppath) = tempfile.mkstemp(suffix='.tmp', prefix='tmp-jsondb-')
+ (fd, tmppath) = tempfile.mkstemp(suffix='.tmp',
+ prefix='tmp-jsondb-', dir=self._dirpath)
os.close(fd)
f = open(tmppath, 'w')
json.dump(obj, f, indent=4, sort_keys=True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]