[nhc-bugs] Portability issue with grep -y

Wolfgang Lux wlux at uni-muenster.de
Thu Sep 18 15:32:00 EDT 2003


Hello!

I wanted to report just another problem. The scripts nhc98, hmake, and 
tprofrel
use grep -y to perform a case insensitive comparison. According to the 
man
pages on Mac OS X, -y is an obsolete synonym for -i. Even worse, the 
grep on
Solaris 2.7 does not even understand this option.

Here is a patch to replace -y by -i:
diff -u /tmp/nhc98-1.16/script/hmake.inst ./script/hmake.inst
--- /tmp/nhc98-1.16/script/hmake.inst   Thu Mar  6 11:32:51 2003
+++ ./script/hmake.inst Thu Sep 18 14:30:02 2003
@@ -26,7 +26,7 @@
  # (Also copes with options like -I/path etc.)
  # This routine is only strictly required when the MkProg executable
  # was built with GHC/mingw32.
-if echo $MACHINE | grep -y CYGWIN >/dev/null
+if echo $MACHINE | grep -i CYGWIN >/dev/null
  then filepath() { case $1 in
                      -?/*) dir=`echo $1 | cut -c3-`
                            dir=`cygpath -w "$dir" | tr '\\\\' '/'`
diff -u /tmp/nhc98-1.16/script/nhc98.inst ./script/nhc98.inst
--- /tmp/nhc98-1.16/script/nhc98.inst   Fri Mar  7 17:48:45 2003
+++ ./script/nhc98.inst Thu Sep 18 14:30:11 2003
@@ -31,7 +31,7 @@
  # (Also copes with options like -I/path etc.)
  # This routine is only strictly required when the compiler proper
  # was built with GHC/mingw32.
-if echo $MACHINE | grep -y CYGWIN >/dev/null
+if echo $MACHINE | grep -i CYGWIN >/dev/null
  then filepath() { case $1 in
                      -?/*) dir=`echo $1 | cut -c3-`
                            dir=`cygpath -w "$dir" | tr '\\\\' '/'`
diff -u /tmp/nhc98-1.16/script/tprofprel ./script/tprofprel
--- /tmp/nhc98-1.16/script/tprofprel    Mon Apr 15 11:29:03 2002
+++ ./script/tprofprel  Thu Sep 18 14:30:30 2003
@@ -16,7 +16,7 @@


  # Nasty compatibility stuff between /bin/sh/ and bash for arithmetic.
-if sh --version -e | grep -y gnu >/dev/null
+if sh --version -e | grep -i gnu >/dev/null
  then increment() { ( let x=$1+1; echo $x; ); }
  else increment() { echo $1 + 1 | bc; }
  fi


Regards
Wolfgang



More information about the Nhc-bugs mailing list