From owner-svn-src-head@FreeBSD.ORG Thu Aug 8 11:53:47 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A8E3A6A4; Thu, 8 Aug 2013 11:53:47 +0000 (UTC) (envelope-from ache@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 97CF52B91; Thu, 8 Aug 2013 11:53:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r78Brl6b041115; Thu, 8 Aug 2013 11:53:47 GMT (envelope-from ache@svn.freebsd.org) Received: (from ache@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r78BrlFM041114; Thu, 8 Aug 2013 11:53:47 GMT (envelope-from ache@svn.freebsd.org) Message-Id: <201308081153.r78BrlFM041114@svn.freebsd.org> From: "Andrey A. Chernov" Date: Thu, 8 Aug 2013 11:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r254093 - head/gnu/usr.bin/grep X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2013 11:53:47 -0000 Author: ache Date: Thu Aug 8 11:53:47 2013 New Revision: 254093 URL: http://svnweb.freebsd.org/changeset/base/254093 Log: Part of r245761 makes "grep -D skip" broken for pipes, i.e. echo xxx | grep -D skip xxx returns nothing. Instead of just removing added S_ISFIFO condition (originally absent in this version of grep), make it work as latest GNU version does: don't skip directories and devices if fd == STDIN_FILENO. Modified: head/gnu/usr.bin/grep/grep.c Modified: head/gnu/usr.bin/grep/grep.c ============================================================================== --- head/gnu/usr.bin/grep/grep.c Thu Aug 8 11:24:25 2013 (r254092) +++ head/gnu/usr.bin/grep/grep.c Thu Aug 8 11:53:47 2013 (r254093) @@ -301,14 +301,16 @@ reset (int fd, char const *file, struct error (0, errno, "fstat"); return 0; } - if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode)) - return 0; + if (fd != STDIN_FILENO) { + if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode)) + return 0; #ifndef DJGPP - if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode))) + if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode))) #else - if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode))) + if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode))) #endif - return 0; + return 0; + } if ( BZflag || #if HAVE_LIBZ > 0