Project
ADR-001 — lookup never follows a symbolic link, getattr does
- **Status**: Accepted (11 November 2026)
- **Requirements**: FS-08 (symlinks, loop detection), FS-02 (`stat` fields), QNX-01 (a resource manager answers `lstat` and `stat` differently)
- **Code**: [`rmfs/include/pgw/rmfs.h`](../../rmfs/include/pgw/rmfs.h) (the convention, in the header comment), [`rmfs/src/path.c`](../../rmfs/src/path.c)
- **Proof**: `test_rmfs_path` — `test_symlink_yields_redirect`, `test_symlink_follow_when_asked`, `test_symlink_loop_detected`, `test_readlink_returns_body`, `test_open_nofollow_refuses_symlink`
Context
On QNX, path resolution is resumed by the <em>client</em>: when a path component is a symbolic link, the resource manager answers with a redirect (_RESMGR_REDIRECT) and the caller walks the target itself. For that to work, the layer-3 walk must <em>see</em> the link.
The backend interface of layer 3 exposes two attribute calls, lookup and getattr. The first draft of the interface did not say which one follows a final symbolic link, and the two sides of the tree answered differently: rmfs assumed one convention, the POSIX truth backend and the 9P adapter assumed the other. The observable result was that lstat on a link loop answered ELOOP while stat on the same path answered OK — inverted — and FS-08 (loop detection) was unreachable, because the walk never met a link to redirect on.
The defect was found by <em>running</em> the differential bench (