[dpdk-stable] patch 'usertools: fix handling EOF for telemetry input pipe' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:29:29 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/ad4051ca8f5fac9d1ad173ab8c4f7d24cc115258

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From ad4051ca8f5fac9d1ad173ab8c4f7d24cc115258 Mon Sep 17 00:00:00 2001
From: Bruce Richardson <bruce.richardson at intel.com>
Date: Mon, 13 Sep 2021 11:51:36 +0100
Subject: [PATCH] usertools: fix handling EOF for telemetry input pipe
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit 744e9a87c582d687d5d20b61b7ee0835da421541 ]

To allow the script to take queries from input pipes e.g. "echo
/ethdev/stats,0 | dpdk-telemetry.py", we need to handle the case of EOF
correctly without crashing with an exception. Do this by using a
try-except block around the input handling.

Fixes: 6a2967c112a3 ("usertools: add new telemetry script")

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Ciara Power <ciara.power at intel.com>
---
 usertools/dpdk-telemetry.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index 181859658f..a71f1e9ff9 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -51,13 +51,17 @@ def handle_socket(path):
     CMDS = read_socket(sock, output_buf_len, False)["/"]
 
     # interactive prompt
-    text = input('--> ').strip()
-    while text != "quit":
-        if text.startswith('/'):
-            sock.send(text.encode())
-            read_socket(sock, output_buf_len)
+    try:
         text = input('--> ').strip()
-    sock.close()
+        while text != "quit":
+            if text.startswith('/'):
+                sock.send(text.encode())
+                read_socket(sock, output_buf_len)
+            text = input('--> ').strip()
+    except EOFError:
+        pass
+    finally:
+        sock.close()
 
 
 def readline_complete(text, state):
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:05.827601818 +0800
+++ 0085-usertools-fix-handling-EOF-for-telemetry-input-pipe.patch	2021-11-10 14:17:01.847412948 +0800
@@ -1 +1 @@
-From 744e9a87c582d687d5d20b61b7ee0835da421541 Mon Sep 17 00:00:00 2001
+From ad4051ca8f5fac9d1ad173ab8c4f7d24cc115258 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 744e9a87c582d687d5d20b61b7ee0835da421541 ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -21 +23 @@
-index bdc617db18..7ebbb64fce 100755
+index 181859658f..a71f1e9ff9 100755
@@ -24 +26 @@
-@@ -69,13 +69,17 @@ def handle_socket(path):
+@@ -51,13 +51,17 @@ def handle_socket(path):


More information about the stable mailing list