Subject: bug#14391: bug in grep -- ignoring GREP_OPTIONS or not acting on it...

From: Pádraig Brady <[email-masked]>
Date: Sun, 12 May 2013 13:23:47 +0100

tag 14391 notabug
close 14391
stop

grep is not a coreutils so closing this.
You may want to discuss this on the grep mailing list,
but I've added a couple of notes below.

On 05/12/2013 06:04 AM, Linda Walsh wrote:
> My grep is :
> grep (GNU grep) 2.14
> Copyright (C) 2012 Free Software Foundation, Inc.
> ...
> when I type grep, I get an alias + I have GREP_OPTIONS set..
> 
> whence on grep gives the first entry as:
> grep is aliased to `grep --color=auto'
> 
>> echo $GREP_OPTIONS
> -D skip --binary-files=without-match
> 
> Ishtar:/tmp/test> ll
> total 0
> drwxrwxr-x 2 6 May 11 14:39 a/
> drwxrwxr-x 2 6 May 11 14:39 b/
> drwxrwxr-x 2 6 May 11 14:39 c/
> -rw-rw-r-- 1 0 May 11 14:39 e
> -rw-rw-r-- 1 0 May 11 14:39 f
> -rw-rw-r-- 1 0 May 11 14:39 g
> Ishtar:/tmp/test> grep foo *
> grep: a: Is a directory
> grep: b: Is a directory
> grep: c: Is a directory
> 
> grep should ignore the directories and issue no message for them:
>        -D ACTION, --devices=ACTION
>               If an input file is a device, FIFO  or  socket,  use  ACTION  to
>               process  it.   By  default,  ACTION  is  read,  which means that
>               devices are read just as if they were ordinary files.  If ACTION
>               is skip, devices are silently skipped.
> 
>        GREP_OPTIONS
>               This variable specifies default options to be placed in front of
>               any  explicit  options.   For  example,   if   GREP_OPTIONS   is
>               '--binary-files=without-match  --directories=skip', grep behaves
>               as  if  the   two   options   --binary-files=without-match   and
>               --directories=skip   had  been  specified  before  any  explicit
>               options.
> ----
> ACTION=skip, so where's the silence?
> 
> I don't remember this being this way before -- it used to work.
> Seems like it stopped recently?

While I see that grep 2.9 at least doesn't seem to warn
about dirs by default, for newer versions you may want
to specify -d 'skip' instead of -D 'skip' ?

thanks,
Pádraig.