From jbeich@tormail.net  Sun Nov 27 17:02:11 2011
Return-Path: <jbeich@tormail.net>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9F7AF1065687
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 27 Nov 2011 17:02:11 +0000 (UTC)
	(envelope-from jbeich@tormail.net)
Received: from server2.hudsonvalleyhost.com (server2.hudsonvalleyhost.com [66.7.195.77])
	by mx1.freebsd.org (Postfix) with ESMTP id 6FC2E8FC12
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 27 Nov 2011 17:02:11 +0000 (UTC)
Received: from tor-exit-readme-1wh2.kromyon.net ([209.236.66.136]:16427 helo=internal.tormail.net)
	by server2.hudsonvalleyhost.com with esmtpsa (TLSv1:RC4-SHA:128)
	(Exim 4.69)
	(envelope-from <jbeich@tormail.net>)
	id 1RUi7E-003Qe3-NE
	for FreeBSD-gnats-submit@freebsd.org; Sun, 27 Nov 2011 12:02:10 -0500
Received: from jbeich by internal.tormail.net with local (Exim 4.63)
	(envelope-from <jbeich@tormail.net>)
	id 1RUi65-0007Cz-TV
	for FreeBSD-gnats-submit@freebsd.org; Sun, 27 Nov 2011 17:01:02 +0000
Message-Id: <1RUi65-0007Cz-TV@internal.tormail.net>
Date: Sun, 27 Nov 2011 06:59:55 -1000
From: Jan Beich <jbeich@tormail.net>
To: FreeBSD-gnats-submit@freebsd.org
Subject: [patch] bsdgrep(1): don't abort search on error

>Number:         162907
>Category:       bin
>Synopsis:       [patch] bsdgrep(1): don't abort search on error
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    gabor
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 27 17:10:11 UTC 2011
>Closed-Date:    Thu Dec 01 13:55:06 UTC 2011
>Last-Modified:  Thu Dec 01 13:55:06 UTC 2011
>Originator:     Jan Beich
>Release:        FreeBSD 10.0-CURRENT r228005M amd64
>Organization:
>Environment:
>Description:
http://docs.freebsd.org/cgi/mid.cgi?86vcqca8pw.wl%poyopoyo
>How-To-Repeat:
$ bsdgrep -R ddb /etc
/etc/defaults/rc.conf:ddb_enable="NO"           # Set to YES to load ddb scripts at boot.
/etc/defaults/rc.conf:ddb_config="/etc/ddb.conf"        # ddb(8) config file.
grep: /etc/bluetooth/hcsecd.conf: Permission denied
grep: /etc/ntp: Permission denied
Exit 2
>Fix:
--- eaccess.diff begins here ---
Index: usr.bin/grep/util.c
===================================================================
--- usr.bin/grep/util.c	(revision 228003)
+++ usr.bin/grep/util.c	(working copy)
@@ -130,7 +130,9 @@ grep_tree(char **argv)
 		case FTS_DNR:
 			/* FALLTHROUGH */
 		case FTS_ERR:
-			errx(2, "%s: %s", p->fts_path, strerror(p->fts_errno));
+			notfound = true;
+			if(!sflag)
+				warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
 			break;
 		case FTS_D:
 			/* FALLTHROUGH */
--- eaccess.diff ends here ---
>Release-Note:
>Audit-Trail:

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/162907: commit references a PR
Date: Mon, 28 Nov 2011 20:04:36 +0000 (UTC)

 Author: gabor
 Date: Mon Nov 28 20:04:26 2011
 New Revision: 228097
 URL: http://svn.freebsd.org/changeset/base/228097
 
 Log:
   - Call warnx() instead of errx() if a directory is not readable when using
     a recursive search.  This is the expected behavior instead of aborting.
   
   PR:		bin/162907
   Submitted by:	Jan Beich <jbeich@tormail.net>
   MFC after:	3 days
 
 Modified:
   head/usr.bin/grep/util.c
 
 Modified: head/usr.bin/grep/util.c
 ==============================================================================
 --- head/usr.bin/grep/util.c	Mon Nov 28 20:03:33 2011	(r228096)
 +++ head/usr.bin/grep/util.c	Mon Nov 28 20:04:26 2011	(r228097)
 @@ -130,7 +130,9 @@ grep_tree(char **argv)
  		case FTS_DNR:
  			/* FALLTHROUGH */
  		case FTS_ERR:
 -			errx(2, "%s: %s", p->fts_path, strerror(p->fts_errno));
 +			notfound = true;
 +			if(!sflag)
 +				warnx("%s: %s", p->fts_path, strerror(p->fts_errno));
  			break;
  		case FTS_D:
  			/* FALLTHROUGH */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->patched 
State-Changed-By: gabor 
State-Changed-When: Mon Nov 28 20:20:36 UTC 2011 
State-Changed-Why:  
Committed to HEAD, thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162907 
State-Changed-From-To: patched->closed 
State-Changed-By: gabor 
State-Changed-When: Thu Dec 1 13:54:55 UTC 2011 
State-Changed-Why:  
Merged to 9.X. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162907 
>Unformatted:
