summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/fusefrontend/file.go12
-rw-r--r--tests/matrix/matrix_test.go6
2 files changed, 18 insertions, 0 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go
index ab025d3..796aee8 100644
--- a/internal/fusefrontend/file.go
+++ b/internal/fusefrontend/file.go
@@ -386,7 +386,19 @@ func (f *file) GetAttr(a *fuse.Attr) fuse.Status {
return fuse.OK
}
+// TODO drop this once https://github.com/hanwen/go-fuse/pull/131 is
+// merged
+const BrokenAtimeOmit = true
+
func (f *file) Utimens(a *time.Time, m *time.Time) fuse.Status {
+ if a == nil && BrokenAtimeOmit {
+ // Band-aid for a nil pointer crash, described in
+ // https://github.com/rfjakob/gocryptfs/issues/48
+ //
+ // TODO drop this once https://github.com/hanwen/go-fuse/pull/131 is
+ // merged
+ a = m
+ }
f.fdLock.RLock()
defer f.fdLock.RUnlock()
return f.loopbackFile.Utimens(a, m)
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index 5c09d26..774a7ae 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -25,6 +25,7 @@ import (
"testing"
"github.com/rfjakob/gocryptfs/internal/cryptocore"
+ "github.com/rfjakob/gocryptfs/internal/fusefrontend"
"github.com/rfjakob/gocryptfs/internal/syscallcompat"
"github.com/rfjakob/gocryptfs/tests/test_helpers"
)
@@ -698,6 +699,11 @@ func doTestUtimesNano(t *testing.T, path string) {
out: [2]syscall.Timespec{{Sec: 1, Nsec: 2}, {Sec: 5, Nsec: 6}},
},
}
+ if fusefrontend.BrokenAtimeOmit {
+ // TODO remove this once the pull request is merged:
+ // https://github.com/hanwen/go-fuse/pull/131
+ utimeTestcases = utimeTestcases[:1]
+ }
for i, tc := range utimeTestcases {
err := syscall.UtimesNano(path, tc.in[:])
if err != nil {