https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251775
Bug ID: 251775 Summary: bsdgrep: egrep regards '{foo}' as invalid regular expression Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: b...@freebsd.org Reporter: y...@utahime.org CC: kev...@freebsd.org I'm the maintainer of security/logcheck port. It detects log messages that should be reported by applying regular expressions to each messages with egrep. After grep is switched to bsdgrep on 13-CURRENT I noticed logcheck produces some errors caused by egrep. I investigate them and found most of them happens because regular expressions are invalid according to the definition on re_format(7). But I also found there is one case that caused by bug of bsdgrep. In re_format(7) 'bound' is defined as following. "A bound is '{' followed by an unsigned decimal integer, possibly followed by ',' possibly followed by another unsigned decimal integer, always followed by '}'. The integers must lie between 0 and RE_DUP_MAX (255) inclusive, and if there are two of them, the first may not exceed the second." And there is also following clarification. " A '{' followed by a character other than a digit is an ordinary character, not the beginning of a bound. " So '{100}' is regarded as bound and therefore is invalid as regular expression. But '{foo}' isn't regarded as bound. Hence it's a valid regular expression and matches itself. Gnugrep's egrep works fine with this regular expression. ---------------------------------------------------------------------- yasu@eastasia[1575]% uname -U 1202000 yasu@eastasia[1614]% type egrep egrep is /usr/bin/egrep yasu@eastasia[1615]% egrep --version egrep (GNU grep) 2.5.1-FreeBSD Copyright 1988, 1992-1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. yasu@eastasia[1616]% echo '{foo}' | egrep '{foo}' {foo} yasu@eastasia[1617]% ---------------------------------------------------------------------- But bsdgrep's egrep results in error. ---------------------------------------------------------------------- yasu@rolling-vm-freebsd1[1135]% uname -U 1300131 yasu@rolling-vm-freebsd1[1142]% type egrep egrep is /usr/bin/egrep yasu@rolling-vm-freebsd1[1143]% egrep --version egrep (BSD grep, GNU compatible) 2.6.0-FreeBSD yasu@rolling-vm-freebsd1[1144]% echo '{foo}' | egrep '{foo}' egrep: repetition-operator operand invalid yasu@rolling-vm-freebsd1[1145]% ---------------------------------------------------------------------- -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"