• [gentoo-dev] [PATCH 3/3] linux-info.eclass: Replace bit-shift arithmeti

    From =?UTF-8?q?Ulrich=20M=C3=BCller?=@21:1/5 to All on Thu Aug 26 11:50:01 2021
    There are kernel versions like 4.9.280, therefore shifting version
    components by 8 bits in kernel_is() may fail.

    Signed-off-by: Ulrich Müller <ulm@gentoo.org>
    ---
    eclass/linux-info.eclass | 9 +++++----
    1 file changed, 5 insertions(+), 4 deletions(-)

    diff --git a/eclass/linux-info.eclass b/eclass/linux-info.eclass
    index 6da13cc0b2f5..9a112199f4b5 100644
    --- a/eclass/linux-info.eclass
    +++ b/eclass/linux-info.eclass
    @@ -395,7 +395,7 @@ kernel_is() {
    linux-info_get_any_version

    # Now we can continue
    - local operator test value
    + local operator

    case ${1#-} in
    lt) operator="-lt"; shift;;
    @@ -407,9 +407,10 @@ kernel_is() {
    esac
    [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"

    - : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
    - : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
    - [ ${test} ${operator} ${value} ]
    + ver_test \
    + "${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}" \
    + "${operator}" \
    + "${1:-${KV_MAJOR}}.${2:-${KV_MINOR}}.${3:-${KV_PATCH}}"
    }

    get_localversion() {
    --
    2.33.0

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1