Commit 6460160
Fix EACCES error in chmod_recursive during cleanup
The condition `isdir(path) && !islink(path)` calls `isdir` first,
which uses `stat()` and follows symlinks. In overlay upper directories,
symlinks created inside the sandbox (e.g. Claude Code task output files)
point to paths like `/root/.claude/...` that are inaccessible from the
host (the host user can't traverse `/root/`). `stat()` follows the
symlink and fails with EACCES.
Fix by checking `!islink(path)` first. `islink` uses `lstat()` which
operates on the symlink itself without following it, so it succeeds.
When `islink` returns true, short-circuit evaluation skips the `isdir`
call entirely, avoiding the EACCES error.
Fixes Keno/ClaudeBox.jl#24
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 4ee7018 commit 6460160
2 files changed
+26
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
8 | 33 | | |
9 | 34 | | |
10 | 35 | | |
| |||
0 commit comments