rfjakob/gocryptfs

test.bash failures during reverse test and on system without BTRFS

Closed this issue · 11 comments

Hi,
I'm building an RPM packages using gocryptfs-v2.5.4 vendored on AlmaLinux 10. It works but when I run test.bash it reports errors:

  1. One is about BTRFS test. On AlmaLinux and EL distro btrfs is not supported. The function is in tests/root_test/root_test.go [func TestBtrfsQuirks(t *testing.T)]. To avoid this problem I simply removed the code in the function where it requires mkfs.btrfs. Note: I tried also on a Debian 12 host where btrfs is not installed: same problem. There is a way to skip btrfs tests for system that does not use it?
  2. The other is in reverse test

--- FAIL: TestAccessVirtualDirIV (0.00s)
correctness_test.go:142: should NOT be executable

during reverse test. The interested file is "/var/tmp/gocryptfs-test-parent-0/1772555044/b/gocryptfs.diriv"

This is encountered on AlmaLinux 10 and Debian 12.

There is a bug in the test suite or this version is too new for EL10 or Debian12?

Thank you in advance

Best regards.

Hi, looks like this on Debian 12. I don't get a reverse failure. Can you post your output?

vagrant@debian12:~/gocryptfs_v2.5.4_src-deps$ make test
./test.bash
Warning: unmounting leftover filesystem: /var/tmp/gocryptfs-test-parent-1000/4199821411/default-plain
gocryptfs v2.5.4 without_openssl; go-fuse [vendored]; 2025-07-03 go1.19.8 linux/amd64
gocryptfs v2.5.4; go-fuse [vendored]; 2025-07-03 go1.19.8 linux/amd64
vendor directory exists, skipping 'go tool vet'
shellcheck not installed - skipping
Testing on TMPDIR=/var/tmp, filesystem: ext4   rw,relatime,errors=remount-ro
ok  	github.com/rfjakob/gocryptfs/v2	0.006s
?   	github.com/rfjakob/gocryptfs/v2/contrib/atomicrename	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/findholes	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/findholes/holes	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/getdents	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/readdirnames	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/statfs	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/contrib/statvsfstat	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/ctlsock	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/gocryptfs-xray	[no test files]
ok  	github.com/rfjakob/gocryptfs/v2/gocryptfs-xray/xray_tests	0.180s
ok  	github.com/rfjakob/gocryptfs/v2/internal/configfile	0.603s
ok  	github.com/rfjakob/gocryptfs/v2/internal/contentenc	0.006s
ok  	github.com/rfjakob/gocryptfs/v2/internal/cryptocore	0.187s
ok  	github.com/rfjakob/gocryptfs/v2/internal/ctlsocksrv	0.003s
?   	github.com/rfjakob/gocryptfs/v2/internal/ensurefds012	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/internal/exitcodes	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/internal/fido2	[no test files]
ok  	github.com/rfjakob/gocryptfs/v2/internal/fusefrontend	0.080s
ok  	github.com/rfjakob/gocryptfs/v2/internal/fusefrontend_reverse	0.009s
ok  	github.com/rfjakob/gocryptfs/v2/internal/inomap	0.015s
ok  	github.com/rfjakob/gocryptfs/v2/internal/nametransform	0.007s
?   	github.com/rfjakob/gocryptfs/v2/internal/openfiletable	[no test files]
ok  	github.com/rfjakob/gocryptfs/v2/internal/pathiv	0.007s
ok  	github.com/rfjakob/gocryptfs/v2/internal/readpassword	0.024s
ok  	github.com/rfjakob/gocryptfs/v2/internal/siv_aead	0.002s
ok  	github.com/rfjakob/gocryptfs/v2/internal/speed	0.005s [no tests to run]
ok  	github.com/rfjakob/gocryptfs/v2/internal/stupidgcm	5.468s
ok  	github.com/rfjakob/gocryptfs/v2/internal/syscallcompat	0.046s
ok  	github.com/rfjakob/gocryptfs/v2/internal/tlog	0.003s
ok  	github.com/rfjakob/gocryptfs/v2/tests/cli	5.393s
ok  	github.com/rfjakob/gocryptfs/v2/tests/cluster	0.008s
ok  	github.com/rfjakob/gocryptfs/v2/tests/defaults	2.133s
ok  	github.com/rfjakob/gocryptfs/v2/tests/deterministic_names	0.093s
ok  	github.com/rfjakob/gocryptfs/v2/tests/example_filesystems	3.531s
ok  	github.com/rfjakob/gocryptfs/v2/tests/fsck	0.757s
ok  	github.com/rfjakob/gocryptfs/v2/tests/hkdf_sanity	0.078s
ok  	github.com/rfjakob/gocryptfs/v2/tests/matrix	24.298s
ok  	github.com/rfjakob/gocryptfs/v2/tests/plaintextnames	0.117s
ok  	github.com/rfjakob/gocryptfs/v2/tests/reverse	3.157s
ok  	github.com/rfjakob/gocryptfs/v2/tests/root_test	0.076s
ok  	github.com/rfjakob/gocryptfs/v2/tests/sharedstorage	2.780s
?   	github.com/rfjakob/gocryptfs/v2/tests/symlink_race	[no test files]
?   	github.com/rfjakob/gocryptfs/v2/tests/test_helpers	[no test files]
ok  	github.com/rfjakob/gocryptfs/v2/tests/xattr	0.124s
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setuid(uid)
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setgid(gid)
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setreuid(ruid, euid)
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setregid(rgid, egid)
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setresuid(ruid, euid, suid)
./vendor/golang.org/x/sys/unix/syscall_linux.go:	return syscall.Setresgid(rgid, egid, sgid)
test.bash: This affects the whole process. Please use the syscallcompat wrappers instead.
make: *** [Makefile:8: test] Error 1
vagrant@debian12:~/gocryptfs_v2.5.4_src-deps$ make root_test
./build.bash
gocryptfs v2.5.4; go-fuse [vendored]; 2025-07-03 go1.19.8 linux/amd64
cd tests/root_test && go test -c && sudo TMPDIR=/var/tmp ./root_test.test -test.v
=== RUN   TestConcurrentUserOps
--- PASS: TestConcurrentUserOps (0.69s)
=== RUN   TestAsUserSleep
--- PASS: TestAsUserSleep (0.02s)
=== RUN   TestSupplementaryGroups
--- PASS: TestSupplementaryGroups (0.00s)
=== RUN   TestDiskFull
    root_test.go:204: sz1=4500000, sz2=3801088
