patch 'app/testpmd: fix error message for invalid option' has been queued to stable release 23.11.1

Xueming Li xuemingl at nvidia.com
Sat Apr 13 14:49:30 CEST 2024


Hi,

FYI, your patch has been queued to stable release 23.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 04/15/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=97089aa02e6cc724601cae527ff8ddb3ca0479e3

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 97089aa02e6cc724601cae527ff8ddb3ca0479e3 Mon Sep 17 00:00:00 2001
From: David Marchand <david.marchand at redhat.com>
Date: Thu, 14 Mar 2024 10:17:04 +0100
Subject: [PATCH] app/testpmd: fix error message for invalid option
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit c25382fa81533429d5968b47b356c79153b76212 ]

"""
The variable optind is the index of the next element to be processed in
argv.  The system initializes this value to 1.  The caller can reset it
to 1 to restart scanning of the same argv, or when scanning a new
argument vector.
"""

Hence, if an invalid option is passed through testpmd cmdline, getopt
returns '?' and increments optind to the next index in argv for a
subsequent call.
The message should log the previous index.

Fixes: 8fad2e5ab2c5 ("app/testpmd: report invalid command line parameter")

Signed-off-by: David Marchand <david.marchand at redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit at amd.com>
---
 app/test-pmd/parameters.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index 3414a0d38c..a4c09e2a2b 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -1497,7 +1497,7 @@ launch_args_parse(int argc, char** argv)
 			break;
 		default:
 			usage(argv[0]);
-			fprintf(stderr, "Invalid option: %s\n", argv[optind]);
+			fprintf(stderr, "Invalid option: %s\n", argv[optind - 1]);
 			rte_exit(EXIT_FAILURE,
 				 "Command line is incomplete or incorrect\n");
 			break;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-04-13 20:43:07.759182325 +0800
+++ 0090-app-testpmd-fix-error-message-for-invalid-option.patch	2024-04-13 20:43:05.047753866 +0800
@@ -1 +1 @@
-From c25382fa81533429d5968b47b356c79153b76212 Mon Sep 17 00:00:00 2001
+From 97089aa02e6cc724601cae527ff8ddb3ca0479e3 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit c25382fa81533429d5968b47b356c79153b76212 ]
@@ -19 +21,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list