From nobody Mon Feb 9 00:56:39 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611667884; cv=none; d=zohomail.com; s=zohoarc; b=XliWjDIHEGLVcmTCqydfg5B1jI4AFc5qoqJYNtp456Vkh1QtjHW2gP614I8Eg7IBBc5riwJgnzKjQesqQHNa24ByjerO3wGtgttr2iwJ7V7xUFvou2SsULj0GVWm2j4KUX9nf6uCQxTxiNqdijO/ftJjSaxR5EMm8J3ZHUrkR08= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611667884; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1HCkr+QDsG1j8QDCWhWRp7i3iVgjvfZQUg72kKAvztw=; b=R8M2UPhmklUkFHl0SlEBukxfyBUGW847sUMbatjulsR2oeM43Z1uew3sFX/6VP4O3Gz0C/NDjvv9YGgQkMnwwmvKaEG+JkdFakLjb37MeB2DxCslbES8Jbh/UnDZkLLhoo37Mq/dtILy3wN26oSNJP8g4cf52XzKDvNbZrPNStc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1611667884125689.4306095210834; Tue, 26 Jan 2021 05:31:24 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-G8yZXtLnPDGomlxh48dgcA-1; Tue, 26 Jan 2021 08:31:20 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3A67010054FF; Tue, 26 Jan 2021 13:31:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 174315D719; Tue, 26 Jan 2021 13:31:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D23164BB7B; Tue, 26 Jan 2021 13:31:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10QDROa3001344 for ; Tue, 26 Jan 2021 08:27:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3F7C45C276; Tue, 26 Jan 2021 13:27:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.116]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3B1A63743 for ; Tue, 26 Jan 2021 13:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611667883; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1HCkr+QDsG1j8QDCWhWRp7i3iVgjvfZQUg72kKAvztw=; b=cKZDnPO3athSMJG+Xwkrpn0VUENJbfqOrjzWdqhgVE5OxS4KT4mcFe30JRah8pgtesCnk6 eGITXKElY64bEqlTtBcWgRjOVUI/I7OF6hfXqyfV3qsOoXylXaMeaPuSZzw5//+i3yZ+Yn LQVB5GkOijKp9dX94Z2R+HccfYBcjLY= X-MC-Unique: G8yZXtLnPDGomlxh48dgcA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/9] vsh: Don't break word on backslash Date: Tue, 26 Jan 2021 14:27:06 +0100 Message-Id: <25789a1f9e9d103a5db217bea66c3e45015fac3a.1611667532.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" A backslash is the way we escape characters in virsh. For instance: virsh # start domain\ with\ long\ name For readline completion, we do not want to get four separate words ("domain", "with", "long", "name"). This means, that we can't sue virBufferEscapeShell() because it doesn't escape spaces the way we want. Signed-off-by: Michal Privoznik --- tools/vsh.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 54253afa72..9856088126 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2773,7 +2773,7 @@ vshReadlineParse(const char *text, int state) if (ret && !rl_completion_quote_character) { g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; - virBufferEscapeShell(&buf, ret); + virBufferEscape(&buf, '\\', " ", "%s", ret); VIR_FREE(ret); ret =3D virBufferContentAndReset(&buf); } @@ -2819,7 +2819,7 @@ vshReadlineInit(vshControl *ctl) int ret =3D -1; char *histsize_env =3D NULL; const char *histsize_str =3D NULL; - const char *break_characters =3D " \t\n\\`@$><=3D;|&{("; + const char *break_characters =3D " \t\n`@$><=3D;|&{("; const char *quote_characters =3D "\"'"; =20 /* Opaque data for autocomplete callbacks. */ --=20 2.26.2