GNU bug report logs - #26205
Unhappy with deprecating GREP_OPTIONS

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Reported by: Thomas G√ľttler <guettliml@HIDDEN>; Keywords: wontfix; dated Tue, 21 Mar 2017 15:40:01 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at 26205 <at> debbugs.gnu.org:


Received: (at 26205) by debbugs.gnu.org; 7 Nov 2017 23:58:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 07 18:58:42 2017
Received: from localhost ([127.0.0.1]:57235 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eCDlR-0004RG-RU
	for submit <at> debbugs.gnu.org; Tue, 07 Nov 2017 18:58:42 -0500
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42846)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1eCDlQ-0004R2-Dl
 for 26205 <at> debbugs.gnu.org; Tue, 07 Nov 2017 18:58:41 -0500
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 78485160FC2;
 Tue,  7 Nov 2017 15:58:34 -0800 (PST)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id hILMtPJrvB8j; Tue,  7 Nov 2017 15:58:32 -0800 (PST)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id B3114160FA2;
 Tue,  7 Nov 2017 15:58:32 -0800 (PST)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id 8fWXW5cg--qO; Tue,  7 Nov 2017 15:58:32 -0800 (PST)
Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 9821D160E51;
 Tue,  7 Nov 2017 15:58:32 -0800 (PST)
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
To: Ankeet <postmillenial@HIDDEN>, 26205 <at> debbugs.gnu.org
References: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
 <etPan.5a021f04.260f628a.12691@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <019f245d-1320-4763-477b-c7b1707d0499@HIDDEN>
Date: Tue, 7 Nov 2017 15:58:32 -0800
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
 Thunderbird/52.4.0
MIME-Version: 1.0
In-Reply-To: <etPan.5a021f04.260f628a.12691@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Language: en-US
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 26205
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

On 11/07/2017 01:00 PM, Ankeet wrote:
> 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).

Most of those methods would not work for grep, which is not a shell 
script. The only exception (testing whether stdin is a terminal) would 
run afoul of the GNU coding standards, which say that the behavior of a 
program should not depend on whether standard input or output is a 
terminal device. See:

https://www.gnu.org/prep/standards/html_node/User-Interfaces.html

Although we stretch those rules occasionally, stretching does not seem 
advisable here.





Information forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Nov 2017 21:19:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 07 16:19:12 2017
Received: from localhost ([127.0.0.1]:57150 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1eCBH6-0000Ef-6D
	for submit <at> debbugs.gnu.org; Tue, 07 Nov 2017 16:19:12 -0500
Received: from eggs.gnu.org ([208.118.235.92]:45664)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <postmillenial@HIDDEN>) id 1eCAza-0008DH-Ib
 for submit <at> debbugs.gnu.org; Tue, 07 Nov 2017 16:01:06 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <postmillenial@HIDDEN>) id 1eCAzU-0005cp-AQ
 for submit <at> debbugs.gnu.org; Tue, 07 Nov 2017 16:01:01 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:47622)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <postmillenial@HIDDEN>)
 id 1eCAzU-0005ci-64
 for submit <at> debbugs.gnu.org; Tue, 07 Nov 2017 16:01:00 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36606)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <postmillenial@HIDDEN>) id 1eCAzS-0001ue-La
 for bug-grep@HIDDEN; Tue, 07 Nov 2017 16:00:59 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <postmillenial@HIDDEN>) id 1eCAzR-0005XR-7p
 for bug-grep@HIDDEN; Tue, 07 Nov 2017 16:00:58 -0500
Received: from mail-ot0-x234.google.com ([2607:f8b0:4003:c0f::234]:47139)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <postmillenial@HIDDEN>)
 id 1eCAzQ-0005Sy-W3
 for bug-grep@HIDDEN; Tue, 07 Nov 2017 16:00:57 -0500
