google / google/fscrypt

[testing] Tests fail if user keyring isn't linked into session keyring

Open
#99 0 comments 0 reactions 0 assignees View on GitHub
bug testing
Dominant language
Go
Stars
1k
Forks
111
Avg merge
2d 19h
Merged PRs (30d)
3

Description

If no key is linked to the keyring some tests fail. After running `keyctl link @u @s` the tests all succeed. Perhaps the test suite should add (and then remove) a key to the keyring? This is useful when testing in automated and non-interactive build environments, e.g. when using Debian sbuild/pbuilder. The output of the failing tests follows.

```
$ GOCACHE=off make test
go test -p 1 ./...
ok github.com/google/fscrypt/actions 0.002s
ok github.com/google/fscrypt/cmd/fscrypt 0.002s
2018/04/09 09:39:20 keyringID(_uid.1000) = 503951522,
2018/04/09 09:39:20 KeyctlLink(503951522, -2) =
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, fscrypt:0123456789abcdef) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, ext4:0123456789abcdef) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, f2fs:0123456789abcdef) = -1, required key not available
--- FAIL: TestAddRemoveKeys (0.00s)
crypto_test.go:250: user keyring not linked into session keyring
crypto_test.go:253: required key not available: could not find key with descriptor
crypto_test.go:250: user keyring not linked into session keyring
crypto_test.go:253: required key not available: could not find key with descriptor
crypto_test.go:250: user keyring not linked into session keyring
crypto_test.go:253: required key not available: could not find key with descriptor
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
2018/04/09 09:39:20 KeyctlSearch(503951522, logon, fscrypt:0123456789abcdef) = -1, required key not available
--- FAIL: TestAddTwice (0.00s)
crypto_test.go:263: InsertPolicyKey should not fail if key already exists
2018/04/09 09:39:20 keyringID(session) = 420490118,
2018/04/09 09:39:20 KeyctlSearch(420490118, keyring, _uid.1000) = -1, required key not available
FAIL
FAIL github.com/google/fscrypt/crypto 0.055s
ok github.com/google/fscrypt/filesystem 0.003s
ok github.com/google/fscrypt/metadata 0.002s
ok github.com/google/fscrypt/pam 0.002s
ok github.com/google/fscrypt/pam_fscrypt 0.002s
ok github.com/google/fscrypt/security 0.001s
ok github.com/google/fscrypt/util 0.002s
make: *** [Makefile:120: test] Error 1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.