On Fri, Feb 11, 2022 at 06:39:14PM +0100, Andrea Bolognani wrote: > 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. This is going to break apps that use ssh authorized_keys to strictly control the command libvirt invokves, so given that it has no functional benefit, we should not do this. > Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx> > --- > 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, > > 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 d6bcfc93d1..c1d3e39856 100644 > --- a/tests/virnetsockettest.c > +++ b/tests/virnetsockettest.c > @@ -571,10 +571,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", > }; > @@ -591,10 +591,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", > }; > @@ -611,10 +611,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", > }; > @@ -635,10 +635,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, > @@ -654,10 +654,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", > }; > @@ -670,10 +670,10 @@ mymain(void) > .path = "/tmp/socket", > .expectOut = "-T -e none -- somehost sh -c '" > "if '''\\''/tmp/fo o/nc'\\'''' -q 2>&1 | grep \"requires an argument\" >/dev/null 2>&1; then " > - "ARG=-q0;" > + "ARG=-q0; " > "else " > - "ARG=;" > - "fi;" > + "ARG=; " > + "fi; " > "'''\\''/tmp/fo o/nc'\\'''' $ARG -U /tmp/socket" > "'\n", > }; > -- > 2.34.1 > Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|