mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ian Rogers <irogers@google.com>
To: irogers@google.com, acme@kernel.org, namhyung@kernel.org
Cc: adrian.hunter@intel.com, andrii@kernel.org,
	cupertino.miranda@oracle.com,  eddyz87@gmail.com,
	james.clark@linaro.org, jolsa@kernel.org,
	 jose.marchesi@oracle.com, linux-kernel@vger.kernel.org,
	 linux-perf-users@vger.kernel.org, mingo@redhat.com,
	peterz@infradead.org,  yonghong.song@linux.dev
Subject: [PATCH v4 1/5] tools build: Fix version-ge3 and version-lt3 for <3-part versions
Date: Wed, 11 Nov 2026 17:15:10 -0800	[thread overview]
Message-ID: <20261112011514.4032822-2-irogers@google.com> (raw)
In-Reply-To: <20261112011514.4032822-1-irogers@google.com>

version-ge3 and version-lt3 concatenate their two arguments as
"$(1).$(2)" and parse fields $1..$6 with awk -F'.'. When $(1) is empty
or has fewer than three dot-separated components (for example GCC's
1- or 2-part -dumpversion output), fields $4..$6 shift across the
boundary between $(1) and $(2). In particular, calling version-lt3 with
an empty $(1) against "14.0.0" evaluates 0 < 0 and returns 0 (false).

Pass $(1) and $(2) as separate awk variables and split each into its own
array so missing components default to 0 without shifting fields across
arguments.

Fixes: a9b451509565 ("tools build: Add 3-component logical version comparators")
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/scripts/utilities.mak | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/scripts/utilities.mak b/tools/scripts/utilities.mak
index d69d0345cc23..746aaf6e5145 100644
--- a/tools/scripts/utilities.mak
+++ b/tools/scripts/utilities.mak
@@ -186,7 +186,7 @@ _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
 # was to check the flex version to see if we can use compiler warnings as
 # errors for one of the cases flex generates code C compilers complains about.
 
-version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) >= (10000000 * $$4 + 10000 * $$5 + $$6)) }')
+version-ge3 = $(shell awk -v v1="$(1)" -v v2="$(2)" 'BEGIN { split(v1, a, "."); split(v2, b, "."); printf("%d\n", (10000000 * a[1] + 10000 * a[2] + a[3]) >= (10000000 * b[1] + 10000 * b[2] + b[3])) }')
 
 # version-lt3
 #
@@ -196,4 +196,4 @@ version-ge3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 *
 # check the flex version to see if we can use compiler warnings as errors for
 # one of the cases flex generates code C compilers complains about.
 
-version-lt3 = $(shell echo "$(1).$(2)" | awk -F'.' '{ printf("%d\n", (10000000 * $$1 + 10000 * $$2 + $$3) < (10000000 * $$4 + 10000 * $$5 + $$6)) }')
+version-lt3 = $(shell awk -v v1="$(1)" -v v2="$(2)" 'BEGIN { split(v1, a, "."); split(v2, b, "."); printf("%d\n", (10000000 * a[1] + 10000 * a[2] + a[3]) < (10000000 * b[1] + 10000 * b[2] + b[3])) }')
-- 
2.56.0.567.gdb80ae8cd5-goog


  reply	other threads:[~2026-11-12  1:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 22:16 [PATCH v1 0/2] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-10-13 22:16 ` [PATCH v1 1/2] " Ian Rogers
2026-10-13 22:16 ` [PATCH v1 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc Ian Rogers
2026-10-13 23:14 ` [PATCH v2 0/2] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-10-13 23:14   ` [PATCH v2 1/2] " Ian Rogers
2026-10-13 23:14   ` [PATCH v2 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc Ian Rogers
2026-10-22 20:46   ` [PATCH v3 0/2] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-10-22 20:46     ` [PATCH v3 1/2] " Ian Rogers
2026-11-11  6:01       ` Namhyung Kim
2026-10-22 20:46     ` [PATCH v3 2/2] perf test make: Add BPF skeleton build tests for clang and bpf-gcc Ian Rogers
2026-11-04  3:52     ` [PATCH v3 0/2] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-11-10 22:10       ` Ian Rogers
2026-11-12  1:15     ` [PATCH v4 0/5] " Ian Rogers
2026-11-12  1:15       ` Ian Rogers [this message]
2026-11-12  1:15       ` [PATCH v4 2/5] perf build: Sync bpf_skel.mak get_sys_includes with selftests/bpf Ian Rogers
2026-11-12  1:15       ` [PATCH v4 3/5] perf build: Support building BPF skeletons with bpf-gcc Ian Rogers
2026-11-12  1:15       ` [PATCH v4 4/5] perf test make: Reuse Makefile.feature for libbfd and llvm probes Ian Rogers
2026-11-12  1:15       ` [PATCH v4 5/5] perf test make: Add BPF skeleton build tests for clang and bpf-gcc Ian Rogers

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=20261112011514.4032822-2-irogers@google.com \
    --to=irogers@google.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=andrii@kernel.org \
    --cc=cupertino.miranda@oracle.com \
    --cc=eddyz87@gmail.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=jose.marchesi@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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®