Skip to main content

Module atomic_fs

Module atomic_fs 

Source
Expand description

Shared, policy-free atomic-write mechanics.

Both the config installer (crate::config_io) and the edit tools (crate::tools::edit_io) need the same durable write dance: a same-directory temp file + rename, with an in-place-overwrite fallback when the directory is read-only but the file inode is writable (#459). Only the mechanism lives here — one audited implementation. The differing policy stays in each caller:

  • edit_io rejects symlinks (reject_symlink + O_NOFOLLOW) and guards TOCTOU/read-only-roots before calling in;
  • config_io resolves a user-managed symlink to its real target (within $HOME) and then writes through to it.