commit:     3cdc17858512146c01a4476e690efbd8c7229c07
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 23 05:39:55 2017 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> 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

Reply via email to