Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot grep special devices such as /dev/urandom #887

Closed
kenorb opened this issue Apr 15, 2018 · 1 comment
Closed

Cannot grep special devices such as /dev/urandom #887

kenorb opened this issue Apr 15, 2018 · 1 comment
Labels
bug A bug. wontfix A feature or bug that is unlikely to be implemented or fixed.

Comments

@kenorb
Copy link

kenorb commented Apr 15, 2018

What version of ripgrep are you using?

ripgrep 0.8.1

What operating system are you using ripgrep on?

macOS High Sierra

Bug

This works:

$ rg . </etc/hosts
##
# Host Database

This doesn't:

$ rg . < /dev/urandom

or more practical example:

$ rg -uuu -o abc < /dev/urandom

It seems it fallback into searching the current folder.

However this syntax work:

$ cat /dev/urandom | rg -uuu -o abc

I believe it should work similar as other tools, e.g.

$ strings </dev/urandom | head
Q)CD
h`m3
+xRF:?
$ grep . </dev/urandom # GNU grep
Binary file (standard input) matches
@BurntSushi BurntSushi added bug A bug. wontfix A feature or bug that is unlikely to be implemented or fixed. labels Apr 15, 2018
@BurntSushi
Copy link
Owner

This is a bug, but I do not believe it can be fixed in a way that doesn't produce more serious bugs. The simplest work-around is to create a pipe: cat /dev/urandom | rg ..

See also:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug. wontfix A feature or bug that is unlikely to be implemented or fixed.
Projects
None yet
Development

No branches or pull requests

2 participants