diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-30 17:00:49 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-30 17:00:49 +0300 |
| commit | d071a75f44bc14dce364142483b072272c81313e (patch) | |
| tree | d07851904ed25d04465a00115051ab16f3a5ebeb /internal/eventloop_bytes_test.go | |
| parent | 2e018ccde462cd9083cfaf9e74c50cec19518815 (diff) | |
test(getcwd): lock in KindNull enter + exit-time cwd resolution
Audit of the getcwd(2) tracing path. getcwd's args[0] is a char *buf
OUTPUT buffer: the kernel writes the absolute cwd path into it and the
contents are only valid AFTER the syscall returns. Reading it at enter
would capture an empty/garbage string, so getcwd is correctly KindNull
at enter and the cwd is resolved at EXIT from /proc/<tid>/cwd when the
return value is positive (handleNullExit). Family FS, docs and drift
tests already aligned; no behavior change required.
Add lock-in tests pinning the correct behavior:
- generate: strengthen TestClassifyNullGetcwd to assert the enter kind
is never KindPathname/KindName and no pathname field is captured;
add TestClassifyByFieldGetcwdBufNotPath proving the generic field
classifier never treats char *buf as a path (defense-in-depth).
- eventloop: add GetcwdFailureEventTest asserting that a failed getcwd
(negative errno, e.g. -ERANGE) attaches no cwd path, and document the
output-buffer nuance in the success-case test.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to 'internal/eventloop_bytes_test.go')
0 files changed, 0 insertions, 0 deletions
