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

View file

@ -1,22 +1,31 @@
#!/bin/bash #!/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 {} ::' 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::' 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 10 | parallel -k 'seq 1 {} | parallel -j1 -m -k -I :: echo a{} b::'
seq 1 60000 | parallel -I :: -m -j1 echo a::b::c | \ echo "### Test max line length -m -I"
mop -q "|sort |md5sum" :par seq 1 60000 | parallel -I :: -m -j1 echo a::b::c |
CHAR=$(cat ~/.mop/:par | wc -c) mop -q "|sort |md5sum" :par1;
LINES=$(cat ~/.mop/:par | wc -l) export CHAR=$(cat ~/.mop/:par1 | wc -c);
echo -n "Chars per line ($CHAR/$LINES): " export LINES=$(cat ~/.mop/:par1 | wc -l);
echo "$CHAR/$LINES" | bc echo -n "Chars per line ($CHAR/$LINES): ";
echo "$CHAR/$LINES" | bc
seq 1 60000 | parallel -I :: -X -j1 echo a::b::c | \ echo "### Test max line length -X -I"
mop -q "|sort |md5sum" :par seq 1 60000 | parallel -I :: -X -j1 echo a::b::c |
CHAR=$(cat ~/.mop/:par | wc -c) mop -q "|sort |md5sum" :par;
LINES=$(cat ~/.mop/:par | wc -l) export CHAR=$(cat ~/.mop/:par | wc -c);
echo -n "Chars per line ($CHAR/$LINES): " export LINES=$(cat ~/.mop/:par | wc -l);
echo "$CHAR/$LINES" | bc 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 1 1
2 1 2 1
2 2 2 2
@ -53,6 +54,7 @@
10 8 10 8
10 9 10 9
10 10 10 10
### Test -X -I
a1 b1 a1 b1
a2 b1 b2 a2 b1 b2
a3 b1 b2 b3 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 a8 b1 b2 b3 b4 b5 b6 b7 b8
a9 b1 b2 b3 b4 b5 b6 b7 b8 b9 a9 b1 b2 b3 b4 b5 b6 b7 b8 b9
a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 a10 b1 b2 b3 b4 b5 b6 b7 b8 b9 b10
### Test -m -I
a1 b1 a1 b1
a2 b1 2 a2 b1 2
a3 b1 2 3 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 a8 b1 2 3 4 5 6 7 8
a9 b1 2 3 4 5 6 7 8 9 a9 b1 2 3 4 5 6 7 8 9
a10 b1 2 3 4 5 6 7 8 9 10 a10 b1 2 3 4 5 6 7 8 9 10
### Test max line length -m -I
31d9274be5fdc2de59487cb05ba57776 - 31d9274be5fdc2de59487cb05ba57776 -
Chars per line (697800/6): 116300 Chars per line (697800/6): 116300
### Test max line length -X -I
22074f9acada52462defb18ba912d744 - 22074f9acada52462defb18ba912d744 -
Chars per line (817788/7): 116826 Chars per line (817788/7): 116826
### bug #36659: --sshlogin strips leading slash from ssh command
OK