patch 'cmdline: handle EOF as quit' has been queued to stable release 22.11.2

Xueming Li xuemingl at nvidia.com
Sun Apr 9 17:24:17 CEST 2023


Hi,

FYI, your patch has been queued to stable release 22.11.2

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/11/23. 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=22.11-staging

This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/log/?h=22.11-staging/commit/564dbb6a03e87eb4818098b6884da37c72e4f3be

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 564dbb6a03e87eb4818098b6884da37c72e4f3be Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Fri, 3 Feb 2023 11:14:08 -0800
Subject: [PATCH] cmdline: handle EOF as quit
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 415549f1ccce62b82cb182175346904a65f74cec ]

If end of file is reached on input, then cmdline_poll() will
return 1 (ie file has something); and then the cmdline_in()
call to read will return 0. With the existing code,
caller has no way to tell that end of file has been reached
 and will retry forever.

A good way to handle this is to make end of file equivalent
to the quit command. Since no more input is possible at that
point.

Fixes: 067855e651d6 ("cmdline: add polling mode")

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/cmdline/cmdline.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/cmdline/cmdline.c b/lib/cmdline/cmdline.c
index e1009ba4c4..8ad0690d85 100644
--- a/lib/cmdline/cmdline.c
+++ b/lib/cmdline/cmdline.c
@@ -197,9 +197,14 @@ cmdline_poll(struct cmdline *cl)
 		if (read_status < 0)
 			return read_status;
 
-		status = cmdline_in(cl, &c, 1);
-		if (status < 0 && cl->rdl.status != RDLINE_EXITED)
-			return status;
+		if (read_status == 0) {
+			/* end of file is implicit quit */
+			cmdline_quit(cl);
+		} else {
+			status = cmdline_in(cl, &c, 1);
+			if (status < 0 && cl->rdl.status != RDLINE_EXITED)
+				return status;
+		}
 	}
 
 	return cl->rdl.status;
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-04-09 21:45:40.539801600 +0800
+++ 0069-cmdline-handle-EOF-as-quit.patch	2023-04-09 21:45:38.679042200 +0800
@@ -1 +1 @@
-From 415549f1ccce62b82cb182175346904a65f74cec Mon Sep 17 00:00:00 2001
+From 564dbb6a03e87eb4818098b6884da37c72e4f3be Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 415549f1ccce62b82cb182175346904a65f74cec ]
@@ -17 +19,0 @@
-Cc: stable at dpdk.org


More information about the stable mailing list