naccyde / rpms / iproute

Forked from rpms/iproute 8 months ago
Clone

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

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