Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Wed, 27 May 2020 19:21:08
Message-Id: 1590607257.c54b9d619157d9a24e72f04d5698a00ee9a368dd.slyfox@gentoo
1 commit: c54b9d619157d9a24e72f04d5698a00ee9a368dd
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Fri May 22 19:10:43 2020 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Wed May 27 19:20:57 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c54b9d61
7
8 kernel-2.eclass: avoid lexicographical compare on versions, bug #705246
9
10 Originally found in bug #705240 as:
11
12 ```
13 if [[ ... || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
14 ```
15
16 '>' are string comparisons. They are benign so far, but
17 will start failing on linux-10 :)
18
19 Let's be consistent and use version comparison.
20
21 Closes: https://bugs.gentoo.org/705246
22 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
23
24 eclass/kernel-2.eclass | 8 ++++----
25 1 file changed, 4 insertions(+), 4 deletions(-)
26
27 diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
28 index 07af8d8ab2c..930bcf22e29 100644
29 --- a/eclass/kernel-2.eclass
30 +++ b/eclass/kernel-2.eclass
31 @@ -1015,7 +1015,7 @@ postinst_sources() {
32 # K_SECURITY_UNSUPPORTED=deblob
33
34 # if we are to forcably symlink, delete it if it already exists first.
35 - if [[ ${K_SYMLINK} > 0 ]]; then
36 + if [[ ${K_SYMLINK} -gt 0 ]]; then
37 [[ -h ${EROOT}usr/src/linux ]] && { rm "${EROOT}"usr/src/linux || die; }
38 MAKELINK=1
39 fi
40 @@ -1078,7 +1078,7 @@ postinst_sources() {
41 KV_PATCH=$(ver_cut 3 ${OKV})
42 if [[ "$(tc-arch)" = "sparc" ]]; then
43 if [[ $(gcc-major-version) -lt 4 && $(gcc-minor-version) -lt 4 ]]; then
44 - if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then
45 + if [[ ${KV_MAJOR} -ge 3 ]] || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.24 ; then
46 echo
47 elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
48 elog "you now need to do"
49 @@ -1272,7 +1272,7 @@ unipatch() {
50 # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
51 # bug #272676
52 if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
53 - if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
54 + if [[ ${KV_MAJOR} -ge 3 ]] || ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -gt 2.6.28 ; then
55 if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
56 UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor*.patch"
57 echo
58 @@ -1521,7 +1521,7 @@ kernel-2_src_unpack() {
59 # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
60 # only do this for kernel < 2.6.27 since this file does not exist in later
61 # kernels
62 - if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then
63 + if [[ -n ${KV_MINOR} ]] && ver_test ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} -lt 2.6.27 ; then
64 sed -i \
65 -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
66 "${S}"/arch/ppc/Makefile