summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJakob Unterwurzacher2021-06-06 19:22:16 +0200
committerJakob Unterwurzacher2021-06-06 19:22:16 +0200
commit17f859d3c409bf2730a47d56979c0700171006b7 (patch)
tree79d9e0bb8042ba516e89490fb39b13fd8ff3ce4a /tests
parent6910f8670502b57cc442d3c45c5e5be1165b3d2c (diff)
fusefronted: report plaintext size on symlink creation
gocryptfs 2.0 introduced the regression that the size reported at symlink creation was the ciphertext size, which is wrong. Report the plaintext size. Fixes https://github.com/rfjakob/gocryptfs/issues/574
Diffstat (limited to 'tests')
-rw-r--r--tests/matrix/matrix_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/matrix/matrix_test.go b/tests/matrix/matrix_test.go
index ec4c092..6622213 100644
--- a/tests/matrix/matrix_test.go
+++ b/tests/matrix/matrix_test.go
@@ -19,6 +19,7 @@ import (
"math/rand"
"os"
"os/exec"
+ "path/filepath"
"runtime"
"sync"
"syscall"
@@ -882,3 +883,21 @@ func TestStatfs(t *testing.T) {
t.Errorf("statfs reports size zero: %#v", st)
}
}
+
+// gocryptfs 2.0 reported the ciphertext size on symlink creation, causing
+// confusion: https://github.com/rfjakob/gocryptfs/issues/574
+func TestSymlinkSize(t *testing.T) {
+ p := filepath.Join(test_helpers.DefaultPlainDir, t.Name())
+ // SYMLINK reports the size to the kernel
+ if err := syscall.Symlink("foo", p); err != nil {
+ t.Fatal(err)
+ }
+ // Kernel serves us this value from the attr cache
+ var st syscall.Stat_t
+ if err := syscall.Lstat(p, &st); err != nil {
+ t.Fatal(err)
+ }
+ if st.Size != 3 {
+ t.Errorf("wrong size: have %d, want %d", st.Size, 3)
+ }
+}