From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 20A931382C5 for ; Fri, 22 May 2020 19:13:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 431D1E08D3; Fri, 22 May 2020 19:13:40 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 05342E087C for ; Fri, 22 May 2020 19:13:39 +0000 (UTC) Received: by sf.home (Postfix, from userid 1000) id 5981E5A22061; Fri, 22 May 2020 20:13:35 +0100 (BST) From: Sergei Trofimovich To: gentoo-dev@lists.gentoo.org Cc: Sergei Trofimovich , kernel@gentoo.org Subject: [gentoo-dev] [PATCH] kernel-2.eclass: avoid lexicographical compare on versions, bug #705246 Date: Fri, 22 May 2020 20:13:33 +0100 Message-Id: <20200522191333.1689849-1-slyfox@gentoo.org> X-Mailer: git-send-email 2.26.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: b2096ad6-a528-45b1-afb7-fdbe55b37e4f X-Archives-Hash: e6eef477d11592e00bead2ad5168d7d5 Originally found in bug #705240 as: ``` if [[ ... || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then ``` '>' are string comparisons. They are benign so far, but will start failing on linux-10 :) Let's be consistent and use version comparison. CC: kernel@gentoo.org Closes: https://bugs.gentoo.org/705246 Signed-off-by: Sergei Trofimovich --- eclass/kernel-2.eclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass index 07af8d8ab2c..d69182045c5 100644 --- a/eclass/kernel-2.eclass +++ b/eclass/kernel-2.eclass @@ -1015,7 +1015,7 @@ postinst_sources() { # K_SECURITY_UNSUPPORTED=deblob # if we are to forcably symlink, delete it if it already exists first. - if [[ ${K_SYMLINK} > 0 ]]; then + if [[ ${K_SYMLINK} -gt 0 ]]; then [[ -h ${EROOT}usr/src/linux ]] && { rm "${EROOT}"usr/src/linux || die; } MAKELINK=1 fi @@ -1078,7 +1078,7 @@ postinst_sources() { KV_PATCH=$(ver_cut 3 ${OKV}) if [[ "$(tc-arch)" = "sparc" ]]; then if [[ $(gcc-major-version) -lt 4 && $(gcc-minor-version) -lt 4 ]]; then - if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then + if [[ ${KV_MAJOR} -ge 3 || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.24 ]] ; then echo elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that" elog "you now need to do" @@ -1272,7 +1272,7 @@ unipatch() { # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot # bug #272676 if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then - if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then + if [[ ${KV_MAJOR} -ge 3 || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.28 ]]; then if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor*.patch" echo @@ -1521,7 +1521,7 @@ kernel-2_src_unpack() { # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox # only do this for kernel < 2.6.27 since this file does not exist in later # kernels - if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then + if [[ -n ${KV_MINOR} && ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -lt 2.6.27 ]] ; then sed -i \ -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \ "${S}"/arch/ppc/Makefile -- 2.26.2