Received: by mail-ot0-x234.google.com with SMTP id s88so525126ota.4
 for <bug-grep@HIDDEN>; Tue, 07 Nov 2017 13:00:55 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:date:from:to:message-id:subject:mime-version;
 bh=By7H+swD+x5g6rdsoirLHJykavbqASMm7iCNjQdBybs=;
 b=EmAh1UZWULCg+rzGSUBiAvRoFYH4eIc0O1wGK77PFw4qchj6r0G2YTslcHs57hrSI7
 9FBsfBqgRHfgz8dns7vLJBvYosUWK0ZHUa33pfz1i2p+UBTU+jNcX6ivQNFvuW9ByYWO
 ogwY0xDKCf8418syKP9kt7Awl9Dx3lLhzR+pRUJInuRh1L5bnkLDLj+ILv5M3cZontEH
 QeCxGMSVZEd/YvDSWnAQxj4Ihp/FG5E2o+nkM0XnIN0SIGK1DtQqU2tg9SkdQkpURmiH
 XfBl6TTGCArB6zonK6bzzliPCxCml7ZhS5gpf0XKtHBsov7+6W3MQPzQenmDpelTFCdt
 Usug==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:date:from:to:message-id:subject
 :mime-version;
 bh=By7H+swD+x5g6rdsoirLHJykavbqASMm7iCNjQdBybs=;
 b=GwCIWYMFrai3FWhUauTbgqF9tYWhQpYW7+Ss72Y+XQMrvLGykPOEJUKkmvLYmC0jio
 JxVXgnoePN7xRnj8hkNUvM5sj8bXfOrGddAmO5L0Kxvg2Aj9+8cr/ctN8t8xEwfrZX0o
 D2EPLVF9bRj0/GrenTpWgKi1pyXqXqY48TBQx1AoSeCZ9TsvGXkmAtcqSo/0biwWfIO1
 lNl5Y50tF7Mr6RjxzqXdy2tkHSqH/9W8dzf7ic6DQXnT6XJz92X7wnubu/AaEsgDX/Ci
 XA7yKpiDLgMJgjDRPpBOqv316ZOBlzVtD7HiWIm7r2GLgGZ6nF6Z84msr4DYU6jSmuDq
 XSAw==
X-Gm-Message-State: AJaThX7LSJBpMM1YYiVZPHHd5FPCbrgHbEjkKEJvnJmHQ+1/sBMAZB1x
 pS6FHJBj4UdARMdVP0U4p3O9iFZY
X-Google-Smtp-Source: AGs4zMbhJxYTTmM27zkX6yvD/8wuNpYOgJEVu5PSdc6ZJbqLrK8uHf8DCFQQv6Ji4pUnx+DWYq4lfg==
X-Received: by 10.157.67.99 with SMTP id y32mr24108oti.447.1510088454196;
 Tue, 07 Nov 2017 13:00:54 -0800 (PST)
Received: from AnkeetPswalaMBP.mail ([2602:306:37c9:d6c0:95c:835f:5697:9302])
 by smtp.gmail.com with ESMTPSA id
 y7sm1005741oie.1.2017.11.07.13.00.53 for <bug-grep@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 07 Nov 2017 13:00:53 -0800 (PST)
Date: Tue, 7 Nov 2017 13:00:52 -0800
From: Ankeet <postmillenial@HIDDEN>
To: bug-grep@HIDDEN
Message-ID: <etPan.5a021f04.260f628a.12691@HIDDEN>
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
X-Mailer: Airmail (442)
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="5a021f04_287d34b3_12691"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 07 Nov 2017 16:19:11 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

--5a021f04_287d34b3_12691
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

>> Why is GREP=5FOPTIONS deprecated=3F =C2=A0=C2=A0
> The main reason is that it breaks shell scripts. Scripts generally=C2=A0=

> expect 'grep' to behave as specified in POSIX and as implemented via=C2=
=A0
> traditional 'grep' implementations. GREP=5FOPTIONS breaks this. =C2=A0
> Some shell scripts work around the problem by explicitly unsetting=C2=A0=

> GREP=5FOPTIONS before they call 'grep'. However, most scripts don't, I=C2=
=A0
> expect because their authors are not generally aware of this=C2=A0
> compatibility issue. So in practice the convenience of GREP=5FOPTIONS c=
an be more trouble than it's worth.

