Subject: Re: buggy grep in Solaris 10 (break gnupg)
To: None <segv@netctl.net>
From: Gilles Dauphin <Gilles.Dauphin@enst.fr>
List: tech-pkg
Date: 04/12/2006 15:30:43
> From: segv@netctl.net
> 
> On Wed, 12 Apr 2006 10:35:57 +0200 (CEST)
> Gilles Dauphin <Gilles.Dauphin@enst.fr> wrote:
> 
> > Hello,
> > 
> > It seems the solaris grep is buggy. I test the following:
> > 
> > [root@u2 100] echo hithere > conftest.txt
> > [root@u2 101] /usr/pkg/bin/tar -cf - conftest.txt | /usr/xpg4/bin/grep -q
> > ustar [root@u2 102] echo $?
> > 1
> > [root@u2 103]
> > 
> > But
> > 
> > [root@u2 103] /usr/pkg/bin/tar -cf - conftest.txt | /usr/sfw/bin/ggrep -q
> > ustar [root@u2 104] echo $?
> > 0
> > [root@u2 105]
> > 
> > How to use /usr/sfw/bin/ggrep as a TOOL for pkgsrc.
> > 
> > Thanks 
> > Gilles
> > 
> 
> Because when you run 'tar' you don't get end of line chars in the output.
> Try '-F' option with Solaris grep.

'End Of File' that is not 'End of Line' is too complex for me ;-)

Almost packages guess for gnu grep, that's the case of gnupg in configure
this is the code fragment of configure's gnupg:
.... 
if test x$_mytar != x ; then
        echo "$as_me:$LINENO: checking whether $_mytar speaks USTAR" >&5
echo $ECHO_N "checking whether $_mytar speaks USTAR... $ECHO_C" >&6
        echo hithere > conftest.txt
        $_mytar -cf - conftest.txt | grep -q ustar
        _tar_bad=$?
        rm conftest.txt

        if test x$_tar_bad = x0 ; then
           echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
        else
           echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
        fi
     fi
....

I finaly patch pkgsrc/mk/tools/tools.SunOS.mk whith :
.if exists(/usr/sfw/bin/ggrep)
TOOLS_PLATFORM.egrep?=          /usr/sfw/bin/gegrep
TOOLS_PLATFORM.fgrep?=          /usr/sfw/bin/gfgrep
TOOLS_PLATFORM.grep?=           /usr/sfw/bin/ggrep
.endif
TOOLS_PLATFORM.egrep?=          /usr/xpg4/bin/grep -E
TOOLS_PLATFORM.fgrep?=          /usr/xpg4/bin/fgrep
TOOLS_PLATFORM.grep?=           /usr/xpg4/bin/grep


Gilles