From: Dominique Martinet <asmadeus@codewreck.org>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Masahiro Yamada <masahiroy@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
linux-kbuild@vger.kernel.org
Subject: Re: Broken /usr/bin/env (invalid option)
Date: Wed, 9 Dec 2020 17:20:20 +0100 [thread overview]
Message-ID: <20201209162020.GA15684@nautica> (raw)
In-Reply-To: <CAJKOXPfXkZdVUuunpvLOCEim0TfRwG62hvrZu_R8vGkA+ZOapQ@mail.gmail.com>
Krzysztof Kozlowski wrote on Wed, Dec 09, 2020:
> > Hm, what version of env is that?
> > I only checked on a couple of systems that env -S exists, but it might
> > not be available (e.g. now I'm looking, at least busybox env does not
> > provide -S)
>
> $ env --version
> env (GNU coreutils) 8.25
Ok, so this is a much newer option than I thought it was, sorry for my
lack of checking.
I know we no longer support older gccs but it's probably best to keep
supporting this.
> > I don't see any way to make this work out of the box for me (awk not in
> > /usr/bin) and you (env not supporting -S), but I guess I can keep that
> > patch around locally...
>
> You could add a wrapper which uses PATH or searches for the awk...
> kind of reimplement other tools. Another solution is to clearly
> document the requirements for the build system and explicitly say that
> older systems like four-year Ubuntu are not supported.
Well there definitely are ways, but I'm not sure it's worth it...
For example another idea is just to use /bin/sh (which is mandated to
exist) and have it invoke awk, the script is short enough to just quote
it.
Yamada-san, how about this instead?
But to be honest I'm fine with dropping my patch altogether, I'll work
around it locally if it's too much.
---
From d53ef3b4c55aa2ea5f9ae887b3e1ace368f30f66 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Wed, 15 Jul 2020 16:00:13 +0200
Subject: [PATCH] ld-version: use /bin/sh then awk for shebank
/usr/bin/awk is not garanteed to exist (and doesn't on e.g. nixos),
using /bin/sh and invoking awk to have it look in PATH is more robust.
Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
diff --git a/scripts/ld-version.sh b/scripts/ld-version.sh
index f2be0ff9a738..02dbad7b5613 100755
--- a/scripts/ld-version.sh
+++ b/scripts/ld-version.sh
@@ -1,11 +1,11 @@
-#!/usr/bin/awk -f
+#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# extract linker version number from stdin and turn into single number
- {
+awk '{
gsub(".*\\)", "");
gsub(".*version ", "");
gsub("-.*", "");
split($1,a, ".");
print a[1]*100000000 + a[2]*1000000 + a[3]*10000;
exit
- }
+}'
prev parent reply other threads:[~2020-12-09 16:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 12:24 Broken /usr/bin/env (invalid option) Krzysztof Kozlowski
2020-12-09 13:07 ` Dominique Martinet
2020-12-09 13:56 ` Krzysztof Kozlowski
2020-12-09 16:20 ` Dominique Martinet [this message]
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=20201209162020.GA15684@nautica \
--to=asmadeus@codewreck.org \
--cc=krzk@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
/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