: permit other users to access the filesystem. Necessary for
exporting the filesystem via Samba, for example.
+\--meta
+: report some of the original metadata (when available) for the
+ mounted paths (currently the uid, gid, mode, and timestamps).
+ Without this, only generic values will be presented. This option
+ is not yet enabled by default because it may negatively affect
+ performance, and note that any timestamps before 1970-01-01 UTC
+ (i.e. before the Unix epoch) will be presented as 1970-01-01 UTC.
+
# EXAMPLES
rm -rf /tmp/buptest
mkdir /tmp/buptest
#!/usr/bin/env python
import sys, os, errno
-from bup import options, git, vfs
+from bup import options, git, vfs, xstat
from bup.helpers import *
try:
import fuse
class BupFs(fuse.Fuse):
- def __init__(self, top):
+ def __init__(self, top, meta=False):
fuse.Fuse.__init__(self)
self.top = top
+ self.meta = meta
def getattr(self, path):
log('--getattr(%r)\n' % path)
st = Stat()
st.st_mode = node.mode
st.st_nlink = node.nlinks()
- st.st_size = node.size()
- st.st_mtime = node.mtime
- st.st_ctime = node.ctime
- st.st_atime = node.atime
+ st.st_size = node.size() # Until/unless we store the size in m.
+ if self.meta:
+ m = node.metadata()
+ if m:
+ st.st_mode = m.mode
+ st.st_uid = m.uid
+ st.st_gid = m.gid
+ st.st_atime = max(0, xstat.fstime_floor_secs(m.atime))
+ st.st_mtime = max(0, xstat.fstime_floor_secs(m.mtime))
+ st.st_ctime = max(0, xstat.fstime_floor_secs(m.ctime))
return st
except vfs.NoSuchFile:
return -errno.ENOENT
d,debug increase debug level
f,foreground run in foreground
o,allow-other allow other users to access the filesystem
+meta report original metadata for paths when available
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
git.check_repo_or_die()
top = vfs.RefList(None)
-f = BupFs(top)
+f = BupFs(top, meta=opt.meta)
f.fuse_args.mountpoint = extra[0]
if opt.debug:
f.fuse_args.add('debug')
WVPASS mkdir src
WVPASS date > src/foo
+WVPASS chmod 644 src/foo
+WVPASS touch -t 201111111111 src/foo
+# FUSE, python-fuse, something, can't handle negative epoch times.
+# Use pre-epoch to make sure bup properly "bottoms out" at 0 for now.
+WVPASS date > src/pre-epoch
+WVPASS chmod 644 src/pre-epoch
+WVPASS touch -t 196907202018 src/pre-epoch
WVPASS bup index src
WVPASS bup save -n src -d "$savestamp1" --strip src
latest"
result=$(WVPASS ls mnt/src/latest) || exit $?
-WVPASSEQ "$result" "foo"
+WVPASSEQ "$result" "foo
+pre-epoch"
# Right now we don't detect new saves.
WVPASS bup save -n src -d "$savestamp2" --strip src
WVPASSEQ "$result" "$savename1
latest"
+WVPASS fusermount -uz mnt
+
+WVSTART "extended metadata"
+WVPASS bup fuse --meta mnt
+result=$(WVPASS ls -l mnt/src/latest/) || exit $?
+readonly user=$(WVPASS id -un) || $?
+readonly group=$(WVPASS id -gn) || $?
+WVPASSEQ "$result" "total 0
+-rw-r--r-- 1 $user $group 29 Nov 11 2011 foo
+-rw-r--r-- 1 $user $group 29 Dec 31 1969 pre-epoch"
+
WVPASS fusermount -uz mnt
WVPASS rm -rf "$tmpdir"