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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Wed Mar 15 23:46:13 CET 2023


Hi,

FYI, your patch has been queued to stable release 20.11.8

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/17/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://github.com/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/665af7d940592cf80b4ba37e18ee20bb547a57af

Thanks.

Luca Boccassi

---
>From 665af7d940592cf80b4ba37e18ee20bb547a57af 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

[ 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/librte_cmdline/cmdline.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
index 79ea5f98c8..478bcfb161 100644
--- a/lib/librte_cmdline/cmdline.c
+++ b/lib/librte_cmdline/cmdline.c
@@ -205,9 +205,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.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2023-03-15 22:44:50.894361820 +0000
+++ 0022-cmdline-handle-EOF-as-quit.patch	2023-03-15 22:44:49.583850261 +0000
@@ -1 +1 @@
-From 415549f1ccce62b82cb182175346904a65f74cec Mon Sep 17 00:00:00 2001
+From 665af7d940592cf80b4ba37e18ee20bb547a57af Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 415549f1ccce62b82cb182175346904a65f74cec ]
+
@@ -17 +18,0 @@
-Cc: stable at dpdk.org
@@ -21 +22 @@
- lib/cmdline/cmdline.c | 11 ++++++++---
+ lib/librte_cmdline/cmdline.c | 11 ++++++++---
@@ -24,5 +25,5 @@
-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)
+diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c
+index 79ea5f98c8..478bcfb161 100644
+--- a/lib/librte_cmdline/cmdline.c
++++ b/lib/librte_cmdline/cmdline.c
+@@ -205,9 +205,14 @@ cmdline_poll(struct cmdline *cl)


More information about the stable mailing list