Repository navigation
Description
Three differences from the real tools where rtk's answer is not merely shorter — it is the opposite verdict.
Provenance: AI-assisted source audit, human-directed, at v0.44.2 (700bdde). All three run side by side against the real GNU tools on this machine; outputs verbatim.
1. A binary-file match is reported as "not found"
$ printf 'AKIA_SECRET\x00binary\n' > creds.bin
$ grep -rn AKIA creds.bin ; echo "exit=$?"
Binary file creds.bin matches
exit=0
$ rtk grep -rn AKIA creds.bin ; echo "exit=$?"
exit=1
src/cmds/system/search.rs:291 injects -I (--binary-files=without-match), which the user did not ask for. That suppresses the match — and because grep's exit 1 is the canonical "pattern not found", rtk asserts the opposite of the truth.
This matters most for the case people actually use grep's exit code for: if rtk grep -q AKIA . ; then now takes the wrong branch. A secret sitting in a .bin, a compiled artefact, or any file with a stray NUL is reported as absent, with a success-shaped exit.
-rl and -rc are unaffected (they still list creds.bin), so the mode that inverts is the plain search. Passing -a explicitly does restore the match.
2. A search root that does not exist returns exit 0
$ find /nope/nothere ; echo "exit=$?"
find: '/nope/nothere': No such file or directory
exit=1
$ rtk find /nope/nothere ; echo "exit=$?"
exit=0
Empty stdout, empty stderr, success. src/cmds/system/find_cmd.rs:232-235 does Err(_) => continue on walk errors, so "this path does not exist" and "this path exists and contains nothing" become the same answer — and the exit code affirms the search worked.
A typo'd path, a directory removed between steps, or a wrong assumption about the tree all read as "searched successfully, nothing there".
3. Files under hidden directories are invisible
$ find . -name '*.yml'
./.github/workflows/ci.yml
$ rtk find . -name '*.yml'
(nothing, exit 0)
find_cmd.rs:216-223 sets .hidden(!pattern.starts_with('.')), so any path component beginning with . is skipped unless the pattern itself starts with a dot. .github/, .circleci/, .config/, .vscode/ and their contents are unreachable.
Correcting something in my own reporting: I initially believed gitignored files were also invisible, because that walker sets .git_ignore(true) as well. They are not — in the same repository, with .gitignore containing *.log and secrets.txt, both rtk find . -name '*.log' → app.log and rtk find . -name 'secrets.txt' → secrets.txt returned their files normally. Only the hidden-path filter is live. I am flagging the correction because I nearly filed the wider claim.
Why these three together
All three share a shape: rtk answers a question with a confident negative that the underlying tool would have answered positively, and the exit code backs the wrong answer up. An agent has no way to distinguish "rtk searched and found nothing" from "rtk declined to look".
Suggested directions (untested — no programmer has reviewed these)
- Do not inject
-I. If binary output is genuinely unwanted in the summary, keep grep's ownBinary file … matchesline and its exit status — that line is one token and carries the whole answer. - Surface walk errors: report the failing root and exit non-zero, rather than
continue. Distinguishing "not found" from "could not look" is the entire value of the exit code here. - Either honour hidden paths by default (real
finddoes) or state the exclusion in the output, the way the+N moremarker does for the result cap.--hiddenis currently rejected as an unknown flag, so there is no way to ask for them.
Two smaller ones from the same comparison
rtk finddrops the trailing newline on its last line. With a final result ofไฟล์ไทย.txt, output endsไฟล์ไทย.txtwith no\n, so it concatenates with whatever prints next. Any$(rtk find …)piped intowhile readloses or corrupts the last entry.- Error messages name a binary that does not exist.
rtk grep -rn X /nopereports/usr/bin/grep: C:/Program Files/Git/nope: No such file or directory— the path in the message is not the path passed, and/usr/bin/grepis not a path on this machine. Exit code 2 is correct; the diagnostic sends the reader to the wrong file.
Activity
pszymkowiak commentedon Aug 4, 2026
🔍 Automated Triage
bughighSummary
rtk grep injects unrequested -I causing binary matches to report exit 1 (not found); rtk find swallows missing-root walk errors as exit 0 and hides all paths under dot-directories by default — fix search.rs:291 and find_cmd.rs:216-235 to preserve correct exit codes and hidden-path visibility.
📁 Relevant files
src/cmds/system/search.rssrc/cmds/system/find_cmd.rsTriaged automatically by wshm · This is an automated analysis, not a human review.
HetCreep commentedon Aug 30, 2026
Re-verified at
develop@0de9610, with runs rather than reading. Two of the bullets in my original report were wrong and I am retracting them. The three claims in the issue title are still live.Provenance: AI-assisted source audit, human-directed, at
develop@0de9610. All five sub-claims were executed against a binary built from this commit.Retracted — these were never rtk defects
grep -n -H -I --null -e X -- /nope) emits the byte-identical/usr/bin/grep: …: No such file or directory. That is Git-for-Windows / MSYS2 path translation plus grep's ownargv[0]; rtk forwards it verbatim. My report attributed it to rtk. It should not have been in the issue.if rtk grep -q AKIA .does not reproduce.-qis classified as a format flag (search.rs:779) and routed to passthrough without the injected-I, so it correctly returns exit 0. The exit-code inversion is real but confined to the plain and-rnsearch modes — my example picked the one mode where it does not happen.Fixed since the report
The trailing-newline concatenation is repaired; output now goes through
println!and a{ rtk find …; echo NEXTLINE; }}marker test shows no concatenation.Still live
-Istill inverts the verdict on a binary match:rtk grep -rn AKIA creds.binexits 1 wheregrep -rn AKIA creds.binprintsBinary file creds.bin matchesand exits 0.rtk find /nope/notherestill exits 0 with no output. Theexists()guard added atfind_cmd.rs:416is inert for this input, because dispatch treats a first token that is not an existing directory as the pattern, sopathsends up empty and the search root defaults to".", which exists. Confirmed for/nope/nothere,/nope/nothere -name '*.yml', andnosuchdir -name '*.yml'.rtk find . -name '*.yml'returns nothing where real find returns./.github/workflows/ci.yml, and no--hiddenflag exists.One thing my report understated: the silent-success case is broader than the missing-path example.
Err(_) => continuein the walk plus a hardcoded0exit also swallows mid-walk errors such as permission-denied or a subtree vanishing, even when theexists()precheck does fire.HetCreep commentedon Sep 16, 2026
Re-checked this against
develop@5e0f92c, verified by reading the code at this commit (not by building or running it this pass). Status below, item by item. Short version: 2 and 4 are fixed, 5 is an environment artifact rather than an rtk bug, but 1 and 3 are both still open — please don't close this issue.1.
grepon a binary match reports "not found" — still open, unchanged.search.rs:406-411still returns-Iunconditionally forEngine::Grep:applied at
search.rs:434(cmd.args(engine.parse_flags());) before any user-supplied flags at:435-437. Diffed this exact block against the0de9610state cited in the original report — no change at all.-Iis grep's own--binary-files=without-match, so a match that lives inside a binary file is still silently skipped:rtk grepprints nothing and exits 1, where real grep printsBinary file <name> matchesand exits 0.2.
findon a missing search root reports "success" — fixed, fine to close this part.find_cmd.rs:415-418now checks the path explicitly before walking:and it's actually reachable now, because
find_cmd.rs:81-83'slooks_like_pathroutes any slash-bearing token into the path branch regardless of whether it exists (previously a nonexistent path with a separator got read as an RTK-namepattern, silently defaulting the search root to.). This landed in765b270and68dc719— both commit-tagged "Fixes #3851", a different issue about the same missing-path symptom — so it reads as an independent fix rather than a response to this report. Crediting the actual commits, not claiming it, but thank you either way — this half is closed.3.
findhides files under hidden/gitignored directories — improved, but please don't close.The gate itself hasn't moved:
find_cmd.rs:459(let search_hidden = pattern.starts_with('.');) and:463(.hidden(!search_hidden)) are unchanged. What's new isdisclose_filtered(find_cmd.rs:558-599, also added by765b270/refined by68dc719— so this mitigation traces to the same #3851 work, not to this issue either), which now surfaces a "results were filtered" note instead of dropping them with no trace — a real improvement. But it only enumerates the immediate children of directories the ignore-walker itself visited, and a hidden directory is never visited, so nothing underneath it, at any depth, is named this way — only a trailing-slash marker for the hidden directory itself. So, e.g., a match at.github/workflows/ci.ymlstill can't be surfaced throughrtk findin any form: the walker never visits.github/, so the disclosure can say.github/at most, never the file inside it. This is confirmed as intended design, not an oversight — the project's own test atfind_cmd.rs:1372-1410(hidden_and_ignored_matches_are_collected_for_disclosure) builds a fixture with.hidden/h.txtand asserts:h.txtis asserted to never appear, at any nesting depth, not just the shallow case in the original report. There's also no opt-out —--hidden/show_hiddendon't appear anywhere infind_cmd.rs. Please leave this open: the actual matching file is still never nameable.4.
finddrops the trailing newline — fixed, fine to close this part.The final print for
findoutput goes throughemit_guarded(find_cmd.rs:739→runner.rs:22), andrunner.rs:22'sprintln!("{}", shown)is unconditional — Rust'sprintln!always appends a newline — so the trailing newline is present regardless of the internal trim/repush dance atfind_cmd.rs:389/:729. Matches realfindnow.5.
greperror names the wrong binary/path — unchanged, but not an rtk defect.search.rsstill relays the child process's stderr verbatim (eprint!("{}", result.stderr)at three call sites, e.g.:575-576), so whatever the wrappedgrepbinary itself reports — its own MSYS name and Git-for-Windows path translation — is what shows through. That's the wrapped binary's own environment behavior, not something rtk generates. Same as originally reported; not something we think needs an rtk-side fix.Net: this stays a (C) correctness/conformance issue — an agent or script trusting rtk's exit code or output shape, not an exploitable path — same framing as the original report. But 1 and 3 are both still live, so please keep this open.
HetCreep commentedon Oct 14, 2026
Re-checked on v1.0.0 (stable, 2026-10-13): the official release binary plus the v1.0.0 source. Provenance: AI-assisted check, human-directed. "ran" = executed against
rtk 1.0.0with a control; "read" = verified from source only.Fixed (ran): a missing find root.
rtk find /nope/notherenow exits 1 withfind: '/nope/nothere': No such file or directory. Hidden files are no longer fully invisible:rtk find . -name '*.yml'prints... (1 filtered)and[+1 hidden: rtk recall X]. Thanks.Still live (ran vs
/usr/bincontrols):grep -rn AKIA creds.bin-> GNU exit 0Binary file creds.bin matches;rtk grep -rn AKIA creds.bin-> exit 1, empty (-q,-cand-rldo find it, so only the plain mode inverts).rtk find nope -name xexits 0 silently; GNUfindexits 1No such file or directory.rtk recallas the directory name (.github/), not as a path;--hiddenis still rejected.Not re-checked: the trailing-newline claim and the error-path message.