You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs.stat: a symlink's size is its stored object length (target + 27 bytes); is the target length intended? #447
fs.stat reports a symlink's size as the length of the canonical object that stores its target, not as the target's length. That object holds the target plus the object envelope (LFSO, 13 bytes) and the symlink header (LFS4LNK, 14 bytes), so every symlink comes out 27 bytes too large. A mounted Workspace reports the target's length, and so does the source folder Init read from, which means the SDK and the mount disagree about the same symlink.
Repro
Run on Linux against current main (c77281e49) with the real addon and a Disposable Store. Init a folder holding link -> a.txt and dangling -> /does/not/exist, then call:
ls -l in the source folder shows 5 and 15. Under a real FUSE mount (the kernel_mount fixture's five symlinks), lstat size equals the readlink length for each one.
Cause
For InodeKind::Symlink, size() in layerfs-store-service/src/read/snapshot.rs returns read_canonical(content_root).len(). The Workspace base view does it differently: stat_resolved_with_lengths in layerfs-workspace/src/base/view.rs decodes the object with SymlinkTarget::decode and uses as_bytes().len(), and the FUSE attributes take that value. The operator file history and stats also call size(), so they count symlinks 27 bytes too large as well.
v0.1.6 reported a symlink's size as its target's length: crates/layerfs-workspace-core/src/lib.rs#L108 at reference-v0.1.6-final has Data::Symlink(target) => (Kind::Symlink, target.len() as u64).
Fixed on main by 3828268 (merge of #448): fs.stat now reports a symlink's size as its target length, the same as lstat in a mounted Workspace. The operator storage and revision answers count symlinks the same way.
Activity
leepokai commentedon Oct 24, 2026
Two more data points, both from the repository's history:
fs.statwas ported from thesdk_simprototype in SDK redesign (JS-only over a Rust implementation by group/method), commit-time merge and conflicts, and live wiring of the sdk-sim-terminals UI #327 (7d). There the size is the content length:sdk_sim/model.js#L566returnssize: (e.content || "").length. The prototype has no symlinks at all, so it never defined a symlink's size.crates/layerfs-workspace-core/src/lib.rs#L108atreference-v0.1.6-finalhasData::Symlink(target) => (Kind::Symlink, target.len() as u64).Merge #448: Report a symlink's target length as its fs.stat size (#447)
yifanxuaaa commentedon Oct 26, 2026
Fixed on main by 3828268 (merge of #448):
fs.statnow reports a symlink's size as its target length, the same aslstatin a mounted Workspace. The operator storage and revision answers count symlinks the same way.