Re: [PATCH 1/2] ld-version: use /usr/bin/env awk for shebank

From: Vincenzo Frascino
Date: Wed Dec 09 2020 - 12:30:00 EST


Hi Dominique,

On 12/1/20 1:17 PM, Dominique Martinet wrote:
> /usr/bin/awk is not garanteed to exist (and doesn't on e.g. nixos),
> using /usr/bin/env to have it look in PATH is more robust
>

This patch breaks the compilation on Ubuntu 16.04 and 18.04 in fact:

make[1]: Entering directory '/data1/Projects/LinuxKernel/linux-out'
GEN Makefile
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
*** Default configuration is based on 'defconfig'
/usr/bin/env: invalid option -- 'S'
Try '/usr/bin/env --help' for more information.
init/Kconfig:39: syntax error
init/Kconfig:38: invalid statement
/data1/Projects/LinuxKernel/linux-mte/scripts/kconfig/Makefile:80: recipe for
target 'defconfig' failed
make[2]: *** [defconfig] Error 1
/data1/Projects/LinuxKernel/linux-mte/Makefile:602: recipe for target
'defconfig' failed
make[1]: *** [defconfig] Error 2
make[1]: Leaving directory '/data1/Projects/LinuxKernel/linux-out'
Makefile:185: recipe for target '__sub-make' failed
make: *** [__sub-make] Error 2

The problem seems to be that the minimum version of env that supports '-S' is 8.30.

Reverting the patch fixes the issue.

Thanks!

> Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>
> ---
> I've been carrying these two patchs for local kernel development on
> nixos for a while, I don't think it'd break anything for anyone so
> might as well submit these -- please consider it :)
>
> scripts/ld-version.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
> index f2be0ff9a738..05476b8f8925 100755
> --- a/scripts/ld-version.sh
> +++ b/scripts/ld-version.sh
> @@ -1,4 +1,4 @@
> -#!/usr/bin/awk -f
> +#!/usr/bin/env -S awk -f
> # SPDX-License-Identifier: GPL-2.0
> # extract linker version number from stdin and turn into single number
> {
>

--
Regards,
Vincenzo