Package: grep / 3.3-1~bpo9+1

05-grep-wrapper-sh.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Removes needless call to bash.

* src/Makefile.am: Specifies /bin/sh as shell, used for egrep and fgrep wrappers. 
* src/egrep.sh Stops adding the working directory in PATH if a ./grep exists 

Closes: #762427, #762917

Index: grep/src/Makefile.am
===================================================================
--- grep.orig/src/Makefile.am
+++ grep/src/Makefile.am
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 LN = ln
+SHELL = /bin/sh
 
 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PCRE_CFLAGS)
 
@@ -52,14 +53,7 @@ EXTRA_DIST = egrep.sh
 egrep fgrep: egrep.sh Makefile
 	$(AM_V_GEN)grep=`echo grep | sed -e '$(transform)'` &&		\
 	case $@ in egrep) option=-E;; fgrep) option=-F;; esac &&	\
-	shell_does_substrings='set x/y && d=$${1%/*} && test "$$d" = x' && \
-	if $(SHELL) -c "$$shell_does_substrings" 2>/dev/null; then	\
-	  edit_substring='s,X,X,';					\
-	else								\
-	  edit_substring='s,\$${0%/\*},`expr "X$$0" : '\''X\\(.*\\)/'\''`,g'; \
-	fi &&								\
 	sed -e 's|[@]SHELL@|$(SHELL)|g'					\
-	    -e "$$edit_substring"					\
 	    -e "s|[@]grep@|$$grep|g"					\
 	    -e "s|[@]option@|$$option|g" <$(srcdir)/egrep.sh >$@-t
 	$(AM_V_at)chmod +x $@-t