Commit Graph

413 Commits

Author SHA1 Message Date
Jakob Unterwurzacher
a55b3cc15a tests/matrix: fix data race in TestConcurrentReadWrite
Fixes https://github.com/golang/go/issues/54715

Output was:

$ go test ./tests/matrix -run TestConcurrentReadWrite -race
test_helpers: warning: testParentDir "/tmp/gocryptfs-test-parent-1026" does not reside on ext4, we will miss failures caused by ino reuse
PASS
PASS
==================
WARNING: DATA RACE
Write at 0x00c00038a0e0 by goroutine 63:
  runtime.racewriterange()
      <autogenerated>:1 +0x29
  internal/poll.(*FD).Pread()
      /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169
  os.(*File).pread()
      /usr/local/go/src/os/file_posix.go:40 +0x335
  os.(*File).ReadAt()
      /usr/local/go/src/os/file.go:136 +0x2de
  github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite.func1()
      /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:40 +0x14b

Previous write at 0x00c00038a0e0 by goroutine 61:
  runtime.racewriterange()
      <autogenerated>:1 +0x29
  internal/poll.(*FD).Pread()
      /usr/local/go/src/internal/poll/fd_unix.go:193 +0x169
  os.(*File).pread()
      /usr/local/go/src/os/file_posix.go:40 +0x335
  os.(*File).ReadAt()
      /usr/local/go/src/os/file.go:136 +0x2de
  github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite.func1()
      /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:40 +0x14b

Goroutine 63 (running) created at:
  github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite()
      /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:34 +0x31d
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47

Goroutine 61 (running) created at:
  github.com/rfjakob/gocryptfs/v2/tests/matrix.TestConcurrentReadWrite()
      /home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/matrix/concurrency_test.go:34 +0x31d
  testing.tRunner()
      /usr/local/go/src/testing/testing.go:1446 +0x216
  testing.(*T).Run.func1()
      /usr/local/go/src/testing/testing.go:1493 +0x47
==================
--- FAIL: TestConcurrentReadWrite (0.03s)
    testing.go:1319: race detected during execution of test
FAIL
TestMain: matrix[2] = matrix.testcaseMatrix{plaintextnames:false, openssl:"false", aessiv:false, raw64:false, extraArgs:[]string(nil)} failed
FAIL	github.com/rfjakob/gocryptfs/v2/tests/matrix	0.170s
FAIL
2022-08-28 20:31:27 +02:00
Jakob Unterwurzacher
003a7fa2e5 make format 2022-08-28 11:11:36 +02:00
Jakob Unterwurzacher
bf29c9f99d tests: add TestLongnamemax100Reverse
Fails right now as reported in https://github.com/rfjakob/gocryptfs/pull/655

