-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS: modification and creation dates reset #229
Comments
Huh. What happens to the dates of the encrypted files? |
When you write to a file, the encrypted file stays at 1970? |
For a very brief moment it shows the correct datetime but after max. one second it is reset. |
Well, that's funny. I'll see if I can get my hands on a macos box next week to reproduce this. I the meantime, can you run gocryptfs with "-fg -nosyslog -fusedebug" an see what happens when you modify a file? |
I don't see anything unusual but then I don't have a clue about this :-) |
All but the newest OSX versions (xnu-4570.1.46, released 2017) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by darwin, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call.
All but the newest OSX versions (xnu-4570.1.46, released 2017) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by darwin, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call.
Maybe found it. Can you try this build? gocryptfs.gz |
Ok, thanks for testing! So the problem is where I though it is, but the fix is causing other problems |
Well, thank you for all your efforts and prompt replies. Really appreciated! |
All but the newest OSX versions (xnu-4570.1.46, released 2017) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by darwin, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call.
Ok, I have that Mac box. And I can reproduce the save-existing-files problem: Happens in TextEdit as well, but does not seem to be related the fix. Also happens with older gocryptfs versions. On the command line, writing files works fine, so it seems to be that the MacOS GUI file save functions seem to be unhappy about something. |
Did you use the Homebrew version? Because with the latest version from Homebrew I don't have any problem apart from the file dates, never had. So I cannot confirm that it also happens with older gocrypt versions, at least not on my systems. |
We previously returned EPERM to prevent the kernel from blacklisting our xattr support once we get an unsupported flag, but this causes lots of trouble on MacOS: Cannot save files from GUI apps, see #229 Returning ENOSYS triggers the dotfiles fallback on MacOS and fixes the issue.
Ok it seems that xattr support is what causes the |
Tested the build and it works for me. However, |
All but the newest OSX versions (xnu-4570.1.46, released 2017) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by darwin, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call.
Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens() at 1-second precision. The exising TestUtimesNano() test only works on Linux because it relies on syscall.UtimesNano(), which is not available on Darwin. The new tests call the Utimens() functions directly, bypassing FUSE, and work on all platforms. Because Darwin does not have syscall.UtimesNano(), getting the Utimens() implementation right is hard. The tests currently fail on Darwin, underlining the need for them ( rfjakob/gocryptfs#229 ): $ go test ./fuse/nodefs [...] --- FAIL: TestLoopbackFileUtimens (0.00s) files_test.go:51: mtime has changed: 1525378914 -> 1073 files_test.go:70: atime has changed: 1525291058 -> 1073 [...] $ go test ./fuse/pathfs --- FAIL: TestLoopbackFileSystemUtimens (0.00s) loopback_test.go:55: mtime has changed: 1525378929 -> 1073 loopback_test.go:74: atime has changed: 1525291058 -> 1073 [...]
Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens() at 1-second precision. The exising TestUtimesNano() test only works on Linux because it relies on syscall.UtimesNano(), which is not available on Darwin. The new tests call the Utimens() functions directly, bypassing FUSE, and work on all platforms. Because Darwin does not have syscall.UtimesNano(), getting the Utimens() implementation right is hard. The tests currently fail on Darwin, underlining the need for them ( rfjakob/gocryptfs#229 ): $ go test ./fuse/nodefs [...] --- FAIL: TestLoopbackFileUtimens (0.00s) files_test.go:51: mtime has changed: 1525378914 -> 1073 files_test.go:70: atime has changed: 1525291058 -> 1073 [...] $ go test ./fuse/pathfs --- FAIL: TestLoopbackFileSystemUtimens (0.00s) loopback_test.go:55: mtime has changed: 1525378929 -> 1073 loopback_test.go:74: atime has changed: 1525291058 -> 1073 [...]
Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens() at 1-second precision. The exising TestUtimesNano() test only works on Linux because it relies on syscall.UtimesNano(), which is not available on Darwin. The new tests call the Utimens() functions directly, bypassing FUSE, and work on all platforms. Because Darwin does not have syscall.UtimesNano(), getting the Utimens() implementation right is hard. The tests currently fail on Darwin, underlining the need for them ( rfjakob/gocryptfs#229 ): $ go test ./fuse/nodefs [...] --- FAIL: TestLoopbackFileUtimens (0.00s) files_test.go:51: mtime has changed: 1525378914 -> 1073 files_test.go:70: atime has changed: 1525291058 -> 1073 [...] $ go test ./fuse/pathfs --- FAIL: TestLoopbackFileSystemUtimens (0.00s) loopback_test.go:55: mtime has changed: 1525378929 -> 1073 loopback_test.go:74: atime has changed: 1525291058 -> 1073 [...]
Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens() at 1-second precision. The exising TestUtimesNano() test only works on Linux because it relies on syscall.UtimesNano(), which is not available on Darwin. The new tests call the Utimens() functions directly, bypassing FUSE, and work on all platforms. Because Darwin does not have syscall.UtimesNano(), getting the Utimens() implementation right is hard. The tests currently fail on Darwin, underlining the need for them ( rfjakob/gocryptfs#229 ): $ go test ./fuse/nodefs [...] --- FAIL: TestLoopbackFileUtimens (0.00s) helpers.go:51: mtime has changed: 1525384186 -> 1073 helpers.go:70: atime has changed: 1525291058 -> 1073 [...] $ go test ./fuse/pathfs --- FAIL: TestLoopbackFileSystemUtimens (0.00s) helpers.go:51: mtime has changed: 1525384379 -> 1073 helpers.go:70: atime has changed: 1525291058 -> 1073 [...]
Just to let you know, this needs fixing in the go-fuse library and will take some time, step one is this: hanwen/go-fuse@bb848eb |
Indeed, this can take a while. Any chance of getting your "fixed" version into Homebrew. Somehow I don't feel comfortable that I published a non-working version there... And I have to come back to |
The "some time" this will take are probably two weeks. The issue is not too serious, and I believe it only affects High Sierra users. This is also why it was not noticed before. Things are mostly working, I don't think we need to rush out a fix. ctime: yes, I will try to get this fixed as well! |
I think High Sierra is the worst bug-fix/maintenance release ever... |
Well, maybe, but in that case, the bug is in gocryptfs / go-fuse ;) |
All but the newest OSX versions (xnu-4570.1.46, released 2017) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by darwin, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call.
All but the newest MacOS versions (xnu-4570.1.46 / High Sierra) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by MacOS, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call. To not duplicate the logic in pathfs and nodefs, an internal "utimens" helper package is created.
All but the newest MacOS versions (xnu-4570.1.46 / High Sierra) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by MacOS, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call. To not duplicate the logic in pathfs and nodefs, an internal "utimens" helper package is created.
All but the newest MacOS versions (xnu-4570.1.46 / High Sierra) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by MacOS, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call. To not duplicate the logic in pathfs and nodefs, an internal "utimens" helper package is created.
All but the newest MacOS versions (xnu-4570.1.46 / High Sierra) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by MacOS, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call. To not duplicate the logic in pathfs and nodefs, an internal "utimens" helper package is created. This patch fixes the failing utimens tests.
Does this one fix the creation time issue? gocryptfs.gz |
Unfortunately not. |
Thanks. The good news is, I have reproduced it here:
|
The bad news is that this is unfixable, as FUSE has no support for file creation ("birth") time. Anyway, I'll keep this ticket open until the timestamp fixes are merged into go-fuse. |
According to the author of
|
Tests loopbackFileSystem.Utimens() and loopbackfile.Utimens() at 1-second precision. The exising TestUtimesNano() test only works on Linux because it relies on syscall.UtimesNano(), which is not available on Darwin. The new tests call the Utimens() functions directly, bypassing FUSE, and work on all platforms. Because Darwin does not have syscall.UtimesNano(), getting the Utimens() implementation right is hard. The tests currently fail on Darwin, underlining the need for them ( rfjakob/gocryptfs#229 ): $ go test ./fuse/nodefs [...] --- FAIL: TestLoopbackFileUtimens (0.00s) helpers.go:51: mtime has changed: 1525384186 -> 1073 helpers.go:70: atime has changed: 1525291058 -> 1073 [...] $ go test ./fuse/pathfs --- FAIL: TestLoopbackFileSystemUtimens (0.00s) helpers.go:51: mtime has changed: 1525384379 -> 1073 helpers.go:70: atime has changed: 1525291058 -> 1073 [...]
All but the newest MacOS versions (xnu-4570.1.46 / High Sierra) lack utimensat() and UTIME_OMIT, see: https://github.com/apple/darwin-xnu/blame/0a798f6738bc1db01281fc08ae024145e84df927/bsd/sys/stat.h#L537 The UTIME_OMIT value is intepreted literally by MacOS, resulting in all files getting a 1970 timestamp ( rfjakob/gocryptfs#229 ). Emulate UTIME_OMIT by filling in the missing values using an extra GetAttr call. To not duplicate the logic in pathfs and nodefs, an internal "utimens" helper package is created. This patch fixes the failing utimens tests.
Thanks for finding out! Not supported at the moment by either gocryptfs or go-fuse, though. This is a mac-specific extension of the FUSE protocol. |
I know, but maybe we can get hanwen to implement it in go-fuse... |
Maybe another day... Fix was merged into go-fuse (hanwen/go-fuse@76c2303), I'll close the issue. |
Released as v1.5 |
is this problem still under work? |
The original problem was fixed in gocryptfs 1.5. You see the same problem again? Which gocryptfs and macos version? |
@rfjakob I think he talks about the birth date issue. In version 1.5 you fixed the modification dates. @warmup72 Nope, afaik no one tackled it. The problem is not in |
I´m using 1.7 on macOS 10.14.4
encrypted Path
|
BTW: I also tried cryptomator but they didn´t support tags which I need for my DMS |
Maybe this issue should be reopend? |
Could you create a new one? I would prefer that, as the modification time issue was fixed already. |
I started using
gocryptfs
(latest version) on macOS High Sierra and noticed that each time I eject my encrypted volume and remount it, that the creation and modification dates are reset to1970-01-01
. Is this expected behaviour?I mount my dirs using
gocryptfs -ko local /path/to/encDir /Volumes/encDir
Also mounting them without the
-ko local
option has the same result.The text was updated successfully, but these errors were encountered: