nodejs/node · warning

setting access bits failed for [%s]: %s\n

Error message

setting access bits failed for [%s]: %s\n

What it means

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.

Source

Thrown at deps/brotli/c/tools/brotli.c:867

#endif
}

/* Copy file times and permissions.
   TODO(eustas): this is a "best effort" implementation; honest cross-platform
   fully featured implementation is way too hacky; add more hacks by request. */
static void CopyStat(const char* input_path, const char* output_path) {
  struct stat statbuf;
  int res;
  if (input_path == 0 || output_path == 0) {
    return;
  }
  if (stat(input_path, &statbuf) != 0) {
    return;
  }
  res = CopyTimeStat(&statbuf, output_path);
  res = chmod(output_path, statbuf.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
  if (res != 0) {
    fprintf(stderr, "setting access bits failed for [%s]: %s\n",
            PrintablePath(output_path), strerror(errno));
  }
  res = chown(output_path, (uid_t)-1, statbuf.st_gid);
  if (res != 0) {
    fprintf(stderr, "setting group failed for [%s]: %s\n",
            PrintablePath(output_path), strerror(errno));
  }
  res = chown(output_path, statbuf.st_uid, (gid_t)-1);
  if (res != 0) {
    fprintf(stderr, "setting user failed for [%s]: %s\n",
            PrintablePath(output_path), strerror(errno));
  }
}

/* Result ownership is passed to caller.
   |*dictionary_size| is set to resulting buffer size. */
static BROTLI_BOOL ReadDictionary(Context* context, Command command) {
  static const int kMaxDictionarySize =

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Use `--no-copy-stat` if available, or accept that permission bits will not be replicated.
  2. Write output to a filesystem that supports Unix permissions (ext4, xfs, etc.).
  3. Check SELinux/AppArmor logs if running under a mandatory-access-control system.
Defensive patterns

Strategy: fallback

Validate before calling

// Check if the output filesystem supports Unix permissions
#include <sys/vfs.h>
#include <stdbool.h>

bool fs_supports_chmod(const char *path) {
    struct statfs sfs;
    if (statfs(path, &sfs) != 0) return true; // assume yes on error
    // FAT, VFAT, exFAT, NTFS (some) don't honor chmod
    return sfs.f_type != 0x4d44 /* MSDOS */ &&
           sfs.f_type != 0x65735546 /* FUSE */;
}

// If false, pass --no-copy-stat to brotli (if supported) or accept warnings.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/b865f240dbace224. Report an issue: GitHub.