--- FAIL: TestLongnamemax100Reverse (0.09s)
    longnamemax_test.go:104: l=64: should see a longname now
    longnamemax_test.go:104: l=65: should see a longname now
    longnamemax_test.go:104: l=66: should see a longname now
    longnamemax_test.go:104: l=67: should see a longname now
    longnamemax_test.go:104: l=68: should see a longname now
    longnamemax_test.go:104: l=69: should see a longname now
    longnamemax_test.go:104: l=70: should see a longname now
    longnamemax_test.go:104: l=71: should see a longname now
    longnamemax_test.go:104: l=72: should see a longname now
    longnamemax_test.go:104: l=73: should see a longname now
    longnamemax_test.go:104: l=74: should see a longname now
    longnamemax_test.go:104: l=75: should see a longname now
    longnamemax_test.go:104: l=76: should see a longname now
    longnamemax_test.go:104: l=77: should see a longname now
    longnamemax_test.go:104: l=78: should see a longname now
    longnamemax_test.go:104: l=79: should see a longname now
    longnamemax_test.go:104: l=80: should see a longname now
    longnamemax_test.go:104: l=81: should see a longname now
    longnamemax_test.go:104: l=82: should see a longname now
    longnamemax_test.go:104: l=83: should see a longname now
    longnamemax_test.go:104: l=84: should see a longname now
    longnamemax_test.go:104: l=85: should see a longname now
    longnamemax_test.go:104: l=86: should see a longname now
    longnamemax_test.go:104: l=87: should see a longname now
    longnamemax_test.go:104: l=88: should see a longname now
    longnamemax_test.go:104: l=89: should see a longname now
    longnamemax_test.go:104: l=90: should see a longname now
    longnamemax_test.go:104: l=91: should see a longname now
    longnamemax_test.go:104: l=92: should see a longname now
    longnamemax_test.go:104: l=93: should see a longname now
    longnamemax_test.go:104: l=94: should see a longname now
    longnamemax_test.go:104: l=95: should see a longname now
    longnamemax_test.go:104: l=96: should see a longname now
    longnamemax_test.go:104: l=97: should see a longname now
    longnamemax_test.go:104: l=98: should see a longname now
    longnamemax_test.go:104: l=99: should see a longname now
    longnamemax_test.go:104: l=100: should see a longname now
    longnamemax_test.go:104: l=101: should see a longname now
    longnamemax_test.go:104: l=102: should see a longname now
    longnamemax_test.go:104: l=103: should see a longname now
    longnamemax_test.go:104: l=104: should see a longname now
    longnamemax_test.go:104: l=105: should see a longname now
    longnamemax_test.go:104: l=106: should see a longname now
    longnamemax_test.go:104: l=107: should see a longname now
    longnamemax_test.go:104: l=108: should see a longname now
    longnamemax_test.go:104: l=109: should see a longname now
    longnamemax_test.go:104: l=110: should see a longname now
    longnamemax_test.go:104: l=111: should see a longname now
    longnamemax_test.go:104: l=112: should see a longname now
    longnamemax_test.go:104: l=113: should see a longname now
    longnamemax_test.go:104: l=114: should see a longname now
    longnamemax_test.go:104: l=115: should see a longname now
    longnamemax_test.go:104: l=116: should see a longname now
    longnamemax_test.go:104: l=117: should see a longname now
    longnamemax_test.go:104: l=118: should see a longname now
    longnamemax_test.go:104: l=119: should see a longname now
    longnamemax_test.go:104: l=120: should see a longname now
    longnamemax_test.go:104: l=121: should see a longname now
    longnamemax_test.go:104: l=122: should see a longname now
    longnamemax_test.go:104: l=123: should see a longname now
    longnamemax_test.go:104: l=124: should see a longname now
    longnamemax_test.go:104: l=125: should see a longname now
    longnamemax_test.go:104: l=126: should see a longname now
    longnamemax_test.go:104: l=127: should see a longname now
    longnamemax_test.go:104: l=128: should see a longname now
    longnamemax_test.go:104: l=129: should see a longname now
    longnamemax_test.go:104: l=130: should see a longname now
    longnamemax_test.go:104: l=131: should see a longname now
    longnamemax_test.go:104: l=132: should see a longname now
    longnamemax_test.go:104: l=133: should see a longname now
    longnamemax_test.go:104: l=134: should see a longname now
    longnamemax_test.go:104: l=135: should see a longname now
    longnamemax_test.go:104: l=136: should see a longname now
    longnamemax_test.go:104: l=137: should see a longname now
    longnamemax_test.go:104: l=138: should see a longname now
    longnamemax_test.go:104: l=139: should see a longname now
    longnamemax_test.go:104: l=140: should see a longname now
    longnamemax_test.go:104: l=141: should see a longname now
    longnamemax_test.go:104: l=142: should see a longname now
    longnamemax_test.go:104: l=143: should see a longname now
    longnamemax_test.go:104: l=144: should see a longname now
    longnamemax_test.go:104: l=145: should see a longname now
    longnamemax_test.go:104: l=146: should see a longname now
    longnamemax_test.go:104: l=147: should see a longname now
    longnamemax_test.go:104: l=148: should see a longname now
    longnamemax_test.go:104: l=149: should see a longname now
    longnamemax_test.go:104: l=150: should see a longname now
    longnamemax_test.go:104: l=151: should see a longname now
    longnamemax_test.go:104: l=152: should see a longname now
    longnamemax_test.go:104: l=153: should see a longname now
    longnamemax_test.go:104: l=154: should see a longname now
    longnamemax_test.go:104: l=155: should see a longname now
    longnamemax_test.go:104: l=156: should see a longname now
    longnamemax_test.go:104: l=157: should see a longname now
    longnamemax_test.go:104: l=158: should see a longname now
    longnamemax_test.go:104: l=159: should see a longname now
    longnamemax_test.go:104: l=160: should see a longname now
    longnamemax_test.go:104: l=161: should see a longname now
    longnamemax_test.go:104: l=162: should see a longname now
    longnamemax_test.go:104: l=163: should see a longname now
    longnamemax_test.go:104: l=164: should see a longname now
    longnamemax_test.go:104: l=165: should see a longname now
    longnamemax_test.go:104: l=166: should see a longname now
    longnamemax_test.go:104: l=167: should see a longname now
    longnamemax_test.go:104: l=168: should see a longname now
    longnamemax_test.go:104: l=169: should see a longname now
    longnamemax_test.go:104: l=170: should see a longname now
    longnamemax_test.go:104: l=171: should see a longname now
    longnamemax_test.go:104: l=172: should see a longname now
    longnamemax_test.go:104: l=173: should see a longname now
    longnamemax_test.go:104: l=174: should see a longname now
    longnamemax_test.go:104: l=175: should see a longname now
