mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: "Thomas Weißschuh" <linux@weissschuh.net>, "Gary Guo" <gary@garyguo.net>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <martin.lau@linux.dev>,
	Eduard Zingerman <eddyz87@gmail.com>, Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts/gen-btf.sh: fix shebang for NixOS
Date: Tue, 20 Jan 2026 11:53:42 -0800	[thread overview]
Message-ID: <5364d5ec-f30c-40d6-9a99-c251fec3868c@linux.dev> (raw)
In-Reply-To: <ea83b91a-796c-4329-bcf5-2c49efa897fc@t-8ch.de>

On 1/20/26 11:38 AM, Thomas Weißschuh wrote:
> On 2026-01-20 19:15:11+0000, Gary Guo wrote:
>> On Tue Jan 20, 2026 at 6:59 PM GMT, Ihor Solodrai wrote:
>>> On 1/20/26 10:20 AM, Gary Guo wrote:
>>>> From: Gary Guo <gary@garyguo.net>
>>>>
>>>> NixOS only puts /usr/bin/env and /bin/sh at the standard location as
>>>> required by POSIX, but not other shells. Other program that kernel build
>>>> depends on is supplied via PATH, so shebang needs to use /usr/bin/env to
>>>> find them.
>>>>
>>>> This has been done to a few other scripts already, e.g.
>>>> gen_test_kallsyms.sh or decode_stacktrace.sh.
>>>>
>>>> Fixes: 522397d05e7d ("resolve_btfids: Change in-place update with raw binary output")
>>>> Signed-off-by: Gary Guo <gary@garyguo.net>
>>>> ---
>>>>  scripts/gen-btf.sh | 2 +-
>>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/scripts/gen-btf.sh b/scripts/gen-btf.sh
>>>> index be21ccee3487..4cd3159f2ddb 100755
>>>> --- a/scripts/gen-btf.sh
>>>> +++ b/scripts/gen-btf.sh
>>>> @@ -1,4 +1,4 @@
>>>> -#!/bin/bash
>>>> +#!/usr/bin/env bash
>>>>  # SPDX-License-Identifier: GPL-2.0
>>>>  # Copyright (c) 2025 Meta Platforms, Inc. and affiliates.
>>>>  #
>>>>
>>>> base-commit: 053966c344dbd346e71305f530e91ea77916189f
>>>
>>> Hi Gary, thanks for the patch.
>>>
>>> I'm guessing this came up because gen-btf.sh is part of the vmlinux
>>> build, and link-vmlinux.sh has #!/bin/sh (not bash).
>>
>> My typical experience is that when I see an error about /bin/bash not found, I
>> just use "bash <script path>" instead without putting much think into it.
>>
>> gen-btf.sh is part of build so I don't get to invoke the script directly, hence
>> the patch.
> 
> For the build we have $(CONFIG_SHELL) to stick before the script.
> It is only 'sh', but it is the well-known variable users know to
> override. IMO all script invocations should use this mechanism.

There are two places where gen-btf.sh is invoked.

In link-vmlinux.sh:

	if ! ${srctree}/scripts/gen-btf.sh .tmp_vmlinux1; then
		echo >&2 "Failed to generate BTF for vmlinux"
		echo >&2 "Try to disable CONFIG_DEBUG_INFO_BTF"
		exit 1
	fi

And in Makefile.modfinal:

quiet_cmd_btf_ko = BTF [M] $@
      cmd_btf_ko = 							\
	if [ ! -f $(objtree)/vmlinux ]; then				\
		printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \
	else	\
		$(srctree)/scripts/gen-btf.sh --btf_base $(objtree)/vmlinux $@; \
	fi;

So it's trivial to put $(CONFIG_SHELL) in front of it. But then it
must be migrated to #!/bin/sh, right?


> 
> 
> Thomas


  reply	other threads:[~2026-01-20 19:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 18:20 Gary Guo
2026-01-20 18:59 ` Ihor Solodrai
2026-01-20 19:15   ` Gary Guo
2026-01-20 19:38     ` Thomas Weißschuh
2026-01-20 19:53       ` Ihor Solodrai [this message]
2026-01-20 23:54         ` Gary Guo
2026-01-21  4:49           ` Ihor Solodrai
2026-01-21  4:52             ` Alexei Starovoitov
2026-01-21  5:04               ` Ihor Solodrai
2026-01-21 16:09                 ` Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5364d5ec-f30c-40d6-9a99-c251fec3868c@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=gary@garyguo.net \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®