Skip to contentSkip to conversation

configure: Silence shift warning in version_ge()

PATCH In review Philippe Mathieu-Daudé 1 participant 2 messages Aug 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: Silence shift warning in version_ge()

As we might expect less than 2 argument, only shift again if there is arguments to shift.

This fixes:

../configure: line 232: shift: shift count out of range

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +1 -1
index 4e5fe332110..cf044ad2d25 100755
@@ -229,7 +229,7 @@ version_ge () {
         set x $local_ver1
         local_first=${2-0}
         # shift 2 does nothing if there are less than 2 arguments
-        shift; shift
+        shift || shift
         local_ver1=$*
         set x $local_ver2
         # the second argument finished, the first must be greater or equal
Signature · 1 line
2.26.2
#1 lore raw
Quoted 17 lines · Philippe Mathieu-Daudé

As we might expect less than 2 argument, only shift again if there is arguments to shift.

This fixes:

../configure: line 232: shift: shift count out of range

---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configure +0 -0
index 4e5fe332110..cf044ad2d25 100755

configure version_ge () { · line 232

Quoted 5 lines
configure +1 -1
@@ -229,7 +229,7 @@ version_ge () {
         set x $local_ver1
         local_first=${2-0}
         # shift 2 does nothing if there are less than 2 arguments
-        shift; shift
+        shift || shift

As Stefano noted, this does not work as intended, so please discard this invalid patch.

Quoted 4 lines
configure +0 -0
         local_ver1=$*
         set x $local_ver2
         # the second argument finished, the first must be greater or equal