{"record":{"id":"a2c7b0543c6921f8","repo":"yorukot/superfile","slug":"failed-to-restrict-trash-directory-s-w","errorCode":null,"errorMessage":"failed to restrict trash directory %s: %w","messagePattern":"failed to restrict trash directory (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/internal/trash/trash_linux.go","lineNumber":210,"sourceCode":"\nfunc ensureOwnedPrivateTrash(path string) error {\n\tinfo, err := os.Lstat(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif info.Mode()&os.ModeSymlink != 0 {\n\t\treturn fmt.Errorf(\"refusing symlink trash directory %s\", path)\n\t}\n\tif !info.IsDir() {\n\t\treturn fmt.Errorf(\"trash path %s is not a directory\", path)\n\t}\n\tif stat, ok := info.Sys().(*syscall.Stat_t); ok && int(stat.Uid) != os.Getuid() {\n\t\treturn fmt.Errorf(\"trash directory %s is not owned by current user\", path)\n\t}\n\tif info.Mode().Perm()&0o077 != 0 {\n\t\t//nolint:gosec // Directory execute bit is required; trash directories are restricted to the owner.\n\t\tif err := os.Chmod(path, 0o700); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to restrict trash directory %s: %w\", path, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validSharedTrash(path string) bool {\n\tinfo, err := os.Lstat(path)\n\tif err != nil || !info.IsDir() || info.Mode()&os.ModeSymlink != 0 {\n\t\treturn false\n\t}\n\treturn info.Mode()&os.ModeSticky != 0\n}\n\nfunc reserveTrashInfo(td linuxTrashDir, srcAbs string) (string, string, string, error) {\n\tbase := filepath.Base(srcAbs)\n\tif base == \".\" || base == string(filepath.Separator) || base == \"\" {\n\t\treturn \"\", \"\", \"\", fmt.Errorf(\"invalid trash source %s\", srcAbs)\n\t}","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/yorukot/superfile/blob/b72f550bc6e75913f48eb49fdd258e1a2df2fe88/src/internal/trash/trash_linux.go#L192-L228","documentation":"Error \"failed to restrict trash directory %s: %w\" thrown in yorukot/superfile.","triggerScenarios":"Thrown at src/internal/trash/trash_linux.go:210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b72f550bc6e75913f48eb49fdd258e1a2df2fe88","analyzedAt":"2026-09-01T04:38:08.254Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}