4 ms·
Interesting - it only appears to affect me with --color set (which is a default alias, but if you unalias grep it stops exploding.)
by soneil 3y ago
Interesting - it only appears to affect me with --color set (which is a default alias, but if you unalias grep it stops exploding.)
- ArchOversight 3y ago% type grep grep is /usr/bin/grep % echo -n "a" | /usr/bin/grep -o 'b*' Assertion failed: (advance > 0), function procline, file util.c, line 732. zsh: done echo -n "a" | zsh: abort /usr/bin/grep -o 'b*' Your alias is not part of the macOS default.
- soneil 3y agoah, you're right - it looks like it was part of ohmyzsh. It appears I missed the -o; without it, my alias asserts, but unaliased doesn't. With the -o they both assert. Still not what I was expecting, but the failure to cleanly replicate it is mine.
- burntsushi 3y agoThe key here is that both -o and --color will force grep to fine every match on each matching line. And it looks like that triggers the buggy code path. Without those options, it's possible grep won't need to find each match on each matching line, but rather, just whether a line matches at all.