Commit Graph

1971 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
9cd24d79a2 v2api: implement Lseek
This also fixes the last remaining tests/fsck failure.
2020-07-23 22:55:07 +02:00
Jakob Unterwurzacher
8915785acf v2api: fsck: use a temporary mount
Directly accessing the Nodes does not work properly,
as there is no way to attach a newly LOOKUPped Node
to the tree. This means Path() does not work.

Use an actual mount instead and walk the tree.
2020-07-19 23:03:47 +02:00
Jakob Unterwurzacher
49fc3abcb4 v2api: Lookup: use newChild() helper 2020-07-19 13:15:18 +02:00
Jakob Unterwurzacher
015a884090 v2api: enable go-fuse warnings on mount & fsck 2020-07-19 12:48:29 +02:00
Jakob Unterwurzacher
751f237993 v2api: make fsck compile again
Horribly broken, but it compiles.

.../tests/fsck$ ./run_fsck.bash
Reading password from extpass program "echo", arguments: ["test"]
Decrypting master key
OpenDir ".": invalid entry "invalid_file_name.3": illegal base64 data at input byte 17
OpenDir ".": invalid entry "invalid_file_name_2": bad message
fsck: corrupt entry in dir "": "invalid_file_name.3"
fsck: corrupt entry in dir "": "invalid_file_name_2"
OpenDir ".": invalid entry "invalid_file_name____1": bad message
fsck: corrupt entry in dir "": "invalid_file_name____1"
fsck: error stating file ".go-fuse.5577006791947779410/deleted": no such file or directory
fsck: error listing xattrs on ".go-fuse.13260572831089785859/deleted": no such file or directory
fsck: error opening dir "i10488239 (dir): ": no such file or directory
fsck: error reading symlink ".go-fuse.10667007354186551956/deleted": no such file or directory
fsck: error listing xattrs on ".go-fuse.11998794077335055257/deleted": no such file or directory
[...]
2020-07-18 23:42:25 +02:00
Jakob Unterwurzacher
6b7ff09373 v2api: Node: make Path() public
Helpful for fsck.
2020-07-18 23:40:54 +02:00
Jakob Unterwurzacher
7eae35e2d3 v2api: implement ctlsocksrv.Interface 2020-07-17 22:14:40 +02:00
Jakob Unterwurzacher
57d572dbc1 v2api: implement Getxattr, Setxattr, Removexattr, Listxattr
gocryptfs/tests/xattr passes.
2020-07-14 19:55:20 +02:00
Jakob Unterwurzacher
4a0966e79e v2api: Setattr: fill out structure 2020-07-12 21:17:52 +02:00
Jakob Unterwurzacher
d7db071528 tests: TestMagicNames: add warmup rounds
Chasing a bug that seems to have nothing to do
with magic names, as it already triggers during
warmup:

--- FAIL: TestMagicNames (0.00s)
    matrix_test.go:773: Testing n="warmup1"
    matrix_test.go:773: Testing n="warmup2"
    matrix_test.go:820: no such file or directory
2020-07-12 21:00:52 +02:00
Jakob Unterwurzacher
9e69334400 v2api: set NullPermissions = true
Don't let go-fuse mess úp 0000 permissions.
2020-07-12 20:39:19 +02:00
Jakob Unterwurzacher
ca5acae6f0 v2api: fix Mkfifo 2020-07-12 20:19:29 +02:00
Jakob Unterwurzacher
0fa824933c v2api: properly implement Node.Setattr
We used to always open a *File2 and letting the *File2
handle Setattr. This does not work it we cannot open the file!