FAIL

https://github.com/rfjakob/gocryptfs/pull/655
2022-08-28 11:07:35 +02:00
Yuta Hayashibe
e9ecff7f07 Fix typos 2022-06-26 10:59:06 +02:00
Jakob Unterwurzacher
a2b54cfccd root_test: fix leftover loop mount
After running "make root_test" a few times df would look like this,
no good:

$ df
Filesystem                  1K-blocks       Used Available Use% Mounted on
[...]
/dev/loop11                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/4081611019/TestDiskFull.ext4.mnt
/dev/loop12                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/1959939106/TestDiskFull.ext4.mnt
/dev/loop13                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/2455888382/TestDiskFull.ext4.mnt
/dev/loop14                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/2002998275/TestDiskFull.ext4.mnt
/dev/loop15                      8729       8525         0 100% /var/tmp/gocryptfs-test-parent-0/806736609/TestDiskFull.ext4.mnt
/dev/loop16                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/4050106930/TestDiskFull.ext4.mnt
/dev/loop17                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/1661931756/TestDiskFull.ext4.mnt
/dev/loop18                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/617990718/TestDiskFull.ext4.mnt
/dev/loop19                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/3194420338/TestDiskFull.ext4.mnt
/dev/loop20                      8729       8525         0 100% /tmp/gocryptfs-test-parent-0/2180745159/TestDiskFull.ext4.mnt

Turns out the unmount failed with EBUSY, so use lazy
unmount.
2022-01-27 18:36:51 +01:00
Jakob Unterwurzacher
ba75aa1ab0 root_test: add TestOverlay ; syscallcompat: add QuirkNoUserXattr 2022-01-27 15:44:09 +01:00
Jakob Unterwurzacher
47358938ec tests: fix build failure on Go 1.15 and older
These don't have os.ReadDir yet.

Error was:

	Error: vet: tests/defaults/overlayfs_test.go:104:15: ReadDir not declared by package os
2022-01-22 16:07:59 +01:00
Jakob Unterwurzacher
696f11499b tests: add skipped O_TMPFILE test
Looks like the FUSE protocol does support O_TMPFILE yet.

https://github.com/rfjakob/gocryptfs/issues/641
2022-01-22 14:06:39 +01:00
Jakob Unterwurzacher
3bac814ea9 tests: add TestRenameWhiteout, TestRenameExchange
f
2022-01-22 12:42:57 +01:00
Jakob Unterwurzacher
3ca2b1983d tests: enable -fusedebug if FUSEDEBUG env is set 2022-01-22 11:46:08 +01:00
Jakob Unterwurzacher
5f955423b7 fusefrontend: fix -force_owner not affecting MKNOD
Fixes https://github.com/rfjakob/gocryptfs/issues/629
2022-01-10 20:05:36 +01:00
Jakob Unterwurzacher
700ae685cc tests: improve SEEK_DATA test for MacOS
(1)

Create a 1 GiB file instead of 1 TiB, because
apparently, on MacOS, the file (sometimes?) is not
created sparse, and fills up users' disks:

