Skip to content

tests: attribute scratch-file creations to the test's own process tree - #560

Closed
luisleo526 wants to merge 4 commits into
mainfrom
tests/scratch-watch-attribution
Closed

luisleo526 wants to merge 4 commits into
mainfrom
tests/scratch-watch-attribution

Conversation

@luisleo526

Copy link
Copy Markdown
Collaborator

tests: attribute scratch-file creations to the test's own process tree and print the creator pid

test_default_scratch_tmpfs_tmpdir failed on a shared CI VM when another runner's
job created pineforge-* names in a shared temp root. At this base the default
test already uses a private TMPDIR and checks its own mkstemp descriptors, but
the witness (a) dropped creations by the test's fork descendants, (b) ignored
exclusive opens outside the private TMPDIR and (c) printed paths without any
creator identity, so a false positive could not be diagnosed from the log.

  • The witness is an anonymous shared mapping inherited by fork descendants:
    creation path and creator pid are recorded by the interposed mkstemp and
    O_CREAT|O_EXCL open, after checking the returned descriptor's own
    /proc/self/fd name. No named file or endpoint a stranger could write to.
  • Failures print path and pid, or "pid=unattributable" with the reason when
    only inotify saw it (inotify supplies no creator pid). Overflow, truncation
    and incomplete publication fail instead of reading as "nothing created".
  • The three co-tenant rows now fork+exec a separate shell helper before the
    watches exist (released over a pipe once armed), creating names in /tmp,
    /dev/shm and /var/tmp.
  • New rows: own exclusive open in /tmp is detected with path and pid, own fork
    descendant's creations are detected and attributed, diagnostics contain
    path+pid and the unattributable reason.
  • scripts/ci_verify.py / test_ci_verify.py and docs/ci.md: row-count
    accounting for the three added public rows.

No engine source or public header changes.

🤖 Generated with Claude Code

luisleo526 and others added 4 commits October 28, 2026 02:00
…e and print the creator pid

test_default_scratch_tmpfs_tmpdir failed on a shared CI VM when another runner's
job created pineforge-* names in a shared temp root. At this base the default
test already uses a private TMPDIR and checks its own mkstemp descriptors, but
the witness (a) dropped creations by the test's fork descendants, (b) ignored
exclusive opens outside the private TMPDIR and (c) printed paths without any
creator identity, so a false positive could not be diagnosed from the log.

- The witness is an anonymous shared mapping inherited by fork descendants:
  creation path and creator pid are recorded by the interposed mkstemp and
  O_CREAT|O_EXCL open, after checking the returned descriptor's own
  /proc/self/fd name. No named file or endpoint a stranger could write to.
- Failures print path and pid, or "pid=unattributable" with the reason when
  only inotify saw it (inotify supplies no creator pid). Overflow, truncation
  and incomplete publication fail instead of reading as "nothing created".
- The three co-tenant rows now fork+exec a separate shell helper before the
  watches exist (released over a pipe once armed), creating names in /tmp,
  /dev/shm and /var/tmp.
- New rows: own exclusive open in /tmp is detected with path and pid, own fork
  descendant's creations are detected and attributed, diagnostics contain
  path+pid and the unattributable reason.
- scripts/ci_verify.py / test_ci_verify.py and docs/ci.md: row-count
  accounting for the three added public rows.

No engine source or public header changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nd docs

Comment and documentation wording only: six added lines named a tracking id.
They now describe the change in plain words. No code, no count and no line
position changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Printed text only: the scratch lstat line began with an internal tag. It now
reads "owned scratch lstat: ...". Nothing parses that line and no code path
changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@luisleo526

Copy link
Copy Markdown
Collaborator Author

Closing: this change is being remade as one clean commit on the current main (each commit's message must name the sentences it removes), and will be opened as a new PR.

@luisleo526

Copy link
Copy Markdown
Collaborator Author

Superseded by #584.

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