Before:

    $ go test
    2020/07/12 20:14:57 writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
    2020/07/12 20:14:57 writer: Write/Writev failed, err: 2=no such file or directory. opcode: INTERRUPT
    --- FAIL: TestLchown (0.00s)
        matrix_test.go:634: lchown /tmp/gocryptfs-test-parent-1026/014500839/default-plain/symlink: too many levels of symbolic links
    touch: setting times of '/tmp/gocryptfs-test-parent-1026/014500839/default-plain/utimesnano_symlink': Too many levels of symbolic links
    --- FAIL: TestUtimesNanoSymlink (0.00s)
        matrix_test.go:655: exit status 1
    --- FAIL: TestMkfifo (0.00s)
        matrix_test.go:755: file exists
    --- FAIL: TestMagicNames (0.00s)
        matrix_test.go:773: Testing n="gocryptfs.longname.QhUr5d9FHerwEs--muUs6_80cy6JRp89c1otLwp92Cs"
        matrix_test.go:773: Testing n="gocryptfs.diriv"
        matrix_test.go:815: open /tmp/gocryptfs-test-parent-1026/014500839/default-plain/linktarget: permission denied
    --- FAIL: TestChmod (0.00s)
        matrix_test.go:840: chmod 444 -> 000 failed: permission denied
        matrix_test.go:840: chmod 444 -> 111 failed: permission denied
        matrix_test.go:840: chmod 444 -> 123 failed: permission denied
        matrix_test.go:840: chmod 444 -> 321 failed: permission denied
    FAIL
    exit status 1
    FAIL	github.com/rfjakob/gocryptfs/tests/matrix	0.790s

After:

    $ go test
    --- FAIL: TestMkfifo (0.00s)
        matrix_test.go:755: file exists
    --- FAIL: TestMagicNames (0.00s)
        matrix_test.go:773: Testing n="gocryptfs.longname.QhUr5d9FHerwEs--muUs6_80cy6JRp89c1otLwp92Cs"
        matrix_test.go:773: Testing n="gocryptfs.diriv"
        matrix_test.go:815: open /tmp/gocryptfs-test-parent-1026/501766059/default-plain/linktarget: permission denied
    --- FAIL: TestChmod (0.00s)
        matrix_test.go:849: modeHave 0644 != modeWant 0
    FAIL
    exit status 1
    FAIL    github.com/rfjakob/gocryptfs/tests/matrix   0.787s
2020-07-12 20:17:15 +02:00
Jakob Unterwurzacher
f11432d02a v2api: Getattr: use file handle if passed 2020-07-12 15:08:17 +02:00
Jakob Unterwurzacher
4d99b02279 v2api: Getattr: fix file size 2020-07-12 15:03:42 +02:00
Jakob Unterwurzacher
0d385846da v2api: call InitSerializer
If we don't, reads hang with -serialize_reads.
2020-07-12 15:02:53 +02:00
Jakob Unterwurzacher
230d92c4f4 v2api: fix Rename trying to overwrite itself
We used to do this

  [pid 99182] renameat2(14, "Y_4DAxKvj1QnXmJx2AkrKA", 15, ".", RENAME_NOREPLACE <unfinished ...>

which was not the intention.
2020-07-12 13:55:24 +02:00
Jakob Unterwurzacher
f3a0dbabee tests: fix TestCpWarnings comment typo 2020-07-12 13:43:34 +02:00
Jakob Unterwurzacher
fd0e8aa869 tests: don't crash on empty Flistxattr result 2020-07-12 13:40:21 +02:00
Jakob Unterwurzacher
735e2aa65b v2api: fix Mkdir crash when using plaintextnames 2020-07-12 13:35:37 +02:00
Jakob Unterwurzacher
b1d631d432 v2api: fix double-lock in truncate 2020-07-12 13:13:24 +02:00
Jakob Unterwurzacher
6196a5b5fe v2api: File2: implement Release, Read, Write, Fsync, Flush, Allocate
Fortunately, this just means fixing up the function
signatures.
2020-07-12 12:59:01 +02:00
Jakob Unterwurzacher
d539a4c214 v2api: fix RootNode cast 2020-07-11 20:27:47 +02:00
Jakob Unterwurzacher
b0342fae5d v2api: fix TestOpenBackingDir 2020-07-11 20:15:47 +02:00
Jakob Unterwurzacher
7de3330d70 v2api: implement Rename 2020-07-11 19:56:45 +02:00
Jakob Unterwurzacher
84344834c4 v2api: remove OpenatUserCtx, MknodatUserCtx helpers
Instead, use the new toFuseCtx() function introduced
in an earlier commit.
2020-07-11 19:44:45 +02:00
Jakob Unterwurzacher
250dbc6436 v2api: implement Symlink 2020-07-11 19:43:07 +02:00
Jakob Unterwurzacher
c35b575d5f v2api: implement Link 2020-07-11 19:32:38 +02:00
Jakob Unterwurzacher
b971c75e67 v2api: implement Mknod 2020-07-11 19:23:04 +02:00
Jakob Unterwurzacher
855b4a95b7 v2api: implement Statfs 2020-07-11 18:59:54 +02:00
Jakob Unterwurzacher
a39fc8ab2e v2api: fix crash on umount
fs.Mount already called srv.Serve() for us.
2020-07-08 22:21:27 +02:00
Jakob Unterwurzacher
40a31e0c32 v2api: list interfaces to be implemented 2020-07-05 20:22:24 +02:00
Jakob Unterwurzacher
63f68a0fcd v2api: implement Setattr 2020-07-05 20:10:53 +02:00
Jakob Unterwurzacher
c22e78ee41 v2api: implement Opendir 2020-07-05 19:34:30 +02:00
Jakob Unterwurzacher
1f4e554168 v2api: merge openBackingDir into root_node.go 2020-07-04 21:42:04 +02:00
Jakob Unterwurzacher
d2139e18ef v2api: implement Open() 2020-07-04 21:37:44 +02:00
Jakob Unterwurzacher
d73e4b3f7c v2api: add prepareAtSyscall helper 2020-07-04 21:16:20 +02:00
Jakob Unterwurzacher
23180794fe v2api: implement Readlink 2020-07-04 20:32:02 +02:00
Jakob Unterwurzacher
1618fbbac5 v2api: implement Unlink 2020-06-21 14:08:53 +02:00
Jakob Unterwurzacher
cc0b94a3c5 v2api: implement Rmdir 2020-06-21 13:57:04 +02:00
Jakob Unterwurzacher
192a29075a v2api: implement Mkdir 2020-06-21 13:46:08 +02:00
Jakob Unterwurzacher
f6ded09e36 v2api: implement Create 2020-06-21 13:25:12 +02:00
Jakob Unterwurzacher
74a4accf0c v2api: collect RootNode code in root_node.go 2020-06-21 12:44:32 +02:00
Jakob Unterwurzacher
ebdf58b9eb v2api: implement GetAttr and Readdir 2020-06-21 12:42:18 +02:00
Jakob Unterwurzacher
77632b7554 getdents_c: read from two threads
This was an attempt to make the C code more
similar to Go (which also reads from multiple threads).

However, I still could not repro the ENOENT problems.

https://github.com/rfjakob/gocryptfs/issues/483
2020-06-21 12:01:34 +02:00
Jakob Unterwurzacher
6aa9f5636f v2api: implement Lookup()
Compiles, but untested otherwise. No caching.
2020-06-21 12:01:34 +02:00
Jakob Unterwurzacher
9b8ce55383 inomap: clarify TranslateStat function comment
Also, fix the namespaceMap comment.
2020-06-21 12:01:34 +02:00
Jakob Unterwurzacher
2aad58f9ec v2api (go-fuse v2 api): initial noop implementation
Compiles and mounts but does nothing useful.
2020-06-21 12:01:24 +02:00
Jakob Unterwurzacher
3b61244b72 tests: TestBadname: simplify test by using empty files
Simplify the tests by using empty files. Empty
files are valid, and we don't check the content
anyway.

Also adjust comment style a little and add
a missing break statement.
2020-06-06 12:53:45 +02:00
Jakob Unterwurzacher
261cf12829 badname: stop trying to decrypt at length 22
At least 16 bytes due to AES --> at least 22 characters in base64
2020-06-06 12:49:45 +02:00