{"record":{"id":"1b38f3b9f9d61977","repo":"juicedata/juicefs","slug":"expect-mode-o-but-got-o","errorCode":null,"errorMessage":"expect mode %o but got %o","messagePattern":"expect mode %o but got %o","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/objbench.go","lineNumber":1122,"sourceCode":"\t\t\tif info.Owner() != \"nobody\" {\n\t\t\t\treturn fmt.Errorf(\"expect owner nobody but got %s\", info.Owner())\n\t\t\t}\n\t\t\tif info.Group() != groupName {\n\t\t\t\treturn fmt.Errorf(\"expect group %s but got %s\", groupName, info.Group())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\tfunFSCase(\"change permission\", func() error {\n\t\tif err := fi.Chmod(key, 0777); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif objInfo, err := blob.Head(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to head object %s\", err)\n\t\t} else if info, ok := objInfo.(object.File); ok {\n\t\t\tif info.Mode()&0xFFF != 0777 {\n\t\t\t\treturn fmt.Errorf(\"expect mode %o but got %o\", 0777, info.Mode())\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n\n\tfunFSCase(\"change mtime\", func() error {\n\t\tmtime := time.Now().Add(-10 * time.Minute)\n\t\tif err := fi.Chtimes(key, mtime); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to chtimes %s\", err)\n\t\t}\n\t\tif objInfo, err := blob.Head(ctx, key); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to head object %s\", err)\n\t\t} else {\n\t\t\tif objInfo.Mtime().Before(mtime.Add(-2*time.Second)) || objInfo.Mtime().After(mtime.Add(2*time.Second)) {\n\t\t\t\treturn fmt.Errorf(\"mtime deviation is too large, the actual mtime is %s but got %s\", mtime.Format(time.RFC3339), objInfo.Mtime().Format(time.RFC3339))\n\t\t\t}\n\t\t}\n\t\treturn nil","sourceCodeStart":1104,"sourceCodeEnd":1140,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/objbench.go#L1104-L1140","documentation":"objbench 'change permission' test compares the mode returned by Head (cast to object.File) against the expected 0777 that was just applied via fi.Chmod(key, 0777). It fires when the backend does not round-trip POSIX permission bits on objects, masking the mode bits with &0xFFF. Note the format arguments are swapped in the message (expect/got order reversed in practice).","triggerScenarios":"fi.Chmod(key, 0777) succeeds, blob.Head returns an object.File whose Mode()&0xFFF != 0777.","commonSituations":"Object storage backends (S3, OSS, etc.) that ignore or don't persist chmod/mode metadata; using a backend where Head does not return x-amz-mode metadata.","solutions":["Use an object storage backend that persists POSIX mode metadata (e.g. JuiceFS-aware storage).","If backend cannot store modes, treat this case as informational; check whether objbench reports it as a warning rather than a data-integrity issue.","Re-run with a local storage or a backend known to support mode preservation to confirm the benchmark harness itself is fine.","Verify via the actual bucket that mode metadata headers (e.g. x-amz-meta-mode) are being set."],"exampleFix":"// message currently swaps expect/got order\nreturn fmt.Errorf(\"expect mode %o but got %o\", 0777, info.Mode())\n// clearer ordering\nreturn fmt.Errorf(\"expect mode %o but got %o\", 0777&0xFFF, info.Mode()&0xFFF)","handlingStrategy":"type-guard","validationCode":"info, ok := objInfo.(object.File)\nif !ok { return nil } // backend doesn't report mode; skip check","typeGuard":"func fileMode(obj object.Object) (os.FileMode, bool) {\n    f, ok := obj.(object.File)\n    if !ok { return 0, false }\n    return f.Mode() & 0xFFF, true\n}","tryCatchPattern":null,"preventionTips":["Prefer backends that persist POSIX mode metadata when mode fidelity matters.","Expect mode checks to be skipped on plain S3-style backends.","Confirm the backend sets mode metadata headers on PUT.","Treat chmod round-trip failures as backend limitations, not data corruption."],"tags":["object-storage","permissions","chmod","benchmark"],"backgroundTag":"invalid-argument-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}