Here's a simpler fix: grep should test for an interactive shell before pa=
rsing GREP=5FOPTIONS. =5BThere are a number of methods outlined in the ma=
n page=5D(http://www.tldp.org/LDP/abs/html/intandnonint.html). At least t=
wo of these methods (PS1=5B1=5D and test =22=24(=240)=E2=80=9D are POSIX =
compatible if i=E2=80=99m not mistaken.

Interactive shell users can still export GREP=5FOPTIONS to get a persiste=
nt configuration. But this way, shell scripts get grep without the variab=
le set, and if they really need to, can still use those options by callin=
g =E2=80=9Cgrep =24GREP=5FOPTIONS =E2=80=A6=E2=80=9D explicitly.


--5a021f04_287d34b3_12691
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<html><head><style>
body =7B
	font-family: =22Helvetica Neue=22, Helvetica, Arial, sans-serif;
	padding:1em;
	margin:auto;
	background:=23fefefe;
=7D

h1, h2, h3, h4, h5, h6 =7B
	font-weight: bold;
=7D

h1 =7B
	color: =23000000;
	font-size: 28pt;
=7D

h2 =7B
	border-bottom: 1px solid =23CCCCCC;
	color: =23000000;
	font-size: 24px;
=7D

h3 =7B
	font-size: 18px;
=7D

h4 =7B
	font-size: 16px;
=7D

h5 =7B
	font-size: 14px;
=7D

h6 =7B
	color: =23777777;
	background-color: inherit;
	font-size: 14px;
=7D

hr =7B
	height: 0.2em;
	border: 0;
	color: =23CCCCCC;
	background-color: =23CCCCCC;
    display: inherit;
=7D

p, blockquote, ul, ol, dl, li, table, pre =7B
	margin: 15px 0;
=7D

a, a:visited =7B
	color: =234183C4;
	background-color: inherit;
	text-decoration: none;
=7D

=23message =7B
	border-radius: 6px;
	border: 1px solid =23ccc;
	display:block;
	width:100%;
	height:60px;
	margin:6px 0px;
=7D

button, =23ws =7B
	font-size: 12 pt;
	padding: 4px 6px;
	border-radius: 5px;
	border: 1px solid =23bbb;
	background-color: =23eee;
=7D

code, pre, =23ws, =23message =7B
	font-family: Monaco;
	font-size: 10pt;
	border-radius: 3px;
	background-color: =23=468=468=468;
	color: inherit;
=7D

code =7B
	border: 1px solid =23EAEAEA;
	margin: 0 2px;
	padding: 0 5px;
=7D

pre =7B
	border: 1px solid =23CCCCCC;
	overflow: auto;
	padding: 4px 8px;
=7D

pre > code =7B
	border: 0;
	margin: 0;
	padding: 0;
=7D

=23ws =7B background-color: =23f8f8f8; =7D


.bloop=5Fmarkdown table =7B
border-collapse: collapse; =20
font-family: Helvetica, arial, freesans, clean, sans-serif; =20
color: rgb(51, 51, 51); =20
font-size: 15px; line-height: 25px;
padding: 0; =7D

.bloop=5Fmarkdown table tr =7B
border-top: 1px solid =23cccccc;
background-color: white;
margin: 0;
padding: 0; =7D
    =20
.bloop=5Fmarkdown table tr:nth-child(2n) =7B
background-color: =23f8f8f8; =7D

.bloop=5Fmarkdown table tr th =7B
font-weight: bold;
border: 1px solid =23cccccc;
margin: 0;
padding: 6px 13px; =7D

.bloop=5Fmarkdown table tr td =7B
border: 1px solid =23cccccc;
margin: 0;
padding: 6px 13px; =7D

.bloop=5Fmarkdown table tr th :first-child, table tr td :first-child =7B
margin-top: 0; =7D

.bloop=5Fmarkdown table tr th :last-child, table tr td :last-child =7B
margin-bottom: 0; =7D

.bloop=5Fmarkdown blockquote=7B
  border-left: 4px solid =23dddddd;
  padding: 0 15px;
  color: =23777777; =7D
  blockquote > :first-child =7B
    margin-top: 0; =7D
  blockquote > :last-child =7B
    margin-bottom: 0; =7D

code, pre, =23ws, =23message =7B
    word-break: normal;
    word-wrap: normal;
=7D

hr =7B
    display: inherit;
=7D

.bloop=5Fmarkdown :first-child =7B
    -webkit-margin-before: 0;
=7D

code, pre, =23ws, =23message =7B
    font-family: Menlo, Consolas, Liberation Mono, Courier, monospace;
=7D


.send =7B color:=2377bb77; =7D
.server =7B color:=237799bb; =7D
.error =7B color:=23AA0000; =7D</style></head><body style=3D=22word-wrap:=
 break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-sp=
ace;=22><div>&gt;&gt; Why is GREP=5FOPTIONS deprecated=3F &nbsp;&nbsp;</d=
iv><div>&gt; The main reason is that it breaks shell scripts. Scripts gen=
erally&nbsp;</div><div>&gt; expect 'grep' to behave as specified in POSIX=
 and as implemented via&nbsp;</div><div>&gt; traditional 'grep' implement=
ations. GREP=5FOPTIONS breaks this. &nbsp;</div><div>&gt; Some shell scri=
pts work around the problem by explicitly unsetting&nbsp;</div><div>&gt; =
GREP=5FOPTIONS before they call 'grep'. However, most scripts don't, I&nb=
sp;</div><div>&gt; expect because their authors are not generally aware o=
f this&nbsp;</div><div>&gt; compatibility issue. So in practice the conve=
nience of GREP=5FOPTIONS can be more trouble than it's worth.</div><div><=
br></div><div>Here's a simpler fix: grep should test for an interactive s=
hell before parsing GREP=5FOPTIONS. =5BThere are a number of methods outl=
ined in the man page=5D(http://www.tldp.org/LDP/abs/html/intandnonint.htm=
l). At least two of these methods (PS1=5B1=5D and test =22=24(=240)=E2=80=
=9D are POSIX compatible if i=E2=80=99m not mistaken.</div><div><br></div=
><div>Interactive shell users can still export GREP=5FOPTIONS to get a pe=
rsistent 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 =E2=80=9Cgrep =24GREP=5FOPTIONS =E2=80=A6=E2=80=9D explicitly.</d=
iv><div><br></div></body></html>
--5a021f04_287d34b3_12691--





Information forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.
Added tag(s) wontfix. Request was from Paul Eggert <eggert@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 26205 <at> debbugs.gnu.org:


Received: (at 26205) by debbugs.gnu.org; 21 Mar 2017 16:43:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 12:43:53 2017
Received: from localhost ([127.0.0.1]:38193 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqMsz-0000M6-D9
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:43:53 -0400
Received: from zimbra.cs.ucla.edu ([131.179.128.68]:38532)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1cqMsw-0000Lt-VF
 for 26205 <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:43:51 -0400
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id CE2A61600A1;
 Tue, 21 Mar 2017 09:43:43 -0700 (PDT)
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id OmHTfHZknHel; Tue, 21 Mar 2017 09:43:43 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by zimbra.cs.ucla.edu (Postfix) with ESMTP id 27E4A1600A2;
 Tue, 21 Mar 2017 09:43:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu
Received: from zimbra.cs.ucla.edu ([127.0.0.1])
 by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id ApKnapCv-a41; Tue, 21 Mar 2017 09:43:43 -0700 (PDT)
Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200])
 by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 118761600A1;
 Tue, 21 Mar 2017 09:43:43 -0700 (PDT)
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
To: =?UTF-8?Q?Thomas_G=c3=bcttler?= <guettliml@HIDDEN>,
 26205 <at> debbugs.gnu.org
References: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
Message-ID: <fd9788f4-b669-201b-2ca1-ec544898f689@HIDDEN>
Date: Tue, 21 Mar 2017 09:43:40 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 26205
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

On 03/21/2017 08:39 AM, Thomas G=C3=BCttler wrote:
> Why is GREP_OPTIONS deprecated?=20

The main reason is that it breaks shell scripts. Scripts generally=20
expect 'grep' to behave as specified in POSIX and as implemented via=20
traditional 'grep' implementations. GREP_OPTIONS breaks this.

Some shell scripts work around the problem by explicitly unsetting=20
GREP_OPTIONS before they call 'grep'. However, most scripts don't, I=20
expect because their authors are not generally aware of this=20
compatibility issue. So in practice the convenience of GREP_OPTIONS can=20
be more trouble than it's worth.

>  * Strategy 4: Write a simple wrapper script. No, I think this is too=20
> dirty and makes more trouble than it solves.
Why is it dirty? What trouble does it cause, other than the trouble=20
GREP_OPTIONS causes?





Information forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.

Message received at 26205 <at> debbugs.gnu.org:


Received: (at 26205) by debbugs.gnu.org; 21 Mar 2017 16:05:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 12:05:31 2017
Received: from localhost ([127.0.0.1]:38167 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqMHr-0007tc-52
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:05:31 -0400
Received: from mx1.redhat.com ([209.132.183.28]:41774)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eblake@HIDDEN>) id 1cqMHo-0007tL-Pj
 for 26205 <at> debbugs.gnu.org; Tue, 21 Mar 2017 12:05:29 -0400
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
 [10.5.11.13])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.redhat.com (Postfix) with ESMTPS id A8E387573B;
 Tue, 21 Mar 2017 16:05:23 +0000 (UTC)
DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A8E387573B
Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com;
 dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com;
 spf=pass smtp.mailfrom=eblake@HIDDEN
DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com A8E387573B
Received: from [10.10.121.124] (ovpn-121-124.rdu2.redhat.com [10.10.121.124])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 0728117AAC;
 Tue, 21 Mar 2017 16:05:22 +0000 (UTC)
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
To: =?UTF-8?Q?Thomas_G=c3=bcttler?= <guettliml@HIDDEN>,
 26205 <at> debbugs.gnu.org
References: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
From: Eric Blake <eblake@HIDDEN>
Openpgp: url=http://people.redhat.com/eblake/eblake.gpg
Organization: Red Hat, Inc.
Message-ID: <1efe9c8e-5330-1497-5d6d-b344399a4e58@HIDDEN>
Date: Tue, 21 Mar 2017 11:05:21 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="jTStKdJiL0MnL13VNiFoA2t4KK3LE9ogf"
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16
 (mx1.redhat.com [10.5.110.25]); Tue, 21 Mar 2017 16:05:23 +0000 (UTC)
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 26205
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--jTStKdJiL0MnL13VNiFoA2t4KK3LE9ogf
Content-Type: multipart/mixed; boundary="XVfVH42iR3SjGueAGg4X3kJKSICDQt8CK";
 protected-headers="v1"
From: Eric Blake <eblake@HIDDEN>
To: =?UTF-8?Q?Thomas_G=c3=bcttler?= <guettliml@HIDDEN>,
 26205 <at> debbugs.gnu.org
Message-ID: <1efe9c8e-5330-1497-5d6d-b344399a4e58@HIDDEN>
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
References: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
In-Reply-To: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>

--XVfVH42iR3SjGueAGg4X3kJKSICDQt8CK
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

On 03/21/2017 10:39 AM, Thomas G=C3=BCttler wrote:

>=20
>  * Strategy 1: GREP_OPTIONS. But this is deprecated. See
> http://www.gnu.org/software/grep/manual/html_node/Environment-Variables=
=2Ehtml
>=20
>  * Stragegy 2: GREP_COLORS look like a solution at the first sight, but=

> this does something different.
>  * Strategy 3: alias. This does not work for `find ... | xargs grep`,
> since xargs does not evaluate aliases.

It can if you teach it to (assuming you are using a sh-like shell):

alias xargs=3D'xargs '

(I can't help you if you are using a csh-like shell)

>  * Strategy 4: Write a simple wrapper script. No, I think this is too
> dirty and makes more trouble than it solves.

What trouble does it cause? This our preferred recommendation, by the way=
=2E

>  * Strategy 5: patch the source code  - No

Why not? It's open source, so you are free to do so, for your local setup=
=2E

>  * Strategy 6: Contact grep developers, ask for a replacement of
> GREP_OPTIONS

Which you've done. But it won't help, because we made a conscious
decision to kill environment variables that have the chance of breaking
scripts, and we are unlikely to be persuaded to change our minds.


> Why is GREP_OPTIONS deprecated?

Because it has the tendency to break unsuspecting scripts that don't
sanitize GREP_OPTIONS out of their environment.  Environment variables
that change default output are very dangerous.  Environment variables
that only modify behavior that has to be opted into (like GREP_COLORS)
are not as bad, but once you are explicitly opting into something, a
wrapper script is a lot more direct than a wrapper script + an
environment variable.

>=20
> I guess this can do confusing things if you exclude directories via thi=
s
> environment variable.

Yes, that was one of the things known to break scripts.

>=20
> But setting color=3Dauto looks like something which does not do harm.

You're right that 'color=3Dauto' tends to not break scripts, but
'color=3Dalways' does, and it gets rather hard, rather fast, if you try t=
o
special-case WHICH aspects of GREP_OPTIONS are safe, vs. just a blanket
statement that GREP_OPTIONS is in general unsafe.

--=20
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--XVfVH42iR3SjGueAGg4X3kJKSICDQt8CK--

--jTStKdJiL0MnL13VNiFoA2t4KK3LE9ogf
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJY0U9BAAoJEKeha0olJ0NqZG0H/RH/igrQV0DpiyB7q9yCcnFd
KlM3/fyd8mm3ahMLUQgauhh7b0r6vmp0N0qBL8zmUgXZ5E7UCZEHbQMGv6F4htPO
ta9rblTVeXlYQnGIbU67Khi61Eo7kJsyD5fpxBYb4hRIDgiHLVAEAcX2F2gMeNlB
jfIMndbrZJ/lF0DFTmkMeBitT55VLnNr7KYOcFS/92L7HsvE2eVkY1QlHCcnTnJ3
DTvRpcRqf460l2YW3n9negcVOuiHg+fTyrymO1+Ongc70HqcxvMkR7Y6AfsaplSy
41Re9Y212FwFvZxEmdbXEvsQu20yQD5UbqFgjoX1oMYBpb+8zE15jBNaSZycqAs=
=uvDk
-----END PGP SIGNATURE-----

--jTStKdJiL0MnL13VNiFoA2t4KK3LE9ogf--




Information forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.

Message received at 26205 <at> debbugs.gnu.org:


Received: (at 26205) by debbugs.gnu.org; 21 Mar 2017 15:55:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 11:55:58 2017
Received: from localhost ([127.0.0.1]:38155 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqM8b-0007eZ-Nd
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:55:57 -0400
Received: from freefriends.org ([96.88.95.60]:44802)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arnold@HIDDEN>) id 1cqM8Z-0007eR-VE
 for 26205 <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:55:56 -0400
X-Envelope-From: arnold@HIDDEN
Received: from freefriends.org (localhost [127.0.0.1])
 by freefriends.org (8.14.9/8.14.9) with ESMTP id v2LFtsxM028750;
 Tue, 21 Mar 2017 09:55:55 -0600
Received: (from arnold@localhost)
 by freefriends.org (8.14.9/8.14.9/submit) id v2LFtsDB028749;
 Tue, 21 Mar 2017 15:55:54 GMT
From: arnold@HIDDEN
Message-Id: <201703211555.v2LFtsDB028749@HIDDEN>
X-Authentication-Warning: frenzy.freefriends.org: arnold set sender to
 arnold@HIDDEN using -f
Date: Tue, 21 Mar 2017 09:55:54 -0600
To: guettliml@HIDDEN, 26205 <at> debbugs.gnu.org
Subject: Re: bug#26205: Unhappy with deprecating GREP_OPTIONS
References: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
In-Reply-To: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 26205
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Create a shell script named grep with

	/usr/bin/grep --color "$@"

in it, and put it in a directory in your search path that is
found before the standard grep.

HTH,

Arnold

Thomas GŁttler <guettliml@HIDDEN> wrote:

> I am not happy with GREP_OPTIONS being deprecated.
>
> I asked here for help, but received no solution I like:
>
> http://unix.stackexchange.com/questions/351083/colored-grep-output-not-grep-options-not-alias
>
> Here the question:
>
> I want colored output of `grep`.
>
> .... But
>
>   * Strategy 1: GREP_OPTIONS. But this is deprecated. See http://www.gnu.org/software/grep/manual/html_node/Environment-Variables.html
>   * Stragegy 2: GREP_COLORS look like a solution at the first sight, but this does something different.
>   * Strategy 3: alias. This does not work for `find ... | xargs grep`, since xargs does not evaluate aliases.
>   * Strategy 4: Write a simple wrapper script. No, I think this is too dirty and makes more trouble than it solves.
>   * Strategy 5: patch the source code  - No
>   * Strategy 6: Contact grep developers, ask for a replacement of GREP_OPTIONS
>   * Strategy NICE-and-EASY: ... this is missing. I have no clue.
>
> How to solve this?
>
>
> Now I follow Strategy 6.
>
> Why is GREP_OPTIONS deprecated?
>
> I guess this can do confusing things if you exclude directories via this environment variable.
>
> But setting color=auto looks like something which does not do harm. May be I am too naive. Then please tell me.
>
> What do you think?
>
> Regards,
>    Thomas GŁttler
>
>
> -- 
> http://www.thomas-guettler.de/
>
>
>
>




Information forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Mar 2017 15:39:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 11:39:41 2017
Received: from localhost ([127.0.0.1]:38135 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cqLsr-0007G1-CX
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:39:41 -0400
Received: from eggs.gnu.org ([208.118.235.92]:42721)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <guettliml@HIDDEN>) id 1cqLsp-0007Fm-WF
 for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:39:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <guettliml@HIDDEN>) id 1cqLsj-0004eO-Qe
 for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:39:34 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38607)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <guettliml@HIDDEN>)
 id 1cqLsj-0004eD-Ni
 for submit <at> debbugs.gnu.org; Tue, 21 Mar 2017 11:39:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:33682)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <guettliml@HIDDEN>) id 1cqLsi-0005Ci-G8
 for bug-grep@HIDDEN; Tue, 21 Mar 2017 11:39:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <guettliml@HIDDEN>) id 1cqLsc-0004Z5-Os
 for bug-grep@HIDDEN; Tue, 21 Mar 2017 11:39:32 -0400