--- PASS: TestDiskFull (0.33s)
=== RUN   TestAcl
    root_test.go:278: 
--- FAIL: TestAcl (0.05s)
=== RUN   TestBtrfsQuirks
    root_test.go:326: ["mkfs.btrfs" "/var/tmp/gocryptfs-test-parent-0/1275000468/TestBtrfsQuirks.img"]
    root_test.go:327: 
    root_test.go:328: exec: "mkfs.btrfs": executable file not found in $PATH
--- FAIL: TestBtrfsQuirks (0.00s)
=== RUN   TestOverlay
17:52:34.126059 Unimplemented opcode TMPFILE
--- PASS: TestOverlay (0.08s)
FAIL
make: *** [Makefile:13: root_test] Error 1

PS: This is a bug in the tests, ignore it

test.bash: This affects the whole process. Please use the syscallcompat wrappers instead.

The btrfs thing, yeah, I could skip the test if mkfs.btrfs is not installed.

Hi rfjakob,
this is a test.bash on Debian 12:

gocryptfs v2.5.4 without_openssl; go-fuse [vendored]; 2025-07-04 go1.19.8 linux/amd64
gocryptfs v2.5.4; go-fuse [vendored]; 2025-07-04 go1.19.8 linux/amd64
vendor directory exists, skipping 'go tool vet'
shellcheck not installed - skipping
Testing on TMPDIR=/var/tmp, filesystem: ext4 rw,relatime,errors=remount-ro
ok github.com/rfjakob/gocryptfs/v2 0.003s
? github.com/rfjakob/gocryptfs/v2/contrib/atomicrename [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/findholes [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/findholes/holes [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/getdents [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/readdirnames [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/statfs [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/statvsfstat [no test files]
? github.com/rfjakob/gocryptfs/v2/ctlsock [no test files]
? github.com/rfjakob/gocryptfs/v2/gocryptfs-xray [no test files]
ok github.com/rfjakob/gocryptfs/v2/gocryptfs-xray/xray_tests 0.070s
--- FAIL: TestLoadV2 (0.09s)
config_test.go:34: scrypt calculation runs too fast: 94 ms
failed to unlock master key: cipher: message authentication failed
Not running on a terminal, suppressing master key display
Not running on a terminal, suppressing master key display
Not running on a terminal, suppressing master key display
Not running on a terminal, suppressing master key display
FAIL
FAIL github.com/rfjakob/gocryptfs/v2/internal/configfile 0.223s
ok github.com/rfjakob/gocryptfs/v2/internal/contentenc 0.008s
ok github.com/rfjakob/gocryptfs/v2/internal/cryptocore 0.085s
ok github.com/rfjakob/gocryptfs/v2/internal/ctlsocksrv 0.001s
? github.com/rfjakob/gocryptfs/v2/internal/ensurefds012 [no test files]
? github.com/rfjakob/gocryptfs/v2/internal/exitcodes [no test files]
? github.com/rfjakob/gocryptfs/v2/internal/fido2 [no test files]
ok github.com/rfjakob/gocryptfs/v2/internal/fusefrontend 0.026s
ok github.com/rfjakob/gocryptfs/v2/internal/fusefrontend_reverse 0.002s
ok github.com/rfjakob/gocryptfs/v2/internal/inomap 0.009s
ok github.com/rfjakob/gocryptfs/v2/internal/nametransform 0.007s
? github.com/rfjakob/gocryptfs/v2/internal/openfiletable [no test files]
ok github.com/rfjakob/gocryptfs/v2/internal/pathiv 0.006s
ok github.com/rfjakob/gocryptfs/v2/internal/readpassword 0.015s
ok github.com/rfjakob/gocryptfs/v2/internal/siv_aead 0.003s
ok github.com/rfjakob/gocryptfs/v2/internal/speed 0.007s [no tests to run]
ok github.com/rfjakob/gocryptfs/v2/internal/stupidgcm 1.243s
ok github.com/rfjakob/gocryptfs/v2/internal/syscallcompat 0.011s
ok github.com/rfjakob/gocryptfs/v2/internal/tlog 0.003s
ok github.com/rfjakob/gocryptfs/v2/tests/cli 2.811s
ok github.com/rfjakob/gocryptfs/v2/tests/cluster 0.002s
ok github.com/rfjakob/gocryptfs/v2/tests/defaults 0.490s
ok github.com/rfjakob/gocryptfs/v2/tests/deterministic_names 0.021s
ok github.com/rfjakob/gocryptfs/v2/tests/example_filesystems 0.911s
ok github.com/rfjakob/gocryptfs/v2/tests/fsck 0.198s
ok github.com/rfjakob/gocryptfs/v2/tests/hkdf_sanity 0.020s
ok github.com/rfjakob/gocryptfs/v2/tests/matrix 9.397s
ok github.com/rfjakob/gocryptfs/v2/tests/plaintextnames 0.019s
--- FAIL: TestAccessVirtualDirIV (0.00s)
correctness_test.go:142: should NOT be executable
FAIL
testcases[0] = struct { plaintextnames bool; deterministic_names bool }{plaintextnames:false, deterministic_names:false} failed
FAIL github.com/rfjakob/gocryptfs/v2/tests/reverse 0.228s
ok github.com/rfjakob/gocryptfs/v2/tests/root_test 0.286s
ok github.com/rfjakob/gocryptfs/v2/tests/sharedstorage 2.346s
? github.com/rfjakob/gocryptfs/v2/tests/symlink_race [no test files]
? github.com/rfjakob/gocryptfs/v2/tests/test_helpers [no test files]
ok github.com/rfjakob/gocryptfs/v2/tests/xattr 0.018s
FAIL

Do you run the tests as root?

Does it also fail as a normal user?

The previous test was from root user.

Running the test using normal user I get:

gocryptfs v2.5.4 without_openssl; go-fuse [vendored]; 2025-07-04 go1.19.8 linux/amd64
gocryptfs v2.5.4; go-fuse [vendored]; 2025-07-04 go1.19.8 linux/amd64
vendor directory exists, skipping 'go tool vet'
shellcheck not installed - skipping
Testing on TMPDIR=/var/tmp, filesystem: ext4 rw,relatime,errors=remount-ro
ok github.com/rfjakob/gocryptfs/v2 0.002s
? github.com/rfjakob/gocryptfs/v2/contrib/atomicrename [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/findholes [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/findholes/holes [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/getdents [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/getdents-debug/readdirnames [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/statfs [no test files]
? github.com/rfjakob/gocryptfs/v2/contrib/statvsfstat [no test files]
? github.com/rfjakob/gocryptfs/v2/ctlsock [no test files]
? github.com/rfjakob/gocryptfs/v2/gocryptfs-xray [no test files]
ok github.com/rfjakob/gocryptfs/v2/gocryptfs-xray/xray_tests 0.076s
ok github.com/rfjakob/gocryptfs/v2/internal/configfile 0.224s
ok github.com/rfjakob/gocryptfs/v2/internal/contentenc 0.006s
ok github.com/rfjakob/gocryptfs/v2/internal/cryptocore 0.100s
ok github.com/rfjakob/gocryptfs/v2/internal/ctlsocksrv 0.001s
? github.com/rfjakob/gocryptfs/v2/internal/ensurefds012 [no test files]
? github.com/rfjakob/gocryptfs/v2/internal/exitcodes [no test files]
? github.com/rfjakob/gocryptfs/v2/internal/fido2 [no test files]
ok github.com/rfjakob/gocryptfs/v2/internal/fusefrontend 0.013s
ok github.com/rfjakob/gocryptfs/v2/internal/fusefrontend_reverse 0.002s
ok github.com/rfjakob/gocryptfs/v2/internal/inomap 0.007s
ok github.com/rfjakob/gocryptfs/v2/internal/nametransform 0.011s
? github.com/rfjakob/gocryptfs/v2/internal/openfiletable [no test files]
ok github.com/rfjakob/gocryptfs/v2/internal/pathiv 0.003s
ok github.com/rfjakob/gocryptfs/v2/internal/readpassword 0.009s
ok github.com/rfjakob/gocryptfs/v2/internal/siv_aead 0.001s
ok github.com/rfjakob/gocryptfs/v2/internal/speed 0.002s [no tests to run]
ok github.com/rfjakob/gocryptfs/v2/internal/stupidgcm 1.192s
ok github.com/rfjakob/gocryptfs/v2/internal/syscallcompat 0.008s
ok github.com/rfjakob/gocryptfs/v2/internal/tlog 0.002s
UnmountErr: "/var/tmp/gocryptfs-test-parent-1000/1285523729/TestMountBackground.4062540517.mnt" was not found in MountInfo, cannot check for FD leaks
UnmountErr: "/var/tmp/gocryptfs-test-parent-1000/1285523729/TestConfigPipe.1822672492.mnt" was not found in MountInfo, cannot check for FD leaks
OpenDir ".": invalid entry "NcFztTib2GAFl2DefNrmuAwrongPattern": bad message
Invalid cipherdir: directory /var/tmp/gocryptfs-test-parent-1000/1285523729/TestInitNotEmpty not empty
/usr/bin/fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
fs.Mount failed: fusermount exited with code 256
--- FAIL: TestDirectMount (0.02s)
directmount_test.go:52: mount failed: exit status 19
FAIL
FAIL github.com/rfjakob/gocryptfs/v2/tests/cli 2.787s
ok github.com/rfjakob/gocryptfs/v2/tests/cluster 0.008s
/usr/bin/fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
fs.Mount failed: fusermount exited with code 256
--- FAIL: TestForceOwner (0.01s)
main_test.go:441: mount failed: exit status 19
FAIL
FAIL github.com/rfjakob/gocryptfs/v2/tests/defaults 0.476s
ok github.com/rfjakob/gocryptfs/v2/tests/deterministic_names 0.034s
ok github.com/rfjakob/gocryptfs/v2/tests/example_filesystems 0.963s
ok github.com/rfjakob/gocryptfs/v2/tests/fsck 0.240s
ok github.com/rfjakob/gocryptfs/v2/tests/hkdf_sanity 0.048s
ok github.com/rfjakob/gocryptfs/v2/tests/matrix 10.009s
ok github.com/rfjakob/gocryptfs/v2/tests/plaintextnames 0.030s
/usr/bin/fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
fs.Mount failed: fusermount exited with code 256
--- FAIL: TestForceOwner (0.00s)
force_owner_test.go:26: mount failed: exit status 19
FAIL
testcases[0] = struct { plaintextnames bool; deterministic_names bool }{plaintextnames:false, deterministic_names:false} failed
FAIL github.com/rfjakob/gocryptfs/v2/tests/reverse 0.232s
/usr/bin/fusermount3: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
fs.Mount failed: fusermount exited with code 256
mount failed: exit status 19
FAIL github.com/rfjakob/gocryptfs/v2/tests/root_test 0.005s
ok github.com/rfjakob/gocryptfs/v2/tests/sharedstorage 2.336s
? github.com/rfjakob/gocryptfs/v2/tests/symlink_race [no test files]
? github.com/rfjakob/gocryptfs/v2/tests/test_helpers [no test files]
ok github.com/rfjakob/gocryptfs/v2/tests/xattr 0.021s
FAIL

Ok. Now add user_allow_other to /etc/fuse.conf and the tests should pass.

Hi,
adding user_allow_other to fuse.conf solves the issue for simple user, but what about root user?

The tests expect to be run as a normal user. For the tests that should run as root, please use

make root_test

This will run the tests that should be run as root as root.

Hi and thank you for your answer.

At this point what type of test I should run when creating the RPM packages?

Hi, please use the gocryptfs v2.6.0 release which automatically skips btrfs, and fixes the errors about ./vendor/golang.org/x/sys/unix/syscall_linux.go .

As for the tests, please run

make test
make root_test

Hi,
thank you for your work. I will use 2.6.0 as suggested.

Best regards