grep has built-in directory loop reporting that is enabled when using the -R (recursive) option. CURRENT (5.3 too?) outputs an extra newline character when such a directory loop is detected. This behavior is not found in FreeBSD 4.x. Additionally, it breaks scripts that depend upon the traditional behavior. Fix: I have a patch that addresses the issue. It is up at http://bling.properkernel.com/freebsd/grep.recursive.patch . How-To-Repeat: $ grep -R somethingreallylongthatyouwillnotfind /usr/src grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/3dfx/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/aac/aac_linux/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/aac/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/accf_data/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/accf_http/@: recursive directory loop [snip] With the patch, you do not get the extra newline: $ grep -R somethingreallylongthatyouwillnotfind /usr/src grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/3dfx/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/aac/aac_linux/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/aac/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/accf_data/@: recursive directory loop grep: warning: /usr/src/sys/i386/compile/BLING/modules/usr/CURRENT/sys/modules/accf_http/@: recursive directory loop
State Changed From-To: open->closed Committed thanks. BTW, please use unified diffs (diff -u).