naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

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

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