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 4E99F1396D0 for ; Sat, 23 Sep 2017 05:46:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9FA40E083E; Sat, 23 Sep 2017 05:46:22 +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 7EFEAE083E for ; Sat, 23 Sep 2017 05:46:22 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7165733BE3E for ; Sat, 23 Sep 2017 05:46:21 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E521B907F for ; Sat, 23 Sep 2017 05:46:19 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1506145195.3cdc17858512146c01a4476e690efbd8c7229c07.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/eapi7-ver.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 3cdc17858512146c01a4476e690efbd8c7229c07 X-VCS-Branch: eapi7-ver Date: Sat, 23 Sep 2017 05:46:19 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 43374946-6f7b-4a47-9038-7dfd16fbd8d0 X-Archives-Hash: 2eba5ed8bab599aa1c5fa96aaa46355e commit: 3cdc17858512146c01a4476e690efbd8c7229c07 Author: Ulrich Müller gentoo org> AuthorDate: Sat Sep 23 05:39:55 2017 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Sat Sep 23 05:39:55 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3cdc1785 eapi7-ver.eclass: Fixup: Use regexp matching rather than loop. eclass/eapi7-ver.eclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass index d1d98231002..5ca8b8143af 100644 --- a/eclass/eapi7-ver.eclass +++ b/eclass/eapi7-ver.eclass @@ -212,9 +212,9 @@ _ver_compare() { a=${an%%.*} b=${bn%%.*} if [[ ${a} == 0* || ${b} == 0* ]]; then - # Remove trailing zeros - while [[ ${a} == *0 ]]; do a=${a::-1}; done - while [[ ${b} == *0 ]]; do b=${b::-1}; done + # Remove any trailing zeros + [[ ${a} =~ 0+$ ]] && a=${a%"${BASH_REMATCH[0]}"} + [[ ${b} =~ 0+$ ]] && b=${b%"${BASH_REMATCH[0]}"} [[ ${a} > ${b} ]] && return 3 [[ ${a} < ${b} ]] && return 1 else