Received: from hz1.yz.to ([178.63.61.147]:56184)
 by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <guettliml@HIDDEN>)
 id 1cqLsc-0004XE-JB
 for bug-grep@HIDDEN; Tue, 21 Mar 2017 11:39:26 -0400
Received: from [192.168.178.45] (i5E86D4CF.versanet.de [94.134.212.207])
 by hz1.yz.to (Postfix) with ESMTPSA id 5C0E68198ED8
 for <bug-grep@HIDDEN>; Tue, 21 Mar 2017 16:39:17 +0100 (CET)
To: bug-grep@HIDDEN
From: =?UTF-8?Q?Thomas_G=c3=bcttler?= <guettliml@HIDDEN>
Subject: Unhappy with deprecating GREP_OPTIONS
Message-ID: <7e2f2588-a61f-4eda-4323-8d053e6a1814@HIDDEN>
Date: Tue, 21 Mar 2017 16:39:16 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:49.0) Gecko/20100101
 Thunderbird/49.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.1 (----)

I am not happy with GREP_OPTIONS being deprecated.

I asked here for help, but received no solution I like:

http://unix.stackexchange.com/questions/351083/colored-grep-output-not-gr=
ep-options-not-alias

Here the question:

I want colored output of `grep`.

.... But

  * Strategy 1: GREP_OPTIONS. But this is deprecated. See http://www.gnu.=
org/software/grep/manual/html_node/Environment-Variables.html
  * Stragegy 2: GREP_COLORS look like a solution at the first sight, but =
this does something different.
  * Strategy 3: alias. This does not work for `find ... | xargs grep`, si=
nce xargs does not evaluate aliases.
  * Strategy 4: Write a simple wrapper script. No, I think this is too di=
rty and makes more trouble than it solves.
  * Strategy 5: patch the source code  - No
  * Strategy 6: Contact grep developers, ask for a replacement of GREP_OP=
TIONS
  * Strategy NICE-and-EASY: ... this is missing. I have no clue.

How to solve this?


Now I follow Strategy 6.

Why is GREP_OPTIONS deprecated?

I guess this can do confusing things if you exclude directories via this =
environment variable.

But setting color=3Dauto looks like something which does not do harm. May=
 be I am too naive. Then please tell me.

What do you think?

Regards,
   Thomas G=C3=BCttler


--=20
http://www.thomas-guettler.de/





Acknowledgement sent to Thomas G√ľttler <guettliml@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#26205; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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