naccyde / rpms / iproute

Forked from rpms/iproute 8 months ago
Clone

Blame SOURCES/0001-configure-fix-parsing-issue-on-include_dir-option.patch

24a290
From cef782ca658d695c5ca2d174ba1f89cba6bd84e5 Mon Sep 17 00:00:00 2001
24a290
Message-Id: <cef782ca658d695c5ca2d174ba1f89cba6bd84e5.1637749821.git.aclaudi@redhat.com>
24a290
From: Andrea Claudi <aclaudi@redhat.com>
24a290
Date: Wed, 24 Nov 2021 11:28:08 +0100
24a290
Subject: [PATCH] configure: fix parsing issue on include_dir option
24a290
24a290
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2009355
24a290
Upstream Status: iproute2.git commit 1d819dcc
24a290
24a290
commit 1d819dcc741e25958190e31f8186c940713fa0a8
24a290
Author: Andrea Claudi <aclaudi@redhat.com>
24a290
Date:   Thu Oct 14 10:50:49 2021 +0200
24a290
24a290
    configure: fix parsing issue on include_dir option
24a290
24a290
    configure is stuck in an endless loop if '--include_dir' option is used
24a290
    without a value:
24a290
24a290
    $ ./configure --include_dir
24a290
    ./configure: line 506: shift: 2: shift count out of range
24a290
    ./configure: line 506: shift: 2: shift count out of range
24a290
    [...]
24a290
24a290
    Fix it splitting 'shift 2' into two consecutive shifts, and making the
24a290
    second one conditional to the number of remaining arguments.
24a290
24a290
    A check is also provided after the while loop to verify the include dir
24a290
    exists; this avoid to produce an erroneous configuration.
24a290
24a290
    Fixes: a9c3d70d902a ("configure: add options ability")
24a290
    Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
24a290
    Acked-by: Phil Sutter <phil@nwl.cc>
24a290
    Signed-off-by: David Ahern <dsahern@kernel.org>
24a290
---
24a290
 configure | 9 ++++++---
24a290
 1 file changed, 6 insertions(+), 3 deletions(-)
24a290
24a290
diff --git a/configure b/configure
24a290
index 7f4f3bd9..ea9051ab 100755
24a290
--- a/configure
24a290
+++ b/configure
24a290
@@ -485,7 +485,7 @@ usage()
24a290
 {
24a290
 	cat <
24a290
 Usage: $0 [OPTIONS]
24a290
-	--include_dir		Path to iproute2 include dir
24a290
+	--include_dir <dir>	Path to iproute2 include dir
24a290
 	--libbpf_dir		Path to libbpf DESTDIR
24a290
 	--libbpf_force		Enable/disable libbpf by force. Available options:
24a290
 				  on: require link against libbpf, quit config if no libbpf support
24a290
@@ -502,8 +502,9 @@ else
24a290
 	while true; do
24a290
 		case "$1" in
24a290
 			--include_dir)
24a290
-				INCLUDE=$2
24a290
-				shift 2 ;;
24a290
+				shift
24a290
+				INCLUDE="$1"
24a290
+				[ "$#" -gt 0 ] && shift ;;
24a290
 			--libbpf_dir)
24a290
 				LIBBPF_DIR="$2"
24a290
 				shift 2 ;;
24a290
@@ -523,6 +524,8 @@ else
24a290
 	done
24a290
 fi
24a290
 
24a290
+[ -d "$INCLUDE" ] || usage 1
24a290
+
24a290
 echo "# Generated config based on" $INCLUDE >$CONFIG
24a290
 quiet_config >> $CONFIG
24a290
 
24a290
-- 
24a290
2.31.1
24a290