Re: Solaris and sed: Too many commands, last: s/\n//
- Date: Mon, 11 Mar 2019 22:45:42 -0400
- From: Eric Sunshine <sunshine@xxxxxxxxxxxxxx>
- Subject: Re: Solaris and sed: Too many commands, last: s/\n//
On Mon, Mar 11, 2019 at 10:11:41PM -0400, Jeffrey Walton wrote:
> On Mon, Mar 11, 2019 at 9:55 PM Jeffrey Walton <noloader@xxxxxxxxx> wrote:
> > Oh man, you're using GNU make. I thought Git was using that anemic
> > Posix Make. See attached.
> > I think Solaris provides an older gawk. Is this an easier problem:
> > awk: chainlint.sed:88: :squash
> > awk: chainlint.sed:88: ^ syntax error
> > awk: chainlint.sed:91: s/\\\n//
> > awk: chainlint.sed:91: ^ backslash not last character on line
> > Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
> > Usage: awk [POSIX or GNU style options] [--] 'program' file ...
> My bad , there was a typo... 'awk' got assigned to SED variable.
> This patch works as expected.
> diff --git a/t/Makefile b/t/Makefile
> @@ -11,11 +11,25 @@ SHELL_PATH ?= $(SHELL)
> TAR ?= $(TAR)
> +AWK ?= $(AWK)
> +SED ?= $(SED)
> +GREP ?= $(GREP)
> +# Fix Solaris tools. These are Posix. GNU tools located at /usr/gnu/bin.
> +ifneq ($(wildcard /usr/gnu/bin/grep),)
> + GREP := /usr/gnu/bin/grep
> +ifneq ($(wildcard /usr/gnu/bin/sed),)
> + SED := /usr/gnu/bin/sed
> +ifneq ($(wildcard /usr/gnu/bin/awk),)
> + SED := /usr/gnu/bin/awk
I think the last assignment ought to be "AWK := ...".
Anyhow, this sort of platform-specific tool customization is typically done by config.mak.uname in the top-level Git directory. In fact, there's already a section for SunOS:
SANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin
Prepending /usr/gnu/bin to SANE_TOOL_PATH might be a good idea as a first step toward fixing the problem you're seeing on Solaris, however, as Ævar mentioned in , SANE_TOOL_PATH isn't presently consulted when running tests. But, as he suggested, fixing the tests to respect SANE_TOOL_PATH might be a good solution overall.
So, rather than making platform-specific customizations to t/Makefile, an arguably better solution would be to update config.mak.uname to add /usr/gnu/bin to SANE_TOOL_PATH and then update the test system to respect that value (thus, these GREP, SED, AWK specializations can be avoided).