lkml.org 
[lkml]   [2020]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/2] ld-version: use /usr/bin/env awk for shebank
Vincenzo Frascino wrote on Wed, Dec 09, 2020:
> 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:

Thanks for the report, I was told the same by Krzysztof Kozlowski (added
to Ccs) earlier today, I don't have any "old" machines like this around
so didn't notice when I checked unfortunately :(


I've suggested either just reverting this (I'll keep my local
workaround) or going through /bin/sh which is always safe like the
following patch -- leaving this to maintainers.

Thanks!
-----
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
- }
+}'
\
 
 \ /
  Last update: 2020-12-09 18:45    [W:1.619 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site