bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep character class syntax abuse: quick survey


From: Jim Meyering
Subject: grep character class syntax abuse: quick survey
Date: Wed, 01 Sep 2010 15:03:04 +0200

More than a few projects have code that invokes
grep in an obviously erroneous manner, e.g.,

This search finds 622 primary matches:

  
http://www.google.com/codesearch?hl=en&lr=&q=grep\+[^[|]*\[%3A%28alnum|alpha|cntrl|digit|graph|lower|print|punct|space|upper|xdigit%29%3A\]&sbtn=Search

Here are the first few:
--------------------
gds-1.3/jetty4/bin/jetty.sh - 6 identical

   248: then   249:   CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | 
tr "\n" " "`   250: fi

grads.iges.org/grads/gds/gds-1.3.tar.gz - GPL - Shell
trunk/botnodetoolkit/lib/web/jetty/bin/jetty.sh - 14 identical

   294: then   295:   CONFIG_LINES=`cat $JETTY_CONF | grep -v "^[:space:]*#" | 
tr "\n" " "`   296: fi

botnodetoolkit.googlecode.com/svn - LGPL - Shell
makemake.sh

    65: CPP_FILES=`echo $ALL_FILES | tr " " "\n" | grep cpp$`    66: 
#ENTRY_POINTS=`echo $CPP_FILES | tr " " "\n" | grep /[:lower:] | sort`    67: 
ENTRY_POINTS=`echo $CPP_FILES | grep "int main" $CPP_FILES | cut -d ":" -f 1`

kruel.org/eon/trunk - Unknown - Shell
tags/2.0.8/build/buildexports.sh - 1 identical

    14: do    15:     if [ "x`echo $LINE | egrep  '^[:space:]*apr_'`" != "x" ]; 
then    16:         newline=`echo "$LINE" |\

svn.apache.org/repos/asf/httpd/httpd/ - BSD - Shell - More from »
base/openqrm-3.0.1/src/base/include/qrm-functions

   555:   fi   556:   if echo $IP_ADDRESS | grep [:alpha:] 1>/dev/null 2>&1; 
then   557:           qerror "Characters detected in ip-address $IP_ADDRESS"

openqrm.cvs.sourceforge.net/cvsroot/openqrm - Unknown - Shell - More from 
openqrm »
trunk/fmake.sh

   109: ... -zA-Z0-9]*\.o:\)\(.*\)/\2/g" | grep -v '\.cpp$' | grep -v '^/usr/' 
| grep -v '\\' | grep -v -x '[:space:]*' > $PATH_OLD/$DEPS_DIR/$FILE_O.dep

automated-testing-of-hamiltonian-closures.googlecode.com/svn - Unknown - Shell
--------------------



Let's hope that most have been fixed by now, and what we're
seeing are merely short-lived mistakes that appeared in old tarballs.

I'll bet that none of those would have been introduced if the
authors had been using a version of grep that diagnoses this error.

Once users begin using the next version of grep, they should soon
notice the failures.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]