logoalt Hacker News

wewewedxfgdftoday at 9:55 AM6 repliesview on HN

I was using ripgrep once and it had a bug that led me downa terrifying rabbit hole - I can't recall what it was but it involved not being able to find text that absolutely should have been there.

Eventually I was considering rebuilding the machine completely but for some reason after a very long time digging deep into the rabbit hole I tried plain old grep and there was the data exactly where it should have been.

So it's such a vague story but it was a while back - I don't remember the specifics but I sure recall the panic.


Replies

postalcodertoday at 11:22 AM

idk if this was your issue but I’m posting this because it’s not obvious (especially the default behavior):

  rg      : Searches git tracked files
  rg -u   : Includes .gitignored files
  rg -uu  : Includes .gitignored + hidden files
  rg -uuu : Includes .gitignored + hidden + binary files
QuantumNomad_today at 10:04 AM

Was it confirmed to be a bug?

Sometimes I forget that some of the config files I have for CI in a project are under a dot directory, and therefore ignored by rg by default, so I have to repeat the search giving the path to that config files subdirectory if I want to see the results that are under that one (or use some extra flags for rg to not ignore dot directories other than .git)

show 1 reply
RichardLaketoday at 10:06 AM

Was the file in a .gitignore by any chance? I've got my home folder in git to keep track of dot/config files and that always catches me out. Really dislike it defaulting to that ignoring files that are ignored by git.

kelipsotoday at 10:37 AM

I had that happen too recently… Basically rg x would show nothing but grep -r x showed the lines for any x. Tried multiple times with different x, then I kept using grep -r at that time. After a few days, I started using rg again and it worked fine but now I tend to use grep -r occasionally too to make sure.

show 2 replies
mijoharastoday at 1:20 PM

Could have been an incorrectly inferred encoding scheme?

I ran into that with pt, and it definitely made me think I was going mad[0]. I can't fully remember if rg suffered from the same issue or not.

[0] https://github.com/monochromegane/the_platinum_searcher/issu...

nikbackmtoday at 10:42 AM

Maybe related to text encodings?

I think riggrep will not search UTF-16 files by default. I had some such issue once at least.