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

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