mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 05:07:54 +00:00
Fixed bug #33740: If the remote computer runs CSH the remote does not set PARALLEL_* vars correctly.
This commit is contained in:
parent
cf2b12eea8
commit
c2a2b34abf
|
@ -2941,8 +2941,10 @@ sub sshlogin_wrap {
|
|||
# We need to save the exit status of the job
|
||||
$post = '_EXIT_status=$?; '.$post.' exit $_EXIT_status;';
|
||||
}
|
||||
my $parallel_env = 'PARALLEL_SEQ=$PARALLEL_SEQ\;export PARALLEL_SEQ\;'.
|
||||
'PARALLEL_PID=$PARALLEL_PID\;export PARALLEL_PID\;';
|
||||
# If the remote login shell is (t)csh then use 'setenv'
|
||||
# otherwise use 'export'
|
||||
my $parallel_env =
|
||||
q{'eval `echo $SHELL | grep -E "/(t)?csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\;PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;'};
|
||||
if($::opt_workdir) {
|
||||
$self->{'sshlogin_wrap'} = ($pre . "$sshcmd $serverlogin $parallel_env "
|
||||
. ::shell_quote_scalar("cd ".$self->workdir()." && ")
|
||||
|
|
|
@ -83,12 +83,11 @@ echo '### Test -x'
|
|||
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -km -s 10 -x echo
|
||||
(seq 1 10; echo 1234; seq 12 15) | stdout parallel -j1 -kX -s 10 -x echo
|
||||
(seq 1 10; echo 1234; seq 12 15) | stdout xargs -s 10 -x echo
|
||||
EOF
|
||||
|
||||
echo '### Test -a and --arg-file: Read input from file instead of stdin'
|
||||
seq 1 10 >/tmp/$$
|
||||
parallel -k -a /tmp/$$ echo
|
||||
parallel -k --arg-file /tmp/$$ echo
|
||||
seq 1 10 >/tmp/$$-1; parallel -k -a /tmp/$$-1 echo
|
||||
seq 1 10 >/tmp/$$-2; parallel -k --arg-file /tmp/$$-2 echo
|
||||
EOF
|
||||
|
||||
#echo '### Test bugfix if no command given'
|
||||
#(echo echo; seq 1 5; perl -e 'print "z"x1000000'; seq 12 15) | stdout parallel -j1 -km -s 10
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
SERVER1=parallel-server3
|
||||
SERVER2=parallel-server2
|
||||
|
||||
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -j0 -k
|
||||
echo '### Test --return of weirdly named file'
|
||||
stdout parallel --return {} -vv -S $SERVER1 echo '>'{} ::: 'aa<${#}" b'
|
||||
rm 'aa<${#}" b'
|
||||
stdout parallel --return {} -vv -S $SERVER1 echo '>'{} ::: 'aa<${#}" b'; rm 'aa<${#}" b'
|
||||
|
||||
echo '### Test if remote login shell is csh'
|
||||
stdout parallel -vv -S csh@localhost 'echo $PARALLEL_PID $PARALLEL_SEQ {}| wc -w' ::: a b c
|
||||
|
||||
echo '### Test {} multiple times in different commands'
|
||||
seq 10 | parallel -v -Xj1 echo {} \; echo {}
|
||||
|
@ -21,4 +24,4 @@ parallel -j1 -kX echo {}-{.} ::: a ::: b
|
|||
parallel -j2 -kX echo {}-{.} ::: a b ::: c d
|
||||
parallel -j2 -kX echo {}-{.} ::: a b c ::: d e f
|
||||
parallel -j0 -kX echo {}-{.} ::: a b c ::: d e f
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
cat <<'EOF' | parallel -j0 -k
|
||||
echo '### Test -q'
|
||||
parallel -kq perl -e '$ARGV[0]=~/^\S+\s+\S+$/ and print $ARGV[0],"\n"' ::: "a b" c "d e f" g "h i"
|
||||
|
||||
|
@ -7,4 +8,4 @@ echo '### Test -q {#}'
|
|||
parallel -kq echo {#} ::: a b
|
||||
parallel -kq echo {\#} ::: a b
|
||||
parallel -kq echo {\\#} ::: a b
|
||||
|
||||
EOF
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
### Test --return of weirdly named file
|
||||
ssh parallel-server3 PARALLEL_SEQ=$PARALLEL_SEQ\;export PARALLEL_SEQ\;PARALLEL_PID=$PARALLEL_PID\;export PARALLEL_PID\; echo\ \>aa\\\<\\\${\\\#}\\\"\\\ b;_EXIT_status=$?; rsync -rlDzR -essh parallel-server3:././aa\\\<\\\${\\\#}\\\"\\\ b ./; exit $_EXIT_status;
|
||||
ssh parallel-server3 'eval `echo $SHELL | grep -E "/(t)?csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\;PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' echo\ \>aa\\\<\\\${\\\#}\\\"\\\ b;_EXIT_status=$?; rsync -rlDzR -essh parallel-server3:././aa\\\<\\\${\\\#}\\\"\\\ b ./; exit $_EXIT_status;
|
||||
### Test if remote login shell is csh
|
||||
ssh csh@localhost 'eval `echo $SHELL | grep -E "/(t)?csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\;PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' echo\ \$PARALLEL_PID\ \$PARALLEL_SEQ\ a\|\ wc\ -w;
|
||||
3
|
||||
ssh csh@localhost 'eval `echo $SHELL | grep -E "/(t)?csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\;PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' echo\ \$PARALLEL_PID\ \$PARALLEL_SEQ\ b\|\ wc\ -w;
|
||||
3
|
||||
ssh csh@localhost 'eval `echo $SHELL | grep -E "/(t)?csh" > /dev/null && echo setenv PARALLEL_SEQ '$PARALLEL_SEQ'\; setenv PARALLEL_PID '$PARALLEL_PID' || echo PARALLEL_SEQ='$PARALLEL_SEQ'\;export PARALLEL_SEQ\;PARALLEL_PID='$PARALLEL_PID'\;export PARALLEL_PID` ;' echo\ \$PARALLEL_PID\ \$PARALLEL_SEQ\ c\|\ wc\ -w;
|
||||
3
|
||||
### Test {} multiple times in different commands
|
||||
echo 1 2 3 4 5 6 7 8 9 10 ; echo 1 2 3 4 5 6 7 8 9 10
|
||||
1 2 3 4 5 6 7 8 9 10
|
||||
|
|
Loading…
Reference in a new issue