aboutsummaryrefslogtreecommitdiff
path: root/tests/cli
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-01-25 16:54:57 +0100
committerJakob Unterwurzacher2020-01-25 16:54:57 +0100
commitdc21cd357258df775e67a36cbcd70fc5f83543ad (patch)
treea6af9e61a9792b2bf9d7daaa158850862c75c273 /tests/cli
parenta48d7fac2cedd18fcc0466091e35cccde5790d8a (diff)
tests: cli: add TestSymlinkedCipherdir
https://github.com/rfjakob/gocryptfs/issues/450
Diffstat (limited to 'tests/cli')
-rw-r--r--tests/cli/cli_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/cli/cli_test.go b/tests/cli/cli_test.go
index 423afdf..3e1bf42 100644
--- a/tests/cli/cli_test.go
+++ b/tests/cli/cli_test.go
@@ -609,3 +609,38 @@ func TestNotIdle(t *testing.T) {
// All good.
test_helpers.UnmountPanic(mnt)
}
+
+// TestSymlinkedCipherdir checks that if CIPHERDIR itself is a symlink, it is
+// followed.
+// https://github.com/rfjakob/gocryptfs/issues/450
+func TestSymlinkedCipherdir(t *testing.T) {
+ dir := test_helpers.InitFS(t)
+ dirSymlink := dir + ".symlink"
+ err := os.Symlink(dir, dirSymlink)
+ if err != nil {
+ t.Fatal(err)
+ }
+ mnt := dir + ".mnt"
+ test_helpers.MountOrFatal(t, dirSymlink, mnt, "-extpass=echo test")
+ defer test_helpers.UnmountPanic(mnt)
+
+ file := mnt + "/file"
+ f, err := os.Create(file)
+ if err != nil {
+ t.Fatal(err)
+ }
+ f.Close()
+
+ f, err = os.Open(mnt)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ names, err := f.Readdirnames(0)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if len(names) != 1 || names[0] != "file" {
+ t.Errorf("wrong Readdirnames result: %v", names)
+ }
+}