aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2025-10-02 21:33:43 +0200
committerJakob Unterwurzacher2025-10-02 21:42:39 +0200
commit6651f9a761f15d5d9b1be15d47dadbe4bb424665 (patch)
tree88ba4f4aa171eca3ebbe60471e3772f946732e22
parenta9ad30ff70d2ed8e12e9985d7ce48335fa2699ac (diff)
tests: matrix: add Test555Dir
--- FAIL: Test555Dir (0.00s) dir_test.go:90: wrong mode. want 0555 have 0755 FAIL TestMain: matrix[0] = matrix.testcaseMatrix{plaintextnames:false, openssl:"auto", aessiv:false, raw64:false, extraArgs:[]string(nil)} failed FAIL github.com/rfjakob/gocryptfs/v2/tests/matrix 2.109s https://github.com/rfjakob/gocryptfs/issues/964
-rw-r--r--tests/matrix/dir_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/matrix/dir_test.go b/tests/matrix/dir_test.go
index 13d6712..e2ecf46 100644
--- a/tests/matrix/dir_test.go
+++ b/tests/matrix/dir_test.go
@@ -70,3 +70,27 @@ func TestHaveDotdot(t *testing.T) {
t.Errorf("have=%q want=%q", have, want)
}
}
+
+// mkdir used to report the wrong file mode when creating a read-only
+// director.
+// https://github.com/rfjakob/gocryptfs/issues/964
+func Test555Dir(t *testing.T) {
+ dir1 := test_helpers.DefaultPlainDir + "/" + t.Name()
+ err := os.Mkdir(dir1, 0555)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Avoid permission errors when cleaning up the directory later
+ defer syscall.Chmod(dir1, 0700)
+
+ var st syscall.Stat_t
+ err = syscall.Stat(dir1, &st)
+ if err != nil {
+ t.Fatal(err)
+ }
+ have := st.Mode & 0777
+ if have != 0555 {
+ t.Errorf("wrong mode. want 0555 have %04o", have)
+ }
+}