Commit b2d64ec
test: refuse to test
* fix(test): skip fs_errors test when running as root
Root (uid=0) bypasses Unix discretionary access controls, so removing
read permissions with chmod has no effect. This causes the fs_errors
test to fail because read_dir() succeeds instead of returning
Permission denied. Skip the test with an explanatory message when
euid is 0.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* refactor(test): probe permissions instead of checking euid
Replace the `unsafe { libc::geteuid() }` check with a direct probe:
after chmod -r, try read_dir and skip if it still succeeds. This
removes the `unsafe` block and the `libc` dev-dependency while being
more semantically correct — it tests the actual condition we care
about rather than a proxy.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* Revert "refactor(test): probe permissions instead of checking euid"
This reverts commit bb8e8cc.
* fix(test): fail loudly on root with cfg escape hatch for fs_errors
Instead of silently skipping, panic with an actionable error message
when running as root. The test can be excluded entirely via
`RUSTFLAGS='--cfg pdu_test_skip_fs_errors'` for environments like
Claude Code Web where root is unavoidable.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* docs: improve error message
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix(test): allow unexpected_cfgs for pdu_test_skip_fs_errors
Suppress the -D unexpected-cfgs error by adding #[allow(unexpected_cfgs)]
before the custom cfg gate.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* fix(test): register pdu_test_skip_fs_errors in check-cfg
The #[allow(unexpected_cfgs)] approach doesn't override -D warnings
used in CI release builds. Register the custom cfg in Cargo.toml's
[lints.rust] section instead, which properly declares it as a known
cfg to the compiler.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* style(cargo): move [lints.rust] section after [dev-dependencies]
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* fix(test): gate fs_errors imports and helper with pdu_test_skip_fs_errors
Gate the Unix-specific imports and fs_permission helper with
cfg(all(unix, not(pdu_test_skip_fs_errors))) so they don't produce
dead code warnings when the test is skipped.
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* style(test): use separate cfg attributes instead of cfg(all(...))
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
* fix(cargo): pin libc to exact patch version for consistency
https://claude.ai/code/session_01Ki7wbrgQXWs2GXf8h2hybQ
---------
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>fs_errors on root environments (#364)1 parent d27c20b commit b2d64ec
3 files changed
Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
| 16 | + | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
| |||
23 | 25 | | |
24 | 26 | | |
25 | 27 | | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| |||
106 | 110 | | |
107 | 111 | | |
108 | 112 | | |
| 113 | + | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
| |||
0 commit comments