From 2c9430123e7e6f4bc6e00bb8b3af4e676280d2b3 Mon Sep 17 00:00:00 2001 From: Liang Zhou Date: Mon, 28 Jun 2021 15:54:52 +0800 Subject: [PATCH] agent: fix wrong regular exp to fetch guest-cid Fix the incorrect regular expression to fetch the guest context ID. In " [^,][^,]* ", [^,]* will match to the next ",", which is after "socket", so finally got incorrect result. Use egrep -o "guest-cid=[0-9]*" instead. Fixes: #2124 Signed-off-by: Liang Zhou --- tools/agent-ctl/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/agent-ctl/README.md b/tools/agent-ctl/README.md index 47a1776ee2..8cd5954b5e 100644 --- a/tools/agent-ctl/README.md +++ b/tools/agent-ctl/README.md @@ -80,7 +80,7 @@ $ sudo docker export $(sudo docker create "$image") | tar -C "$rootfs_dir" -xvf value: ```sh - $ guest_cid=$(ps -ef | grep qemu-system-x86_64 | egrep -o "guest-cid=[^,][^,]*" | cut -d= -f2) + $ guest_cid=$(ps -ef | grep qemu-system-x86_64 | egrep -o "guest-cid=[0-9]*" | cut -d= -f2) ``` 1. Run the tool to connect to the agent: