[Buildroot] [PATCH v2] package/grep: fix egrep/fgrep shebang

Peter Korsgaard peter at korsgaard.com
Tue Mar 10 20:32:30 UTC 2020


>>>>> "Peter" == Peter Korsgaard <peter at korsgaard.com> writes:

>>>>> "Angelo" == Angelo Compagnucci <angelo at amarulasolutions.com> writes:
 >> egrep/fgrep are using autotools SHELL variable to exec the
 >> grep executable with correct options, SHELL is defaulted to
 >> /bin/bash which we usually don't have on target.
 >> This patch defaults on /bin/sh, when /bin/sh is not available
 >> on target, we simply remove the aliases.

 >> Signed-off-by: Angelo Compagnucci <angelo at amarulasolutions.com>
 >> ---
 >> Changelog:
 >> v1 -> v2:
 >> * Handling the corner case when BR2_SYSTEM_BIN_SH_NONE as suggested by
 >> Yann

 >> package/grep/Config.in | 2 ++
 >> package/grep/grep.mk   | 9 +++++++++
 >> 2 files changed, 11 insertions(+)

 >> diff --git a/package/grep/Config.in b/package/grep/Config.in
 >> index 5b0471b..47ced41 100644
 >> --- a/package/grep/Config.in
 >> +++ b/package/grep/Config.in
 >> @@ -5,6 +5,8 @@ config BR2_PACKAGE_GREP
 >> help
 >> The GNU regular expression matcher.
 
 >> +	  egrep/fgrep aliases need /bin/sh to be available.
 >> +
 >> http://www.gnu.org/software/grep/grep.html
 
 >> comment "grep needs a toolchain w/ wchar"
 >> diff --git a/package/grep/grep.mk b/package/grep/grep.mk
 >> index be3e53b..02d8b50 100644
 >> --- a/package/grep/grep.mk
 >> +++ b/package/grep/grep.mk
 >> @@ -12,6 +12,15 @@ GREP_LICENSE_FILES = COPYING
 >> GREP_DEPENDENCIES = $(TARGET_NLS_DEPENDENCIES)
 >> GREP_CONF_OPTS = --exec-prefix=/
 
 >> +ifeq ($(BR2_SYSTEM_BIN_SH_NONE),y)
 >> +define GREP_REMOVE_ALIAS
 >> +	$(RM) $(TARGET_DIR)/bin/[fe]grep
 >> +endef
 >> +GREP_POST_INSTALL_TARGET_HOOKS += GREP_REMOVE_ALIAS
 >> +else
 >> +GREP_CONF_OPTS += SHELL=/bin/sh

 > It is a bit odd to not do this unconditionally. Such environment
 > variables normally go in _CONF_ENV, so I changed that, reworded the
 > commit message a bit and committed, thanks.

Committed to 2019.02.x and 2019.11.x, thanks.

-- 
Bye, Peter Korsgaard


More information about the buildroot mailing list