GNU bug report logs - #17494
grep bug report: "GREP_OPTIONS" allows a user to break shell script

Previous Next

Package: grep;

Reported by: "Nadav Har'El" <nyh <at> cloudius-systems.com>

Date: Wed, 14 May 2014 22:21:01 UTC

Severity: wishlist

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


Message #17 received at 17494 <at> debbugs.gnu.org (full text, mbox):

From: "Nadav Har'El" <nyh <at> cloudius-systems.com>
To: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
Cc: 17494 <at> debbugs.gnu.org, Paul Eggert <eggert <at> cs.ucla.edu>,
 Osv Dev <osv-dev <at> googlegroups.com>
Subject: Re: bug#17494: grep bug report: "GREP_OPTIONS" allows a user to break
 shell script
Date: Thu, 15 May 2014 16:02:02 +0300
[Message part 1 (text/plain, inline)]
On Thu, May 15, 2014 at 3:53 PM, Norihiro Tanaka <noritnk <at> kcn.ne.jp> wrote:

>
> Even if I define an alias "grep='grep -d skip'", when "find . | xargs grep"
> doesn't ignore directories.
>

Since find does output directories, and clearly you don't want to grep on
them, why not just do something like

find . ! -type d | xargs grep

To be even safer and work with any file name (containing even newlines),
you actually need to do

find . ! -type d -print0 | xargs -0 grep

So maybe you just want to alias this whole thing :-)

I don't think this a reason to keep GREP_OPTIONS, but like I said I don't
mind if it is kept if at least people are warned about how it might break
shell scripts.


-- 
Nadav Har'El
nyh <at> cloudius-systems.com
[Message part 2 (text/html, inline)]

This bug report was last modified 10 years and 311 days ago.

Previous Next


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