aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-19 22:25:54 +0200
committerJakob Unterwurzacher2016-10-19 22:25:54 +0200
commit589748548f24429bb30a8aafb3cae0d295b07da0 (patch)
tree24f60b0d7c199e8da75236747c9bf0a0f2d2da5c /internal
parent600ceece359d835934ad039bdd0e83cd647c410f (diff)
tests: add 1980.tar.gz extract test
Test that we get the right timestamp when extracting a tarball. Also simplify the workaround in doTestUtimesNano() and fix the fact that it was running no test at all.
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend/file.go19
1 files changed, 10 insertions, 9 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go
index 2692c70..e021962 100644
--- a/internal/fusefrontend/file.go
+++ b/internal/fusefrontend/file.go
@@ -386,19 +386,20 @@ func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
return fuse.OK
}
-// BrokenAtimeOmit means that atime support is broken.
+// BrokenAtime means that atime support is broken.
// TODO drop this once https://github.com/hanwen/go-fuse/pull/131 is
// merged
-const BrokenAtimeOmit = true
+const BrokenAtime = true
func (f *file) Utimens(a *time.Time, m *time.Time) fuse.Status {
- if BrokenAtimeOmit {
- // Band-aid for a nil pointer crash, described in
- // https://github.com/rfjakob/gocryptfs/issues/48
- // Also band-aid for "mtime gets set to atime".
- //
- // TODO drop this once https://github.com/hanwen/go-fuse/pull/131 is
- // merged
+ if BrokenAtime {
+ if m == nil {
+ tlog.Warn.Printf("refusing to set the atime to prevent a crash in go-fuse")
+ return fuse.EINVAL
+ }
+ // Due to a bug in loopbackFile.Utimens, the "a" value will be used
+ // to set both mtime and atime. Because mtime is more important, we
+ // override "a".
a = m
}
f.fdLock.RLock()