naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

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

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