GNU bug report logs - #26205
Unhappy with deprecating GREP_OPTIONS

Previous Next

Package: grep;

Reported by: Thomas Güttler <guettliml <at> thomas-guettler.de>

Date: Tue, 21 Mar 2017 15:40:01 UTC

Severity: normal

Tags: wontfix

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ankeet <postmillenial <at> gmail.com>
To: 26205 <at> debbugs.gnu.org
Subject: bug#26205: Unhappy with deprecating GREP_OPTIONS
Date: Tue, 7 Nov 2017 13:00:52 -0800
[Message part 1 (text/plain, inline)]
>> Why is GREP_OPTIONS deprecated?   
> The main reason is that it breaks shell scripts. Scripts generally 
> expect 'grep' to behave as specified in POSIX and as implemented via 
> traditional 'grep' implementations. GREP_OPTIONS breaks this.  
> Some shell scripts work around the problem by explicitly unsetting 
> GREP_OPTIONS before they call 'grep'. However, most scripts don't, I 
> expect because their authors are not generally aware of this 
> compatibility issue. So in practice the convenience of GREP_OPTIONS can be more trouble than it's worth.

Here's a simpler fix: grep should test for an interactive shell before parsing GREP_OPTIONS. [There are a number of methods outlined in the man page](http://www.tldp.org/LDP/abs/html/intandnonint.html). At least two of these methods (PS1[1] and test "$($0)” are POSIX compatible if i’m not mistaken.

Interactive shell users can still export GREP_OPTIONS to get a persistent configuration. But this way, shell scripts get grep without the variable set, and if they really need to, can still use those options by calling “grep $GREP_OPTIONS …” explicitly.

[Message part 2 (text/html, inline)]

This bug report was last modified 2 years and 320 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.