31 lines
877 B
Markdown
31 lines
877 B
Markdown
# Test Case: Broken Symlink
|
|
|
|
**Test ID**: TC040-symlink-broken
|
|
|
|
## Objective
|
|
|
|
Verify `readlink(2)` succeeds for a deterministic broken link while following
|
|
the target fails with exact `ENOENT`.
|
|
|
|
## Fixture
|
|
|
|
Use `images/inline.erofs` and `source/inline/brokenlink`. Evidence asserts
|
|
symlink mode, layout 2, and target length 29.
|
|
|
|
## Procedure
|
|
|
|
```sh
|
|
test -L "$mnt/brokenlink"
|
|
readlink /tmp/repo22-g1/source/inline/brokenlink > /tmp/tc040-source-target
|
|
readlink "$mnt/brokenlink" > /tmp/tc040-mount-target
|
|
cmp /tmp/tc040-source-target /tmp/tc040-mount-target
|
|
./read_probe expect-error "$mnt/brokenlink" 2
|
|
./read_probe expect-error "$mnt/brokenlink" 2
|
|
```
|
|
|
|
## Expected Results
|
|
|
|
- Both `readlink` targets equal `/nonexistent/repo22-g1-target`.
|
|
- Both follow attempts return errno 2 (`ENOENT`), while the symlink itself
|
|
remains visible; no kernel error or cleanup failure occurs.
|