Skip to content

Commit 53c9a49

Browse files
committed
docs(mistakes): ripgrep -r is --replace, not recursive (the -rn footgun)
1 parent e5b7b4d commit 53c9a49

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

MISTAKES.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,14 @@ exact-match approach above, building green before each commit.
136136
- **jpegz `linkSystemLibrary("jpeg"/"openjp2")` is unconditional** → blocks
137137
mingw `-static` cross. Real fix = Zig-vendor the C libs (option A), not nix
138138
static-mingw overrides.
139+
140+
## 2026-06-13 — `rg -rn``grep -rn` (self-inflicted "mangling")
141+
Typed `rg -rn "pat" file` out of grep muscle memory. In ripgrep `-r` is
142+
`--replace REPLACEMENT` (NOT recursive — rg recurses by default), so `-rn`
143+
parsed as `--replace=n`: every match was substituted with the literal "n".
144+
Spent real cycles misattributing this to codescan, then to Claude Code's
145+
Bash parser, before a hexdump of redirected output proved rg itself wrote
146+
the "n" — and `rg --help` showed `-r REPLACEMENT`. Lesson: for ripgrep use
147+
`rg -n` (or `--no-filename`/`-l` etc.); NEVER `-r` unless you actually want
148+
match replacement. When output looks corrupted, hexdump the bytes before
149+
blaming a tool — and check your own flags first.

0 commit comments

Comments
 (0)