Subject: egrep.sh: grep missing path

From: Santiago Ruano Rincón <[email-masked]>
Date: Wed, 19 Jul 2017 09:22:43 +0200

Control: tags -1 + patch

Hi,

As suggested by this user, it would be better if egrep/fgrep script
calls grep using its absolute path.

On Fri, 19 May 2017 22:04:44 +0100 john mullee <[email-masked]> wrote:
> Package: grep
> Version: 2.20-4.1
> 
> cat /bin/egrep
>      #!/bin/sh
>      exec grep -E "$@"
> 
> should replace with
> 
>      exec /bin/grep -E "$@"
> 
> to reproduce:
> 
> root@debian-512mb-fra1-01:/opt/firewall# bash
> root@debian-512mb-fra1-01:/opt/firewall# PATH=/usr/local egrep "any" /etc/*
> bash: egrep: command not found

Please, consider the attached patch. 

Cheers,

Santiago
From cd235a0f51e84b3a744a06f3037ba7f3bad49b78 Mon Sep 17 00:00:00 2001
From: "Santiago R.R" <[email-masked]>
Date: Wed, 19 Jul 2017 09:16:15 +0200
Subject: [PATCH] src/Makefile.am: egrep.sh call grep using its absolute path

Signed-off-by: Santiago R.R. <[email-masked]>
---
 src/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 71c64f97..73c41dda 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,7 +60,7 @@ egrep fgrep: egrep.sh Makefile
 	fi &&								\
 	sed -e 's|[@]SHELL@|$(SHELL)|g'					\
 	    -e "$$edit_substring"					\
-	    -e "s|[@]grep@|$$grep|g"					\
+	    -e "s|[@]grep@|$(bindir)/$$grep|g"				\
 	    -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t
 	$(AM_V_at)chmod +x $@-t
 	$(AM_V_at)mv $@-t $@
-- 
2.13.3