Re: [PATCH] scripts/gen-btf.sh: fix shebang for NixOS

From: Alexei Starovoitov

Date: Wed Jan 21 2026 - 11:10:05 EST


On Tue, Jan 20, 2026 at 9:04 PM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
>
>
>
> On 1/20/26 8:52 PM, Alexei Starovoitov wrote:
> > On Tue, Jan 20, 2026 at 8:50 PM Ihor Solodrai <ihor.solodrai@xxxxxxxxx> wrote:
> >>
> >>
> >>
> >> On 1/20/26 3:54 PM, Gary Guo wrote:
> >>>> [...]
> >>>>
> >>>> So it's trivial to put $(CONFIG_SHELL) in front of it. But then it
> >>>> must be migrated to #!/bin/sh, right?
> >>>
> >>> Documentation/kbuild/makefiles.rst says:
> >>>
> >>> Make rules may invoke scripts to build the kernel. The rules shall
> >>> always provide the appropriate interpreter to execute the script. They
> >>> shall not rely on the execute bits being set, and shall not invoke the
> >>> script directly. For the convenience of manual script invocation, such
> >>> as invoking ./scripts/checkpatch.pl, it is recommended to set execute
> >>> bits on the scripts nonetheless.
> >>>
> >>> Kbuild provides variables $(CONFIG_SHELL), $(AWK), $(PERL),
> >>> and $(PYTHON3) to refer to interpreters for the respective
> >>> scripts.
> >>>
> >>> So I suppose it would need to migate to POSIX shell...
> >>
> >> That's my blunder then.
> >>
> >> I'll send a patch tomorrow to make gen-btf.sh runnable with /bin/sh
> >
> > Isn't the current patch enough?
> > -#!/bin/bash
> > +#!/usr/bin/env bash
> >
> > I don't think all kernel build scripts are pure 'sh'.
>
> Well, if we want to follow the makefiles.rst (and Thomas')
> recommendation, which is executing the script via $(CONFIG_SHELL),
> then we have to migrate to #!/bin/sh, because that's the default.
>
> This concerns only scripts in the kernel build pipeline AFAIU.
>
> But you may be right that this is not a strict rule, idk.
> It did come up quite late on the list.

git grep CONFIG_SHELL|wc -l
68

ok, let's convert to pure sh then.