https://github.com/rfjakob/gocryptfs/issues/625

(2)

On darwin, SEEK_DATA is not the same as on Linux
( 2f8b555de2 )
so use the value provided by the unix package.
2022-01-04 15:21:20 +01:00
Jakob Unterwurzacher
1eaf1211a2 tests/cli: Check for leftover socket file
This fails at the moment:

$ go test ./tests/cli/
--- FAIL: TestMountPasswordEmpty (0.01s)
    cli_test.go:430: socket file "/tmp/gocryptfs-test-parent-1026/3413782690/TestMountPasswordEmpty.753166857.sock" left behind

https://github.com/rfjakob/gocryptfs/issues/634
2022-01-03 14:27:52 +01:00
Jakob Unterwurzacher
64be5de75f fusefrontend: allow slashes in xattr names
xattr names have fewer restrictions than file names,
relax the validation.

Fixes https://github.com/rfjakob/gocryptfs/issues/627
2021-12-19 14:43:56 +01:00
Jakob Unterwurzacher
ec186c13ce root_test, getdents-debug: restrict to linux
This does not work neither make sense on MacOS.
2021-12-08 18:50:42 +01:00
Jakob Unterwurzacher
7d60315cd5 tests: convert Creat() calls to Open()
Creat() is equivalent to Open(..., O_CREAT|O_WRONLY|O_TRUNC, ...)
and MacOS does not have syscall.Creat().

https://github.com/rfjakob/gocryptfs/issues/623
2021-12-08 18:49:21 +01:00
Jakob Unterwurzacher
d14c9340d6 cli: add -longnamemax
Fixes https://github.com/rfjakob/gocryptfs/issues/499
2021-10-21 15:58:19 +02:00
Jakob Unterwurzacher
3b881b0174 tests: add TestForceOwner
https://github.com/rfjakob/gocryptfs/issues/609
https://github.com/rfjakob/gocryptfs/pull/610
2021-10-15 17:35:12 +02:00
Jakob Unterwurzacher
2620cad0dc tests/matrix: test xchacha with and without openssl 2021-09-08 20:34:01 +02:00
Jakob Unterwurzacher
cbf282861b tests/matrix: don't leak fds in TestConcurrentReadCreate
We leaked a file descriptor for each empty file we encountered.
2021-09-01 10:28:33 +02:00
a1346054
7c2255be90 *: trim trailing whitespace 2021-09-01 10:22:01 +02:00
a1346054
c63f7e9f64 shell scripts: fix shellcheck warnings 2021-09-01 10:22:01 +02:00
Jakob Unterwurzacher
34d8a498c4 Unbreak hyperlinks broken by go mod v2 conversion
Commit

  69d88505fd go mod: declare module version v2

translated all instances of "github.com/rfjakob/gocryptfs/" to
"github.com/rfjakob/gocryptfs/v2/".

Unfortunately, this included hyperlinks.

Unbreak the hyperlinks like this:

  find . -name \*.go | xargs sed -i s%https://github.com/rfjakob/gocryptfs/v2/%https://github.com/rfjakob/gocryptfs/v2/%
