Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Feb 2005 21:53:25 GMT
From:      Andre Guibert de Bruet <andy@siliconlandmark.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/77466: grep recursive directory loop reporting outputs extra newline in 6-CURRENT.
Message-ID:  <200502132153.j1DLrP5I085942@www.freebsd.org>
Resent-Message-ID: <200502132200.j1DM0dBR065906@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         77466
>Category:       bin
>Synopsis:       grep recursive directory loop reporting outputs extra newline in 6-CURRENT.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 13 22:00:39 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Andre Guibert de Bruet
>Release:        6.0-CURRENT
>Organization:
Silicon Landmark 
>Environment:
FreeBSD bling.home 6.0-CURRENT FreeBSD 6.0-CURRENT #0: Sat Feb 12 02:21:11 EST 2005     root@bling.home:/usr/CURRENT/sys/i386/compile/BLING  i386
>Description:
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.
>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

>Fix:
I have a patch that addresses the issue. It is up at http://bling.properkernel.com/freebsd/grep.recursive.patch .
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200502132153.j1DLrP5I085942>