From nobody Tue Feb 10 01:19:32 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1644601727; cv=none; d=zohomail.com; s=zohoarc; b=m0wRlRkihQdf9nAObVNCKuGnyZco+1+Diq6zuRM62ZMRSBaWAAU1hHqXpTm6WVPFRXFbqi4zLFC/eKJLGZd7nYOSjSDG8aCi0OoO6HgdWn211M3Rty3Eu6JddqABbXxTiNL2yuT1FTDlxkZnd/EvYl7xgoSYYdPly/IHA9PcL/U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1644601727; 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=KZxW2jHEJj0+Map8HHx+Z5YB51XHOP5bdyTk+fU2bUE=; b=b3PlcSsX0okcEu84jZyD5uscx3wNRdzENTPcPX4+IN0938cRbAYk6tlK1bDSz39MB3akn4PdpLvSI1wtIIEd66n9tKcz5KoZoJhPIpZvVxxSk7yMzMqWlp2+spPrVQsUPLBvYP/S0wZOCHAgDiGmNLcnesvYojlQhZKgTBRnUHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1644601727015479.96283225324476; Fri, 11 Feb 2022 09:48:47 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-6GcyiSpTMkqpIFTA4m5hYg-1; Fri, 11 Feb 2022 12:48:37 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9E77C1091DA6; Fri, 11 Feb 2022 17:48:32 +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 7C42634D3A; Fri, 11 Feb 2022 17:48:32 +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 4F9214A7C8; Fri, 11 Feb 2022 17:48:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 21BHeHZs006720 for ; Fri, 11 Feb 2022 12:40:17 -0500 Received: by smtp.corp.redhat.com (Postfix) id 258D234B21; Fri, 11 Feb 2022 17:40:17 +0000 (UTC) Received: from harajuku.usersys.redhat.com.homenet.telecomitalia.it (unknown [10.40.194.192]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 78F9534D56 for ; Fri, 11 Feb 2022 17:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644601726; 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=KZxW2jHEJj0+Map8HHx+Z5YB51XHOP5bdyTk+fU2bUE=; b=feFt5SLbTbXtOFS1wzekHRv8Z6qlHhQUXdpN5eKitvxSVZU1R4HjEcc/IV0hQIGQFVs8gG 75kYUQmjPwLUy9qDdI9CjW8+kAMCntETMLkR4w1UX2NwdDN03RydK8YxAsZ6tlmF+5EN6R Y5f5yHY7Wu86mZGaO7gG6sZXk+Jg0EI= X-MC-Unique: 6GcyiSpTMkqpIFTA4m5hYg-1 From: Andrea Bolognani To: libvir-list@redhat.com Subject: [libvirt PATCH 06/11] virnetclient: Improve spacing of ssh script Date: Fri, 11 Feb 2022 18:39:14 +0100 Message-Id: <20220211173919.112353-7-abologna@redhat.com> In-Reply-To: <20220211173919.112353-1-abologna@redhat.com> References: <20220211173919.112353-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.84 on 10.5.11.23 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) X-ZM-MESSAGEID: 1644601729332100001 Content-Type: text/plain; charset="utf-8" This results in the generated script having consistent spacing throughout, instead of having repeated whitespace in some parts and commands that are separated by a semicolon and no spacing at all in others. Signed-off-by: Andrea Bolognani --- src/rpc/virnetclient.c | 12 ++++++------ tests/virnetsockettest.c | 36 ++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 2998551cd8..cbefa8f11f 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -436,10 +436,10 @@ virNetClientSSHHelperCommand(virNetClientProxy proxy, =20 nccmd =3D g_strdup_printf( "if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; = then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'%s' $ARG -U %s", netcatPathSafe, netcatPathSafe, socketPath); =20 @@ -451,9 +451,9 @@ virNetClientSSHHelperCommand(virNetClientProxy proxy, case VIR_NET_CLIENT_PROXY_AUTO: return g_strdup_printf("sh -c 'which virt-ssh-helper 1>/dev/null 2= >&1; " "if test $? =3D 0; then " - " %s; " - "else" - " %s; " + "%s; " + "else " + "%s; " "fi'", helpercmd, nccmd); =20 case VIR_NET_CLIENT_PROXY_NETCAT: diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index d6bcfc93d1..c1d3e39856 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -571,10 +571,10 @@ mymain(void) .netcat =3D "nc", .expectOut =3D "-T -e none -- somehost sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" = >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", }; @@ -591,10 +591,10 @@ mymain(void) .path =3D "/tmp/socket", .expectOut =3D "-p 9000 -l fred -T -e none -o BatchMode=3Dyes -- s= omehost sh -c '" "if 'netcat' -q 2>&1 | grep \"requires an argumen= t\" >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'netcat' $ARG -U /tmp/socket" "'\n", }; @@ -611,10 +611,10 @@ mymain(void) .path =3D "/tmp/socket", .expectOut =3D "-p 9000 -l fred -T -e none -o StrictHostKeyCheckin= g=3Dno -- somehost sh -c '" "if 'netcat' -q 2>&1 | grep \"requires an argumen= t\" >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'netcat' $ARG -U /tmp/socket" "'\n", }; @@ -635,10 +635,10 @@ mymain(void) .netcat =3D "nc", .expectOut =3D "-T -e none -- crashyhost sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" = >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", .dieEarly =3D true, @@ -654,10 +654,10 @@ mymain(void) .noVerify =3D true, .expectOut =3D "-i /root/.ssh/example_key -T -e none -o StrictHost= KeyChecking=3Dno -- example.com sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" = >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", }; @@ -670,10 +670,10 @@ mymain(void) .path =3D "/tmp/socket", .expectOut =3D "-T -e none -- somehost sh -c '" "if '''\\''/tmp/fo o/nc'\\'''' -q 2>&1 | grep \"r= equires an argument\" >/dev/null 2>&1; then " - "ARG=3D-q0;" + "ARG=3D-q0; " "else " - "ARG=3D;" - "fi;" + "ARG=3D; " + "fi; " "'''\\''/tmp/fo o/nc'\\'''' $ARG -U /tmp/socket" "'\n", }; --=20 2.34.1