2021-08-30 11:31:01 +02:00
Jakob Unterwurzacher
7b25ff39c8 fsstress-gocryptfs: fuse-xfstests now lives in /opt
fuse-xfstests should be installed to /opt now to make
the terminal output independent of the user name
(as done in https://github.com/rfjakob/fuse-xfstests/wiki/results_2021-06-02 )
2021-08-26 07:46:28 +02:00
Jakob Unterwurzacher
ab7308639b tests/example_filesystems: add v2.2-xchacha-deterministic-names
Combines both new flags.
2021-08-24 13:53:50 +02:00
Jakob Unterwurzacher
d70875aaa9 tests/example_filesystems: add deterministic-names and xchacha 2021-08-24 13:50:07 +02:00
Jakob Unterwurzacher
b12ad292d4 tests/cli: add -xchacha tests 2021-08-23 16:17:04 +02:00
Jakob Unterwurzacher
2fb1d52746 tests/matrix: add -xchacha test 2021-08-23 16:00:41 +02:00
Jakob Unterwurzacher
b02812f8b3 test/cli: actually run TestZerokey
As the filename did not end in _test.go, TestZerokey
was not actually run. Fix that.
	renamed:    tests/cli/zerokey.go -> tests/cli/zerokey_test.go
2021-08-23 15:17:04 +02:00
Jakob Unterwurzacher
69d88505fd go mod: declare module version v2
Our git version is v2+ for some time now, but go.mod
still declared v1. Hopefully making both match makes
https://pkg.go.dev/github.com/rfjakob/gocryptfs/v2 work.

All the import paths have been fixed like this:

  find . -name \*.go | xargs sed -i s%github.com/rfjakob/gocryptfs/%github.com/rfjakob/gocryptfs/v2/%
2021-08-23 15:05:15 +02:00
Jakob Unterwurzacher
fbccb16043 -deterministic-names: implement for reverse mode, too 2021-08-20 17:06:18 +02:00
Jakob Unterwurzacher
2a9dea2973 -deterministic-names: accept flag on -init
And store it in gocryptfs.conf (=remove DirIV feature flag).
2021-08-20 15:57:40 +02:00
Jakob Unterwurzacher
195d9d18a9 Implement -deterministic-names: extended -zerodiriv
-deterministc-names uses all-zero dirivs but does not write
them to disk anymore.
2021-08-20 10:58:42 +02:00
Jose M Perez
8f94083a21 Flag -zerodiriv to create all diriv as all zero byte files 2021-08-19 18:05:54 +02:00
Jakob Unterwurzacher
be2bd4eec7 golangci-lint: fix issues found by "unused" and "deadcode"
Except xattrSupported, this is a false positive.

$ golangci-lint run --disable-all --enable unused --enable deadcode
gocryptfs-xray/xray_main.go:24:5: `GitVersionFuse` is unused (deadcode)
var GitVersionFuse = "[GitVersionFuse not set - please compile using ./build.bash]"
    ^
tests/symlink_race/main.go:47:6: `chmodLoop` is unused (deadcode)
func chmodLoop() {
     ^
internal/readpassword/extpass_test.go:11:5: `testPw` is unused (deadcode)
var testPw = []byte("test")
    ^
tests/reverse/xattr_test.go:13:6: func `xattrSupported` is unused (unused)
func xattrSupported(path string) bool {
     ^
internal/fusefrontend_reverse/rpath.go:20:22: func `(*RootNode).abs` is unused (unused)
func (rfs *RootNode) abs(relPath string, err error) (string, error) {
                     ^
tests/matrix/matrix_test.go:310:6: `sContains` is unused (deadcode)
func sContains(haystack []string, needle string) bool {
2021-08-19 08:34:49 +02:00
Jakob Unterwurzacher
d8b8232c3c test_helpers: actually use global testParentDir variable
Typo inside doInit.
2021-08-19 08:34:49 +02:00
Jakob Unterwurzacher
8ee595dd48 Fix issues found by "go vet"
Issues were:

 # github.com/rfjakob/gocryptfs/contrib/findholes/holes
 contrib/findholes/holes/holes.go:136:2: unreachable code
 # github.com/rfjakob/gocryptfs/tests/root_test_test
 tests/root_test/root_test.go:139:2: unreachable code

Also make sure we actually run "go vet" against the whole
codebase.
2021-08-19 08:34:49 +02:00
Jakob Unterwurzacher
c86981342b golangci-lint: fix issues found by gosimple
Everything except the

	if err2.Err == syscall.EOPNOTSUPP

case. Gets too confusing when collapsed into a single line.

Issues were:

$ golangci-lint run --disable-all --enable gosimple
mount.go:473:2: S1008: should use 'return strings.HasPrefix(v, "fusermount version")' instead of 'if strings.HasPrefix(v, "fusermount version") { return true }; return false' (gosimple)
	if strings.HasPrefix(v, "fusermount version") {
	^
cli_args.go:258:5: S1002: should omit comparison to bool constant, can be simplified to `args.forcedecode` (gosimple)
	if args.forcedecode == true {
	   ^
cli_args.go:263:6: S1002: should omit comparison to bool constant, can be simplified to `args.aessiv` (gosimple)
		if args.aessiv == true {
		   ^
cli_args.go:267:6: S1002: should omit comparison to bool constant, can be simplified to `args.reverse` (gosimple)
		if args.reverse == true {
		   ^
internal/stupidgcm/stupidgcm.go:227:6: S1002: should omit comparison to bool constant, can be simplified to `g.forceDecode` (gosimple)
		if g.forceDecode == true {
		   ^
gocryptfs-xray/xray_tests/xray_test.go:23:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple)
	if bytes.Compare(out, expected) != 0 {
	   ^
gocryptfs-xray/xray_tests/xray_test.go:40:5: S1004: should use !bytes.Equal(out, expected) instead (gosimple)
	if bytes.Compare(out, expected) != 0 {
	   ^
gocryptfs-xray/paths_ctlsock.go:34:20: S1002: should omit comparison to bool constant, can be simplified to `!eof` (gosimple)
	for eof := false; eof == false; line++ {
	                  ^
tests/reverse/xattr_test.go:19:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple)
	if err2.Err == syscall.EOPNOTSUPP {
	^
internal/fusefrontend/node.go:459:45: S1002: should omit comparison to bool constant, can be simplified to `!nameFileAlreadyThere` (gosimple)
		if nametransform.IsLongContent(cName2) && nameFileAlreadyThere == false {
		                                          ^
tests/xattr/xattr_integration_test.go:221:2: S1008: should use 'return err2.Err != syscall.EOPNOTSUPP' instead of 'if err2.Err == syscall.EOPNOTSUPP { return false }; return true' (gosimple)
	if err2.Err == syscall.EOPNOTSUPP {
	^
tests/test_helpers/helpers.go:338:19: S1002: should omit comparison to bool constant, can be simplified to `open` (gosimple)
	if err != nil && open == true {
	                 ^
tests/matrix/concurrency_test.go:121:7: S1004: should use !bytes.Equal(buf, content) instead (gosimple)
			if bytes.Compare(buf, content) != 0 {
			   ^
2021-08-19 08:34:44 +02:00
Jakob Unterwurzacher
64793fedf4 Fix issues found by ineffassign
gocryptfs$ ineffassign ./...

/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:243:2: ineffectual assignment to scryptHash
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/configfile/config_file.go:272:2: ineffectual assignment to scryptHash
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/file.go:285:3: ineffectual assignment to fileID
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node.go:367:3: ineffectual assignment to err
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/node_open_create.go:68:2: ineffectual assignment to fd
/home/jakob/go/src/github.com/rfjakob/gocryptfs/mount.go:308:2: ineffectual assignment to masterkey
/home/jakob/go/src/github.com/rfjakob/gocryptfs/gocryptfs-xray/xray_main.go:156:13: ineffectual assignment to err
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/fusefrontend/prepare_syscall_test.go:65:16: ineffectual assignment to errno
/home/jakob/go/src/github.com/rfjakob/gocryptfs/internal/syscallcompat/open_nofollow_test.go:34:2: ineffectual assignment to fd
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:111:6: ineffectual assignment to err
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:181:2: ineffectual assignment to sz
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/acl_test.go:198:2: ineffectual assignment to sz
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/defaults/main_test.go:365:8: ineffectual assignment to err
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:30:6: ineffectual assignment to err
/home/jakob/go/src/github.com/rfjakob/gocryptfs/tests/xattr/xattr_fd_test.go:66:6: ineffectual assignment to err
2021-08-18 15:48:01 +02:00
Jakob Unterwurzacher
0bc9784508 reverse: fix "exclude all but" case
With test.

Fixes https://github.com/rfjakob/gocryptfs/issues/588
2021-08-18 11:38:56 +02:00
Jakob Unterwurzacher
3df1c62430 tests/reverse/TestExcludeTestFs: test trailing slash 2021-08-18 11:04:56 +02:00
Jakob Unterwurzacher
884398eec3 tests/reverse/TestExcludeTestFs: improve comments & code style
No functional changes.
2021-08-18 11:04:40 +02:00
Jakob Unterwurzacher
b8ddc49ede tests/cli/TestBadname: make sure case 5 is never decodable
Sometimes, by chance, case 5 resulted in valid decrypted data:

--- FAIL: TestBadname (0.08s)
    cli_test.go:885: Case 5 failed: "J7Rbo1BvfXojpBEr0Qrt_invalid_file GOCRYPTFS_BAD_NAME" in ["file GOCRYPTFS_BAD_NAME,\x9e$O\xc3j\x8c\xd0\x06\x01#\f%k\x02\xcanvalid_file GOCRYPTFS_BAD_NAME,mzaZRF9_0IU-_5vv2wPC_invalid_file GOCRYPTFS_BAD_NAME,file,file_invalid_file GOCRYPTFS_BAD_NAME,mzaZRF9_0IU-_5vv2wP_invalid_file GOCRYPTFS_BAD_NAME"]

Add percent signs so base64 decoding always fails.

Fixes https://github.com/rfjakob/gocryptfs/runs/3347883728
2021-08-17 15:17:36 +02:00
Jakob Unterwurzacher
eeb267950a tests/reverse: replace os.ReadDir to support older Go versions 2021-08-16 22:05:33 +02:00
Jakob Unterwurzacher
e2d3834b1c tests/root_test: show failing command detail
https://github.com/kdave/btrfs-progs/issues/392
2021-08-16 19:24:04 +02:00
Jakob Unterwurzacher
b2724070d9 reverse mode: implement -one-file-system
Fixes https://github.com/rfjakob/gocryptfs/issues/475
2021-08-16 19:23:58 +02:00
Jakob Unterwurzacher
ad4b99170b tests/cli: escape filenames in TestBadname logs
I just got this message (not reproducible) with unescaped
binary garbage.

  UnmountErr: "/var/tmp/gocryptfs-test-parent-1026/114471933/TestMountBackground.899727687.mnt" was not found in MountInfo, cannot check for FD leaks
  UnmountErr: "/var/tmp/gocryptfs-test-parent-1026/114471933/TestConfigPipe.212912444.mnt" was not found in MountInfo, cannot check for FD leaks
  DecryptName "mzaZRF9_0IU-_5vv2wPC_i": unPad16 error: Padding too long, padLen=49 > 16
  OpenDir ".": invalid entry "KqQ346cuOAFHv_qSta5PhAwrongPattern": bad message
  DecryptName "mzaZRF9_0IU-_5vv2wP_in": unPad16 error: Padding byte at i=10 is invalid
  --- FAIL: TestBadname (0.11s)
      cli_test.go:885: Case 5 failed: 'KqQ346cuOAFHv_qSta5P_invalid_file GOCRYPTFS_BAD_NAME' in [file_invalid_file GOCRYPTFS_BAD_NAME,file,mzaZRF9_0IU-_5vv2wPC_invalid_file GOCRYPTFS_BAD_NAME,file GOCRYPTFS_BAD_NAME,�*A���y���Gfnvalid_file GOCRYPTFS_BAD_NAME,mzaZRF9_0IU-_5vv2wP_invalid_file GOCRYPTFS_BAD_NAME]
  Invalid cipherdir: directory /var/tmp/gocryptfs-test-parent-1026/114471933/TestInitNotEmpty not empty
  FAIL
  FAIL	github.com/rfjakob/gocryptfs/tests/cli	4.817s
2021-08-16 17:15:07 +02:00
Jakob Unterwurzacher
2d386fc92e syscallcompat: move quirks logic here & fix darwin
We need to look at f_fstypename acc. to
https://stackoverflow.com/a/52299141/1380267 :

> As filesystem type numbers are now assigned at runtime in
> recent versions of MacOS, you must use f_fstypename to
> determine the type.

https://github.com/rfjakob/gocryptfs/issues/585
2021-08-11 20:23:35 +02:00
Jakob Unterwurzacher
1bc1db620b fusefrontend: -sharedstorage: present stable inode numbers
Use the Gen field (inode generation) to distinguish hard links
while passing the real inode numbers to userspace.

Fixes https://github.com/rfjakob/gocryptfs/issues/584
2021-07-31 13:24:25 +02:00
Jakob Unterwurzacher
eecbcbb090 tests: matrix: add TestPwd
https://github.com/rfjakob/gocryptfs/issues/584
2021-07-31 13:23:05 +02:00