Skip to content

feat(rg): follow symlink search paths - #1675

Merged
chaliy merged 1 commit into
mainfrom
2026-05-22-rg-follow
May 22, 2026
Merged

chaliy merged 1 commit into
mainfrom
2026-05-22-rg-follow

Conversation

@chaliy

@chaliy chaliy commented May 22, 2026

Copy link
Copy Markdown
Contributor

What

Add real rg-style symlink handling for rg: explicit symlink file/directory paths are searched, and recursive directory entries are followed when -L/--follow is set. --no-follow restores the default behavior.

Why

Previously -L/--follow was accepted as a no-op, so recursive searches missed symlinked files and directories that real ripgrep includes.

How

  • Track logical display paths separately from actual read paths during recursive walks.
  • Resolve explicit symlink paths before classifying them as files or directories.
  • Follow symlink entries during recursive walks only when follow mode is enabled, with ancestor checks to avoid cycles.
  • Disable indexed search when follow mode is enabled so symlink traversal stays faithful to the VFS walk.
  • Add data-driven real-rg differential symlink cases.

Risk

  • Medium
  • Recursive rg now reads symlink targets under -L; cycle handling and VFS path resolution are covered by new differential tests and existing security tests.

Checklist

  • Tests added or updated
  • Backward compatibility considered

Validation:

  • cargo test -p bashkit --lib builtins::rg::tests -- --nocapture
  • just pre-pr

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bashkit 8a2ad3b Commit Preview URL May 22 2026, 12:45 PM

@chaliy
chaliy merged commit ee2f4db into main May 22, 2026
41 of 44 checks passed
@chaliy
chaliy deleted the 2026-05-22-rg-follow branch May 22, 2026 13:08
chaliy added a commit that referenced this pull request May 30, 2026
## What
Add real rg-style symlink handling for `rg`: explicit symlink
file/directory paths are searched, and recursive directory entries are
followed when `-L`/`--follow` is set. `--no-follow` restores the default
behavior.

## Why
Previously `-L`/`--follow` was accepted as a no-op, so recursive
searches missed symlinked files and directories that real ripgrep
includes.

## How
- Track logical display paths separately from actual read paths during
recursive walks.
- Resolve explicit symlink paths before classifying them as files or
directories.
- Follow symlink entries during recursive walks only when follow mode is
enabled, with ancestor checks to avoid cycles.
- Disable indexed search when follow mode is enabled so symlink
traversal stays faithful to the VFS walk.
- Add data-driven real-rg differential symlink cases.

## Risk
- Medium
- Recursive rg now reads symlink targets under `-L`; cycle handling and
VFS path resolution are covered by new differential tests and existing
security tests.

## Checklist
- [x] Tests added or updated
- [x] Backward compatibility considered

Validation:
- `cargo test -p bashkit --lib builtins::rg::tests -- --nocapture`
- `just pre-pr`
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.

1 participant