From e57ec6deeca96141e485b4d9eb27cd01e2f1c6aa Mon Sep 17 00:00:00 2001 From: Ole Tange Date: Sun, 31 May 2015 16:24:09 +0200 Subject: [PATCH] parallel: Fixed: csh length before base64 quoting too high. --- doc/release_new_version | 2 +- src/parallel | 7 ++++--- src/parallel_design.pod | 36 +++++++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 7 deletions(-) diff --git a/doc/release_new_version b/doc/release_new_version index 5e171db8..28ba7cd7 100644 --- a/doc/release_new_version +++ b/doc/release_new_version @@ -236,7 +236,7 @@ New in this release: * --fifo now works in csh, too. -* <> CIDER: a pipeline for detecting waves of coordinated transcriptional regulation in gene expression time-course data http://biorxiv.org/content/biorxiv/early/2015/03/17/012518.full.pdf +* GNU Parallel was cited in: DockBench: An Integrated Informatic Platform Bridging the Gap between the Robust Validation of Docking Protocols and Virtual Screening Simulations http://www.mdpi.com/1420-3049/20/6/9977 * <> GNU Parallel was used (unfortunately without citation) in: MUGBAS: a species free gene-based programme suite for post-GWAS analysis http://www.ncbi.nlm.nih.gov/pubmed/25765345 diff --git a/src/parallel b/src/parallel index 87a70293..b5555a95 100755 --- a/src/parallel +++ b/src/parallel @@ -3221,7 +3221,7 @@ sub killall { # Wait up to 200 ms between each $Global::start_no_new_jobs ||= 1; - $Global::killall = 1; + $Global::killall ||= 1; # pids of the all children and (grand*)children # before we start the blood bath my @family_pids = family_pids(keys %Global::running); @@ -6800,7 +6800,8 @@ sub sshlogin_wrap { my $remote_command = $pwd.$envset.$bashfuncset. '@ARGV="'.::perl_quote_scalar($command).'";'. monitor_parent_sshd_script(); $quoted_remote_command = "perl -e ".::shell_quote_scalar($remote_command); - if(length $quoted_remote_command > 999 + my $dq_remote_command = ::shell_quote_scalar($quoted_remote_command); + if(length $dq_remote_command > 999 or not $csh_friendly or @@ -6810,7 +6811,7 @@ sub sshlogin_wrap { $quoted_remote_command = "perl -e \\''".base64_zip_eval()."'\\' ". join" ",string_zip_base64($remote_command); } else { - $quoted_remote_command = ::shell_quote_scalar($quoted_remote_command); + $quoted_remote_command = $dq_remote_command; } my $sshcmd = $sshlogin->sshcommand(); diff --git a/src/parallel_design.pod b/src/parallel_design.pod index 1ef65550..5699c687 100644 --- a/src/parallel_design.pod +++ b/src/parallel_design.pod @@ -469,6 +469,29 @@ a Perl script in `` or using B if called as a single string. While these cover most cases, there are situations where it will fail: +=over 2 + +=item * + +When run using B. + +=item * + +When run as the last command using B<-c> from another shell (because +some shells use B): + + zsh% bash -c "parallel 'echo {} is not run in bash; set | grep BASH_VERSION' ::: This" + +You can work around that by appending '&& true': + + zsh% bash -c "parallel 'echo {} is run in bash; set | grep BASH_VERSION' ::: This && true" + +=item * + +When run in a Perl script using B with parallel as the first +string: + + #!/usr/bin/perl system("parallel",'setenv a {}; echo $a',":::",2); @@ -478,17 +501,24 @@ Perl script is called from B it will work just fine, but if it is called from B it will fail, because the command B is not known to B. +=back + =head2 Quoting -Quoting is kept simple: Use \ for all special chars and ' for -newline. Whether a char is special depends on the shell and the -context. Luckily quoting a bit too many does not break things. +Quoting depends on the shell. For most shells \ is used for all +special chars and ' is used for newline. Whether a char is special +depends on the shell and the context. Luckily quoting a bit too many +chars does not break things. It is fast, but had the distinct disadvantage that if a string needs to be quoted multiple times, the \'s double every time - increasing the string length exponentially. +For B/B newline is quoted as \ followed by newline. + +For B everything is quoted using '. + =head2 --pipepart vs. --pipe