2 ms·
> Consider for example what should happen when grepping /dev/null/ In the solution I gave, same thing as before because I said regular file. That is if you can
by IgorPartola 9y ago
> Consider for example what should happen when grepping /dev/null/
In the solution I gave, same thing as before because I said regular file. That is if you can open /dev/null for reading, which I thought you couldn't.
I think I'd be fine with saying that the infinite loop is the behavior that happens. GNU's grep obviously is doing some janky check which it shouldn't be. Consider what it will do when you get just slightly more clever and it can't determine the input/output types. The one on macOS has arbitrary file size-dependent behavior, which is problematic. Doesn't seem like either of them does a consistent thing.