regexgitgrepsegmentation-fault

Unexpected segfault in a grep command


Why does the following grep command segfault:

grep -Pz "(.|\n)*" *

For the command to segfault, it must be run in a directory with files containing text. Without the or group, it does not seg-fault.


Solution

  • Why does the following grep command segfault

    Because there is a bug in it.

    Any crash in user utilities, such as grep, cp, ls, etc. is a bug in said utility, and you should report it with a set of minimal steps required to reproduce it.