{"record":{"id":"b865f240dbace224","repo":"nodejs/node","slug":"setting-access-bits-failed-for-s-s-n","errorCode":null,"errorMessage":"setting access bits failed for [%s]: %s\\n","messagePattern":"setting access bits failed for \\[(.+?)\\]: (.+?)\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"deps/brotli/c/tools/brotli.c","lineNumber":867,"sourceCode":"#endif\n}\n\n/* Copy file times and permissions.\n   TODO(eustas): this is a \"best effort\" implementation; honest cross-platform\n   fully featured implementation is way too hacky; add more hacks by request. */\nstatic void CopyStat(const char* input_path, const char* output_path) {\n  struct stat statbuf;\n  int res;\n  if (input_path == 0 || output_path == 0) {\n    return;\n  }\n  if (stat(input_path, &statbuf) != 0) {\n    return;\n  }\n  res = CopyTimeStat(&statbuf, output_path);\n  res = chmod(output_path, statbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));\n  if (res != 0) {\n    fprintf(stderr, \"setting access bits failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n  res = chown(output_path, (uid_t)-1, statbuf.st_gid);\n  if (res != 0) {\n    fprintf(stderr, \"setting group failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n  res = chown(output_path, statbuf.st_uid, (gid_t)-1);\n  if (res != 0) {\n    fprintf(stderr, \"setting user failed for [%s]: %s\\n\",\n            PrintablePath(output_path), strerror(errno));\n  }\n}\n\n/* Result ownership is passed to caller.\n   |*dictionary_size| is set to resulting buffer size. */\nstatic BROTLI_BOOL ReadDictionary(Context* context, Command command) {\n  static const int kMaxDictionarySize =","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/brotli/c/tools/brotli.c#L849-L885","documentation":"During `CopyStat`, `chmod()` on the output file failed when trying to copy the access bits (rwx mask) from the input file. This is a non-fatal warning inside the stat-copy routine — the compress/decompress operation itself has already completed; only the metadata copy failed.","triggerScenarios":"The output file was deleted between write and chmod; NFS with root-squash or permission mapping quirks; the output is on a filesystem that does not support Unix permission bits (e.g. FAT/exFAT mounted on Linux); SELinux denying the operation.","commonSituations":"Writing `.br` output to a FAT USB stick or a Windows share mounted with `vfat`; cross-filesystem compression where the destination doesn't honor Unix permissions.","solutions":["Use `--no-copy-stat` if available, or accept that permission bits will not be replicated.","Write output to a filesystem that supports Unix permissions (ext4, xfs, etc.).","Check SELinux/AppArmor logs if running under a mandatory-access-control system."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Check if the output filesystem supports Unix permissions\n#include <sys/vfs.h>\n#include <stdbool.h>\n\nbool fs_supports_chmod(const char *path) {\n    struct statfs sfs;\n    if (statfs(path, &sfs) != 0) return true; // assume yes on error\n    // FAT, VFAT, exFAT, NTFS (some) don't honor chmod\n    return sfs.f_type != 0x4d44 /* MSDOS */ &&\n           sfs.f_type != 0x65735546 /* FUSE */;\n}\n\n// If false, pass --no-copy-stat to brotli (if supported) or accept warnings.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use `--no-copy-stat` when writing to filesystems that don't support Unix permissions.","Accept chmod warnings as non-fatal — the compressed output is still valid.","Post-process permissions with a separate `chmod` if exact bits are required."],"tags":["filesystem","metadata","brotli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}