From d43495821a0ec4747f7d57cd5f4170c560ca7e89 Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Tue, 31 Jan 2023 01:29:22 +0100 Subject: [PATCH] parallel: Fixed bug #63722: hostgroup with , breaks parser. --- doc/release_new_version | 2 +- src/parallel | 4 ++-- testsuite/tests-to-run/parallel-local-ssh1.sh | 5 +++++ testsuite/wanted-results/parallel-local-ssh1 | 4 ++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/release_new_version b/doc/release_new_version index 9aba7cac..cafd0846 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -262,7 +262,7 @@ from:tange@gnu.org to:parallel@gnu.org, bug-parallel@gnu.org stable-bcc: Jesse Alama -Subject: GNU Parallel 20230222 ('Leopard/Monterrey Park/Peru<<>>') released +Subject: GNU Parallel 20230222 ('Paludan/Leopard/Monterrey Park/Peru<<>>') released GNU Parallel 20230222 ('<<>>') has been released. It is available for download at: lbry://@GnuParallel:4 diff --git a/src/parallel b/src/parallel index 1c6b090d..a8457ea9 100755 --- a/src/parallel +++ b/src/parallel @@ -6946,7 +6946,7 @@ sub new($$) { # [@grp+grp]/ncpu//usr/bin/ssh user:pass@server:port if($s =~ s:^\@([^/]+)/?::) { # Look for SSHLogin hostgroups - %hostgroups = map { $_ => 1 } split(/\+/, $1); + %hostgroups = map { $_ => 1 } split(/\+|,/, $1); } # An SSHLogin is always in the hostgroup of its "numcpu/host" $hostgroups{$s} = 1; @@ -13949,7 +13949,7 @@ sub new($) { if($opt::hostgroups) { if($orig =~ s:@(.+)::) { # We found hostgroups on the arg - @hostgroups = split(/\+/, $1); + @hostgroups = split(/\+|,/, $1); if(not grep { defined $Global::hostgroups{$_} } @hostgroups) { # This hostgroup is not defined using -S # Add it diff --git a/testsuite/tests-to-run/parallel-local-ssh1.sh b/testsuite/tests-to-run/parallel-local-ssh1.sh index b89ff09c..49bc9979 100644 --- a/testsuite/tests-to-run/parallel-local-ssh1.sh +++ b/testsuite/tests-to-run/parallel-local-ssh1.sh @@ -218,6 +218,11 @@ par_remote_nice() { nice -n5 parallel -S lo 'ps -l $$|field 8; true' ::: a } +par_hgrp_agrp_comma() { + echo '### bug #63722: hostgroup with , breaks parser' + stdout parallel --hgrp ::: id@csh@lo,tcsh@lo id@csh@lo,tcsh@lo | sort +} + par_hgrp_agrp() { echo '### Test --hgrp {hgrp} {agrp}' parallel --plus --hgrp -S @b+lo/bash@lo,@c+lo/csh@lo --tag 'echo hgrp={hgrp};echo agrp={agrp}' ::: A@b+c B@b C@c D@c+b@u E | diff --git a/testsuite/wanted-results/parallel-local-ssh1 b/testsuite/wanted-results/parallel-local-ssh1 index f72e6403..333b2b73 100644 --- a/testsuite/wanted-results/parallel-local-ssh1 +++ b/testsuite/wanted-results/parallel-local-ssh1 @@ -17,6 +17,10 @@ par_filename_colon content-of-: par_files_nonall ### bug #40002: --files and --nonall seem not to work together: par_files_nonall 1 par_hgrp_agrp ### Test --hgrp {hgrp} {agrp} +par_hgrp_agrp_comma ### bug #63722: hostgroup with , breaks parser +par_hgrp_agrp_comma parallel: Warning: Adding hostgroups: csh@lo tcsh@lo +par_hgrp_agrp_comma uid=1004(csh) gid=1004(csh) groups=1004(csh) +par_hgrp_agrp_comma uid=1007(tcsh) gid=1007(tcsh) groups=1007(tcsh) par_joblog_nonall ### bug #40001: --joblog and --nonall seem not to work together: par_joblog_nonall 3 par_onall_transfer ### bug #46519: --onall ignores --transfer