lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Dec 2020 10:40:01 +0000
From:   Vincenzo Frascino <vincenzo.frascino@....com>
To:     David Laight <David.Laight@...LAB.COM>,
        'Dominique Martinet' <asmadeus@...ewreck.org>
Cc:     Masahiro Yamada <masahiroy@...nel.org>,
        Michal Marek <michal.lkml@...kovi.net>,
        "linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Krzysztof Kozlowski <krzk@...nel.org>
Subject: Re: [PATCH 1/2] ld-version: use /usr/bin/env awk for shebank

Hi Dominique and Dave,

On 12/9/20 10:03 PM, David Laight wrote:
> From: Dominique Martinet
>> Sent: 09 December 2020 17:43
>>
>> 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@...ewreck.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@...ewreck.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
>> -       }
>> +}'
> 
> Why bother with awk?
> I think you can do it all in a shell function.
> Something like:
> 	read line
> 	line=${line##*)}
> 	line=${line##*version }
> 	IFS='.-'
> 	set $line
> 	echo $(($1*100000000 + $2*1000000 + $3*10000))
> 
> That will work on any recent shell.
> 

I would suggest to revert the patch for now since we are close to the merge
window and then maybe in -rc1 start discussing a better solution.

What do you think?

> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
> 

-- 
Regards,
Vincenzo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