1 Star 0 Fork 71

ccxiaop/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vsh-Fix-completion-error-in-case-of-multiple-mac-add.patch 1.92 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-12-06 15:38 . libvirt update to version 6.2.0-47
From 35d3169072522ad6a2bd6f046fde7881c2837c74 Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Wed, 30 Nov 2022 08:25:26 +0000
Subject: [PATCH 11/24] vsh: Fix completion error in case of multiple mac
addresses We know that the bash completer automatically handle colon by
preceding it with an escape character backslash. While our bash autompletion
file vsh completes multiple items, In case there're multiple items which have
same prefix and the content of completion items contain colon(say mac
address), The vsh needs to correctly hands the backslash which are added by
bash completer, Otherwise the completion won't be successful. This patch
fixes this problem.
e.g.:
# virsh domiflist --domain VM
Interface Type Source Model MAC
-------------------------------------------------------------
vnet0 network default virtio 52:54:00:fb:7b:f5
vnet1 bridge br0 virtio 52:54:00:80:1b:21
Before:
# virsh detach-interface --domain VM --mac <TAB>
# virsh detach-interface --domain VM --mac 52\:54\:00\:<TAB><TAB>
After:
# virsh detach-interface --domain VM --mac <TAB>
# virsh detach-interface --domain VM --mac 52\:54\:00\:<TAB><TAB>
52:54:00:80:1b:21 52:54:00:fb:7b:f5
# virsh detach-interface --domain VM --mac 52\:54\:00\:
Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: tangbin <tangbin_yewu@cmss.chinamobile.com>
(cherry-pick from 8a4343a4366580644bde3ba9b6a21bf740503416)
---
tools/bash-completion/vsh | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/bash-completion/vsh b/tools/bash-completion/vsh
index 363097c601..ca9d37a7ff 100644
--- a/tools/bash-completion/vsh
+++ b/tools/bash-completion/vsh
@@ -39,6 +39,7 @@ _vsh_complete()
fi
INPUT=( "${COMP_WORDS[@]:$i:$COMP_CWORD}" )
+ INPUT[-1]=${INPUT[-1]//\\:/:}
# Uncomment these lines for easy debug.
# echo;
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ccxiaop/libvirt.git
git@gitee.com:ccxiaop/libvirt.git
ccxiaop
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385