Skip to content

fix(fs): move a staged owner-only directory without a placeholder - #111

Merged
christianparpart merged 1 commit into
masterfrom
fix/owner-only-directory-no-placeholder
Nov 30, 2026
Merged

christianparpart merged 1 commit into
masterfrom
fix/owner-only-directory-no-placeholder

Conversation

@christianparpart

Copy link
Copy Markdown
Member

A staged CreationAccess::OwnerOnly directory (macOS, FreeBSD) reached its final name by renameat over an empty placeholder made under that name. A concurrent opener of the name could hold the placeholder, which the rename then unlinked; nothing could be created in what it opened (NoEntry). Isoline's racing key/cache creators hit this on macOS CI.

  • renameNoReplace (private, posix/PosixSystem.hpp): renameatx_np(RENAME_EXCL) on Apple, renameat2(RENAME_NOREPLACE) on Linux, ENOTSUP elsewhere.
  • createDirectoryStaged moves with it; only where the system or file system lacks one (FreeBSD) does it fall back to the placeholder, with the window documented.
  • The rename is injected into OwnerOnlyCreator (beside StatHandle), so the fallback and a failing move stay tested on Linux.
  • New [threading] case: an opener racing a staged creation must hold the directory left under the name. Before the fix it failed 176 of 256 rounds on Linux (staged); now it passes.

Consumer impact: none in the API (private header only). Behaviour: on macOS, concurrent creators of one owner-only directory now all see the final directory. Isoline re-vendors for it.

A staged CreationAccess::OwnerOnly directory (macOS, FreeBSD) reached its
final name by renameat over an empty placeholder made under that name. A
concurrent opener of the name could hold the placeholder, which the rename
then unlinked, so nothing could be created in what it opened (NoEntry).
Isoline's racing key and cache creators hit it on macOS.

The directory now moves with a rename that refuses an existing target
(renameNoReplace: renameatx_np(RENAME_EXCL) on Apple, renameat2's
RENAME_NOREPLACE on Linux, where the staged tests run), so the name names
nothing until it names the finished directory. Where the system or file
system has none (FreeBSD), the placeholder remains, documented. The rename
is injected into OwnerOnlyCreator so the fallback stays tested.

Signed-off-by: Christian Parpart <christian@parpart.family>
@christianparpart
christianparpart force-pushed the fix/owner-only-directory-no-placeholder branch from a01cb1e to f5955e3 Compare November 30, 2026 10:58
@christianparpart
christianparpart merged commit 43ebc3d into master Nov 30, 2026
72 of 75 checks passed
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Nov 30, 2026
core::fs moves a staged owner-only directory to its final name with a rename
that refuses an existing target (contour-terminal/core-cpp#111), so a racing
creator never opens a placeholder the rename then unlinks. That is what failed
Key.racingCreatorsAgree and DirectoryStorage.concurrentWritersAgree on macOS.

Signed-off-by: Christian Parpart <christian@parpart.family>
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Nov 30, 2026
core::fs moves a staged owner-only directory to its final name with a rename
that refuses an existing target (contour-terminal/core-cpp#111), so a racing
creator never opens a placeholder the rename then unlinks. That is what failed
Key.racingCreatorsAgree and DirectoryStorage.concurrentWritersAgree on macOS.

Signed-off-by: Christian Parpart <christian@parpart.family>
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Dec 2, 2026
core::fs's openHostFile (contour-terminal/core-cpp#109), which the tool's input reads need: a
user-named path opened as the host resolves it, links followed, and decided on its handle. v0.25.1
also moves a staged owner-only directory to its final name with a rename that refuses an existing
target (contour-terminal/core-cpp#111).

Signed-off-by: Christian Parpart <christian@parpart.family>
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Dec 2, 2026
core::fs's openHostFile (contour-terminal/core-cpp#109), which the tool's input reads need: a
user-named path opened as the host resolves it, links followed, and decided on its handle. v0.25.1
also moves a staged owner-only directory to its final name with a rename that refuses an existing
target (contour-terminal/core-cpp#111).

Signed-off-by: Christian Parpart <christian@parpart.family>
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Dec 2, 2026
core::fs's openHostFile (contour-terminal/core-cpp#109), which the tool's input reads need: a
user-named path opened as the host resolves it, links followed, and decided on its handle. v0.25.1
also moves a staged owner-only directory to its final name with a rename that refuses an existing
target (contour-terminal/core-cpp#111).

Signed-off-by: Christian Parpart <christian@parpart.family>
christianparpart added a commit to contour-terminal/isoline that referenced this pull request Dec 2, 2026
core::fs's openHostFile (contour-terminal/core-cpp#109), which the tool's input reads need: a
user-named path opened as the host resolves it, links followed, and decided on its handle. v0.25.1
also moves a staged owner-only directory to its final name with a rename that refuses an existing
target (contour-terminal/core-cpp#111).

Signed-off-by: Christian Parpart <christian@parpart.family>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant