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 <abologna@xxxxxxxxxx> --- src/rpc/virnetclient.c | 12 ++++---- tests/virnetsockettest.c | 60 ++++++++++++++++++++-------------------- 2 files changed, 36 insertions(+), 36 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, nccmd = g_strdup_printf( "if '%s' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'%s' $ARG -U %s", netcatPathSafe, netcatPathSafe, socketPath); @@ -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 $? = 0; then " - " %s; " - "else" - " %s; " + "%s; " + "else " + "%s; " "fi'", helpercmd, nccmd); case VIR_NET_CLIENT_PROXY_NETCAT: diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index 4e8edb05c3..1bd5255d90 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -572,10 +572,10 @@ mymain(void) .netcat = "nc", .expectOut = "-T -e none -- somehost sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", }; @@ -592,10 +592,10 @@ mymain(void) .path = "/tmp/socket", .expectOut = "-p 9000 -l fred -T -e none -o BatchMode=yes -- somehost sh -c '" "if 'netcat' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'netcat' $ARG -U /tmp/socket" "'\n", }; @@ -612,10 +612,10 @@ mymain(void) .path = "/tmp/socket", .expectOut = "-p 9000 -l fred -T -e none -o StrictHostKeyChecking=no -- somehost sh -c '" "if 'netcat' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'netcat' $ARG -U /tmp/socket" "'\n", }; @@ -636,10 +636,10 @@ mymain(void) .netcat = "nc", .expectOut = "-T -e none -- crashyhost sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", .dieEarly = true, @@ -655,10 +655,10 @@ mymain(void) .noVerify = true, .expectOut = "-i /root/.ssh/example_key -T -e none -o StrictHostKeyChecking=no -- example.com sh -c '" "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'nc' $ARG -U /tmp/socket" "'\n", }; @@ -671,10 +671,10 @@ mymain(void) .path = "/tmp/socket", .expectOut = "-T -e none -- somehost sh -c '" "if '''\\''n c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'''\\''n c'\\'''' $ARG -U /tmp/socket" "'\n", }; @@ -687,10 +687,10 @@ mymain(void) .path = "/tmp/socket", .expectOut = "-T -e none -- somehost sh -c '" "if '''\\''n'\\''\\'\\'''\\''c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'''\\''n'\\''\\'\\'''\\''c'\\'''' $ARG -U /tmp/socket" "'\n", }; @@ -703,10 +703,10 @@ mymain(void) .path = "/tmp/socket", .expectOut = "-T -e none -- somehost sh -c '" "if '''\\''n\"c'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'''\\''n\"c'\\'''' $ARG -U /tmp/socket" "'\n", }; @@ -719,13 +719,13 @@ mymain(void) .expectOut = "-T -e none -- somehost sh -c '" "which virt-ssh-helper 1>/dev/null 2>&1; " "if test $? = 0; then " - " virt-ssh-helper -r 'qemu:///session'; " - "else" - " if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " - "ARG=-q0;" + "virt-ssh-helper -r 'qemu:///session'; " + "else " + "if 'nc' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " + "ARG=-q0; " "else " - "ARG=;" - "fi;" + "ARG=; " + "fi; " "'nc' $ARG -U /tmp/socket; " "fi" "'\n" -- 2.35.1