parallel: Fixed bug #63722: hostgroup with , breaks parser.

This commit is contained in:
Ole Tange 2023-01-31 01:29:22 +01:00
parent e6fe5fafcd
commit d43495821a
4 changed files with 12 additions and 3 deletions

View file

@ -262,7 +262,7 @@ from:tange@gnu.org
to:parallel@gnu.org, bug-parallel@gnu.org to:parallel@gnu.org, bug-parallel@gnu.org
stable-bcc: Jesse Alama <jessealama@fastmail.fm> stable-bcc: Jesse Alama <jessealama@fastmail.fm>
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 GNU Parallel 20230222 ('<<>>') has been released. It is available for download at: lbry://@GnuParallel:4

View file

@ -6946,7 +6946,7 @@ sub new($$) {
# [@grp+grp]/ncpu//usr/bin/ssh user:pass@server:port # [@grp+grp]/ncpu//usr/bin/ssh user:pass@server:port
if($s =~ s:^\@([^/]+)/?::) { if($s =~ s:^\@([^/]+)/?::) {
# Look for SSHLogin hostgroups # 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" # An SSHLogin is always in the hostgroup of its "numcpu/host"
$hostgroups{$s} = 1; $hostgroups{$s} = 1;
@ -13949,7 +13949,7 @@ sub new($) {
if($opt::hostgroups) { if($opt::hostgroups) {
if($orig =~ s:@(.+)::) { if($orig =~ s:@(.+)::) {
# We found hostgroups on the arg # We found hostgroups on the arg
@hostgroups = split(/\+/, $1); @hostgroups = split(/\+|,/, $1);
if(not grep { defined $Global::hostgroups{$_} } @hostgroups) { if(not grep { defined $Global::hostgroups{$_} } @hostgroups) {
# This hostgroup is not defined using -S # This hostgroup is not defined using -S
# Add it # Add it

View file

@ -218,6 +218,11 @@ par_remote_nice() {
nice -n5 parallel -S lo 'ps -l $$|field 8; true' ::: a 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() { par_hgrp_agrp() {
echo '### Test --hgrp {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 | 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 |

View file

@ -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 ### bug #40002: --files and --nonall seem not to work together:
par_files_nonall 1 par_files_nonall 1
par_hgrp_agrp ### Test --hgrp {hgrp} {agrp} 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 ### bug #40001: --joblog and --nonall seem not to work together:
par_joblog_nonall 3 par_joblog_nonall 3
par_onall_transfer ### bug #46519: --onall ignores --transfer par_onall_transfer ### bug #46519: --onall ignores --transfer