summaryrefslogtreecommitdiff
path: root/tests/reverse/one_file_system_test.go
diff options
context:
space:
mode:
authorcopilot-swe-agent[bot]2025-07-07 18:18:12 +0000
committerrfjakob2025-07-08 19:54:14 +0200
commit386232f39ede046d6453a0990ad40f2d86a26f53 (patch)
tree8703ecc54e402af3dbcd3122f840c21f57242437 /tests/reverse/one_file_system_test.go
parent8f5df19b353e02ffba842fd1b15ccf93da7ee3b4 (diff)
Fix all staticcheck errors in gocryptfs codebase
Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Add staticcheck to test.bash for continuous static analysis Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Fix nil pointer dereference in timesToTimespec function The previous fix for deprecated fuse.UtimeToTimespec caused a panic because unix.TimeToTimespec doesn't handle nil pointers. This fix properly handles nil pointers by using unix.UTIME_OMIT while still using the non-deprecated unix.TimeToTimespec function. Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com> Undo SA6002 changes and add staticcheck ignore directive instead Co-authored-by: rfjakob <286847+rfjakob@users.noreply.github.com>
Diffstat (limited to 'tests/reverse/one_file_system_test.go')
-rw-r--r--tests/reverse/one_file_system_test.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/reverse/one_file_system_test.go b/tests/reverse/one_file_system_test.go
index 5bc965f..823cf62 100644
--- a/tests/reverse/one_file_system_test.go
+++ b/tests/reverse/one_file_system_test.go
@@ -1,7 +1,6 @@
package reverse_test
import (
- "io/ioutil"
"net/url"
"os"
"runtime"
@@ -33,7 +32,7 @@ func TestOneFileSystem(t *testing.T) {
// Copied from inomap
const maxPassthruIno = 1<<48 - 1
- entries, err := ioutil.ReadDir(mnt)
+ entries, err := os.ReadDir(mnt)
if err != nil {
t.Fatal(err)
}
@@ -43,7 +42,11 @@ func TestOneFileSystem(t *testing.T) {
// We are only interested in directories
continue
}
- st := e.Sys().(*syscall.Stat_t)
+ info, err := e.Info()
+ if err != nil {
+ continue
+ }
+ st := info.Sys().(*syscall.Stat_t)
// The inode numbers of files with a different device number are remapped
// to something above maxPassthruIno
if st.Ino > maxPassthruIno {