From fb9731868f80240ea478e9cb6b58bdc22a1715da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarno=20Sepp=C3=A4nen?= Date: Tue, 29 Apr 2014 23:58:54 +0300 Subject: [PATCH] Fix write caching; implement more FUSE functions * write caching was broken in multiple ways * implemented chmod, rename, truncate, unlink, and utimens --- gpgfs.py | 107 +++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 23 deletions(-) diff --git a/gpgfs.py b/gpgfs.py index 06306e0..03feb3a 100755 --- a/gpgfs.py +++ b/gpgfs.py @@ -25,6 +25,7 @@ def decrypt(gpg, path): if not res.ok: raise IOError, "decryption failed, %s" % path data = zlib.decompress(res.data) + log.debug('decrypted %s' % path) return data def encrypt(gpg, keyid, path, data): @@ -34,6 +35,7 @@ def encrypt(gpg, keyid, path, data): raise IOError, "encryption failed, keyid %s, path %s" % (keyid, path) with file(path, 'w') as fd: fd.write(res.data) + log.debug('encrypted %s' % path) class Entry: ''' @@ -79,7 +81,7 @@ def write_dict(fd, dct): elif isinstance(val, Entry): buf.write('E') children.append(val) - elif isinstance(val, int): + elif isinstance(val, (int, long)): buf.write('I') buf.write(struct.pack('