Fixed bug #36659: --sshlogin strips leading slash from ssh command.

This commit is contained in:
Ole Tange 2012-06-14 22:10:39 +02:00
parent 2c29653012
commit 72402ef16e
3 changed files with 32 additions and 16 deletions

View file

@ -572,7 +572,7 @@ sub get_options_from_array {
sub parse_options {
# Returns: N/A
# Defaults:
$Global::version = 20120602;
$Global::version = 20120614;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;
@ -1569,7 +1569,7 @@ sub parse_sshlogin {
$sshlogin->set_maxlength(Limits::Command::max_length());
$Global::host{$sshlogin->string()} = $sshlogin;
}
#debug("sshlogin: ", my_dump(%Global::host),"\n");
debug("sshlogin: ", my_dump(%Global::host),"\n");
if($::opt_transfer or @::opt_return or $::opt_cleanup or @::opt_basefile) {
if(not remote_hosts()) {
# There are no remote hosts
@ -2090,7 +2090,7 @@ sub new {
my $class = shift;
my $sshlogin_string = shift;
my $ncpus;
if($sshlogin_string =~ s:^(\d*)/:: and $1) {
if($sshlogin_string =~ s:^(\d+)/:: and $1) {
# Override default autodetected ncpus unless zero or missing
$ncpus = $1;
}

View file

@ -1,22 +1,31 @@
#!/bin/bash
# Test -I
cat <<'EOF' | sed -e 's/;$/; /;s/$SERVER1/'$SERVER1'/;s/$SERVER2/'$SERVER2'/' | stdout parallel -j0 -k -L1
echo "### Test -I"
seq 1 10 | parallel -k 'seq 1 {} | parallel -k -I :: echo {} ::'
echo "### Test -X -I"
seq 1 10 | parallel -k 'seq 1 {} | parallel -j1 -X -k -I :: echo a{} b::'
echo "### Test -m -I"
seq 1 10 | parallel -k 'seq 1 {} | parallel -j1 -m -k -I :: echo a{} b::'
seq 1 60000 | parallel -I :: -m -j1 echo a::b::c | \
mop -q "|sort |md5sum" :par
CHAR=$(cat ~/.mop/:par | wc -c)
LINES=$(cat ~/.mop/:par | wc -l)
echo -n "Chars per line ($CHAR/$LINES): "
echo "### Test max line length -m -I"
seq 1 60000 | parallel -I :: -m -j1 echo a::b::c |
mop -q "|sort |md5sum" :par1;
export CHAR=$(cat ~/.mop/:par1 | wc -c);
export LINES=$(cat ~/.mop/:par1 | wc -l);
echo -n "Chars per line ($CHAR/$LINES): ";
echo "$CHAR/$LINES" | bc
seq 1 60000 | parallel -I :: -X -j1 echo a::b::c | \
mop -q "|sort |md5sum" :par
CHAR=$(cat ~/.mop/:par | wc -c)
LINES=$(cat ~/.mop/:par | wc -l)
echo -n "Chars per line ($CHAR/$LINES): "
echo "### Test max line length -X -I"
seq 1 60000 | parallel -I :: -X -j1 echo a::b::c |
mop -q "|sort |md5sum" :par;
export CHAR=$(cat ~/.mop/:par | wc -c);
export LINES=$(cat ~/.mop/:par | wc -l);
echo -n "Chars per line ($CHAR/$LINES): ";
echo "$CHAR/$LINES" | bc
echo "### bug #36659: --sshlogin strips leading slash from ssh command"
parallel --sshlogin '/usr/bin/ssh localhost' echo ::: OK
EOF

View file

@ -1,3 +1,4 @@
### Test -I
1 1
2 1
2 2
@ -53,6 +54,7 @@
10 8
10 9
10 10
### Test -X -I
a1 b1
a2 b1 b2
a3 b1 b2 b3
@ -63,6 +65,7 @@ a7 b1 b2 b3 b4 b5 b6 b7
a8 b1 b2 b3 b4 b5 b6 b7 b8
a9 b1 b2 b3 b4 b5 b6 b7 b8 b9
a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
### Test -m -I
a1 b1
a2 b1 2
a3 b1 2 3
@ -73,7 +76,11 @@ a7 b1 2 3 4 5 6 7
a8 b1 2 3 4 5 6 7 8
a9 b1 2 3 4 5 6 7 8 9
a10 b1 2 3 4 5 6 7 8 9 10
### Test max line length -m -I
31d9274be5fdc2de59487cb05ba57776 -
Chars per line (697800/6): 116300
### Test max line length -X -I
22074f9acada52462defb18ba912d744 -
Chars per line (817788/7): 116826
### bug #36659: --sshlogin strips leading slash from ssh command
OK