Subject: pkg/20905: textproc/grep is not honouring --program-prefix correctly
To: None <gnats-bugs@gnats.netbsd.org>
From: None <fudge_fr@users.sourceforge.net>
List: netbsd-bugs
Date: 03/27/2003 02:38:44
>Number:         20905
>Category:       pkg
>Synopsis:       textproc/grep is not honouring --program-prefix correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 27 02:39:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Nicolas Fugier
>Release:        netbsd-1-6-1
>Organization:
>Environment:
SunOS sky 5.9 Generic_112233-05 sun4u sparc SUNW,Sun-Blade-1000
>Description:
textproc/grep is not honouring --program-prefix correctly.

fgrep and egrep (shell scripts created by src/Makefile) are not correctly generated: they are executing: " exec grep" which can launch non-GNU grep on Solaris platform for instance and thus cannot do the job.

GNU grep folks are aware of this pb but this is not corrected in version 2.5.1 of grep (used  by NetBSD-1-6-1).
Patch was proposed on: <http://mail.gnu.org/archive/html/bug-gnu-utils/2002-03/msg00520.html>


>How-To-Repeat:
Just try to launch fgrep or egrep on a non-native GNU platform.
>Fix:
From <http://mail.gnu.org/archive/html/bug-gnu-utils/2002-03/msg00520.html> mailing list.


--- src/Makefile.am.bak 2002-03-26 07:49:46.000000000 -0800
+++ src/Makefile.am     2002-03-27 17:59:14.964337004 -0800
@@ -20,11 +20,11 @@ EXTRA_DIST = \
 
 egrep:
        echo '#!/bin/sh' >$@
-       echo 'exec grep -E $${1+"$$@"}' >>$@
+       echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -E $${1+"$$@"}' 
+>>$@
        chmod a+x $@
 
 fgrep:
        echo '#!/bin/sh' >$@
-       echo 'exec grep -F $${1+"$$@"}' >>$@
+       echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -F $${1+"$$@"}' 
+>>$@
        chmod a+x $@
 


Same patch for Makefile.in (not generated by configure script by default AFAIK):

--- src/Makefile.in.orig_solar  Tue Mar 26 17:09:36 2002
+++ src/Makefile.in
@@ -379,12 +379,12 @@ uninstall-am: uninstall-binPROGRAMS unin

 egrep:
        echo '#!/bin/sh' >$@
-       echo 'exec grep -E $${1+"$$@"}' >>$@
+       echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -E $${1+"$$@"}' >>$@
        chmod a+x $@

 fgrep:
        echo '#!/bin/sh' >$@
-       echo 'exec grep -F $${1+"$$@"}' >>$@
+       echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -F $${1+"$$@"}' >>$@
        chmod a+x $@
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.


>Release-Note:
>Audit-Trail:
>Unformatted: