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] [day] [month] [year] [list]
Message-ID: <a9bc168cd2b84cc29e6cd4d25387a4f4@AcuMS.aculab.com>
Date:   Thu, 10 Dec 2020 22:43:28 +0000
From:   David Laight <David.Laight@...LAB.COM>
To:     'Dominique Martinet' <asmadeus@...ewreck.org>,
        Vincenzo Frascino <vincenzo.frascino@....com>
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

From: 'Dominique Martinet'
> Sent: 10 December 2020 12:22
> 
> Vincenzo Frascino wrote on Thu, Dec 10, 2020:
> > On 12/9/20 10:03 PM, David Laight wrote:
> >> Why bother with awk?
> 
> I wanted to keep the patch minimal, I'm not opposed to rewriting but
> that always potentially has more impact (although as you say, this
> script is simple enough)
> 
> > > 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.
> 
> Works for me.

That was a very quick rewrite of what I think the awk script did.
However I think the version is in the last space-separated word.
So you can do (untested):
	read line
	set line
	shift $(($#-1))
	OIFS="$IFS"
	IFS='.-'
	set $1
	IFS="$OIFS"
	echo $(($1*100000000 + $2*1000000 + $3*10000))

Now, if you want a version that will work with a real bourne shell
(that doesn't support $((expr)) or $(x##b} it gets more interesting.

Yes, but for now, revert first.
It might even be that the whole file isn't needed.
If it only used from a Makefile it can be gone with gmake commands.

	David

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