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:   Wed, 14 Sep 2022 22:00:50 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     David Laight <David.Laight@...lab.com>
Cc:     Nathan Chancellor <nathan@...nel.org>,
        "linux-kbuild@...r.kernel.org" <linux-kbuild@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arch@...r.kernel.org" <linux-arch@...r.kernel.org>
Subject: Re: [PATCH 05/15] kbuild: build init/built-in.a just once

On Wed, Sep 14, 2022 at 6:46 PM David Laight <David.Laight@...lab.com> wrote:
>
> ...
> > > +VERSION=$(cat .version) 2>/dev/null &&
> > > +VERSION=$(expr $VERSION + 1) 2>/dev/null ||
> > > +VERSION=1
>
> What's wrong with:
> VERSION=$(($(cat .version 2>/dev/null) + 1))


One reason was, the original code used 'expr'.



> If you are worried about .version not containing a valid
> number and $((...)) failing then use ${VERSION:-1} later.


Maybe another reason is,
I want to make the behavior deterministic when
the .version file contains a non-integer string.




$ unset FOO
$ echo FOO > .version
$ echo $(($(cat .version 2>/dev/null) + 1))
1


$ export FOO=100
$ echo FOO > .version
$ echo $(($(cat .version 2>/dev/null) + 1))
101




I want the script to consistently return 1
whether or not 'FOO' is available in the user's environment.






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


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