Skip to content

fix: index followed file symlinks in zlob walker (#912) - #913

Merged
dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-912
Oct 10, 2026
Merged

dmtrKovalenko merged 1 commit into
mainfrom
triage-bot/issue-912

Conversation

@gustav-fff

@gustav-fff gustav-fff commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #912

Root cause

zlob keeps kind = Symlink and lstat metadata for followed links (zlob-1.6.5/zig-src/walker/worker.zig:422, only is_dir is resolved for descent). crates/fff-core/src/walk/zlob.rs:55 keeps only entry.is_file(), so with follow_symlinks = true every symlink to a file is dropped. Ripgrep walker resolves the target type, so non-zlob builds work. Release builds use zlob.

Fix

For Symlink entries when follow_symlinks is on, std::fs::metadata the target; index it if it is a regular file, with target size/mtime. Broken links and dir links are skipped here (dir links are already descended by zlob, parents are synthesized at file_picker.rs:2288). Regular-file hot path unchanged; extra stat only for symlinks and only with follow_symlinks.

Steps to reproduce

On pre-fix main:

cargo build --release -p fff-nvim --no-default-features --features zlob
cat > /tmp/repro912.lua <<'LUA'
vim.opt.rtp:prepend(arg[1])
local tmp = vim.fn.tempname()
vim.fn.mkdir(tmp .. '/.dotfiles/sesh', 'p')
vim.fn.mkdir(tmp .. '/config/sesh', 'p')
vim.fn.writefile({ 'a = 1' }, tmp .. '/.dotfiles/sesh/sesh.toml')
vim.fn.writefile({ 'b = 1' }, tmp .. '/.dotfiles/sesh/configs.toml')
vim.fn.writefile({ 'c = 1' }, tmp .. '/config/sesh/projects.toml')
vim.uv.fs_symlink('../../.dotfiles/sesh/sesh.toml', tmp .. '/config/sesh/sesh.toml')
vim.uv.fs_symlink('../../.dotfiles/sesh/configs.toml', tmp .. '/config/sesh/configs.toml')
local rust = require('fff.rust')
rust.init_file_picker(tmp .. '/config/sesh', { follow_symlinks = true })
rust.wait_for_initial_scan(10000)
local res = rust.fuzzy_search_files('', 1, nil, 100, nil, 0, 100)
local names = {}
for _, item in ipairs(res.items) do table.insert(names, item.relative_path) end
table.sort(names)
print('indexed: ' .. table.concat(names, ', '))
rust.cleanup_file_picker()
vim.fn.delete(tmp, 'rf')
LUA
(cd /tmp && nvim -l /tmp/repro912.lua "$OLDPWD")
expected: indexed: configs.toml, projects.toml, sesh.toml
actual:   indexed: projects.toml

Same with default (ripgrep) build gives the expected output.

How verified

  • New test walk::tests::follows_file_symlinks_outside_root (file link outside root, dir link, broken link, follow on/off). Pre-fix zlob: left: ["linked/inner.toml", "projects.toml"], fails. Post-fix: passes on zlob and ripgrep backends.
  • Repro script above after fix: indexed: configs.toml, projects.toml, sesh.toml.
  • make test-rust: 528 passed, 0 failed. make lint-rust clean, cargo fmt --check clean.

Automated triage via Gustav. Honk-Honk 🪿

Summary by CodeRabbit

  • New Features
    • File traversal now includes symlinks to files when symlink following is enabled, including links to files outside the traversal root.
    • Linked files use their target’s size and modification time for indexing.
  • Bug Fixes
    • Broken symlinks and links to non-file targets are skipped.

zlob reports followed symlinks with the Symlink kind and lstat metadata,
so the zlob walker dropped every symlink that resolves to a file even
with follow_symlinks on. Stat the target and index it as a file.

Closes #912

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6b1208f9-5173-41aa-91c3-a086f9a16bed

📥 Commits

Reviewing files that changed from the base of the PR and between 65119f9 and b4e99a5.


📒 Files selected for processing (2)
  • crates/fff-core/src/walk/mod.rs
  • crates/fff-core/src/walk/zlob.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The zlob walker now indexes file symlinks when symlink following is enabled. A Unix-only test covers linked files, directory links, broken links, and behavior when following is disabled.

Changes

Symlink traversal

Layer / File(s) Summary
Followed symlink indexing
crates/fff-core/src/walk/zlob.rs
The walker reads target metadata for followed file symlinks and uses their relative-path basename for binary-extension detection. It skips links with unreadable or non-file targets.
Symlink traversal test
crates/fff-core/src/walk/mod.rs
A Unix-only test checks that followed file and directory symlinks are indexed, broken links are excluded, and disabling symlink following excludes linked entries.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: dmtrkovalenko


Merge Risk: ⚪ Minimal · up to b4e99

Symlinks that resolve to files are now indexed when symlink following is enabled. No merge-blocking risk was identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: indexing followed file symlinks in the zlob walker.
Linked Issues check Passed Issue #912 requires file symlinks to appear when follow_symlinks is enabled in the zlob build. crates/fff-core/src/walk/zlob.rs now stats followed symlink targets, indexes regular-file targets, an…
Out of Scope Changes check Passed The changes stay within #912. The zlob fix changes only followed-symlink file collection. The added test verifies the reported behavior and does not introduce unrelated product changes.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.


✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dmtrKovalenko
dmtrKovalenko merged commit 7796436 into main Oct 10, 2026
61 of 62 checks passed
wpenistone pushed a commit to wpenistone/fffork that referenced this pull request Oct 13, 2026
…mtrKovalenko#913)

zlob reports followed symlinks with the Symlink kind and lstat metadata,
so the zlob walker dropped every symlink that resolves to a file even
with follow_symlinks on. Stat the target and index it as a file.

Closes dmtrKovalenko#912

Co-authored-by: Dmitriy Kovalenko <dmitriy@iusevimbtw.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: follow symlinks zlob variant

2 participants