Fixed bug #45907: --header : + --return {header}.

Fixed bug #45906: {= in header =}.
This commit is contained in:
Ole Tange 2015-09-09 22:38:42 +02:00
parent e65907fe88
commit 285e9209a4
6 changed files with 31 additions and 13 deletions

View file

@ -212,9 +212,9 @@ cc:Tim Cuthbertson <tim3d.junk@gmail.com>,
Ryoichiro Suzuki <ryoichiro.suzuki@gmail.com>,
Jesse Alama <jesse.alama@gmail.com>
Subject: GNU Parallel 20150822 ('<<>>') released <<[stable]>>
Subject: GNU Parallel 20150822 ('Aylan Kurdi') released <<[stable]>>
GNU Parallel 20150922 ('<<>>') <<[stable]>> has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
GNU Parallel 20150922 ('Aylan Kurdi') <<[stable]>> has been released. It is available for download at: http://ftp.gnu.org/gnu/parallel/
<<No new functionality was introduced so this is a good candidate for a stable release.>>
@ -241,6 +241,10 @@ New in this release:
* Crop and resize images with bash and ImageMagick https://www.simonholywell.com/post/2015/08/image-resize-crop-bash-imagemagick/
* Three Ways to Script Processes in Parallel http://www.codeword.xyz/2015/09/02/three-ways-to-script-processes-in-parallel/
* LExploration De Données Twitter http://blog.inovia-conseil.fr/?p=233
* Bug fixes and man page updates.
GNU Parallel - For people who live life in the parallel lane.

View file

@ -78,9 +78,7 @@ if($opt::header and not $opt::pipe) {
for my $s (split /$delimiter/o, $line) {
::debug("init", "Colname: '$s'");
# Replace {colname} with {2}
# TODO accept configurable short hands
# TODO how to deal with headers in {=...=}
for(@command) {
for(@command,@Global::ret_files) {
s:\{$s(|/|//|\.|/\.)\}:\{$id$1\}:g;
}
$Global::input_source_header{$id} = $s;
@ -1099,7 +1097,7 @@ sub parse_options {
sub init_globals {
# Defaults:
$Global::version = 20150823;
$Global::version = 20150909;
$Global::progname = 'parallel';
$Global::infinity = 2**31;
$Global::debug = 0;
@ -8322,6 +8320,7 @@ sub new {
}
}
# Replace replacement strings with {= perl expr =}
# '{=' 'perlexpr' '=}' => '{= perlexpr =}'
@command = merge_rpl_parts(@command);
# Protect matching inside {= perl expr =}

View file

@ -3900,11 +3900,8 @@ B<make -j> can run jobs in parallel, but requires a crafted Makefile
to do this. That results in extra quoting to get filename containing
newline to work correctly.
B<make -j> has no support for grouping the output, therefore output
may run together, e.g. the first half of a line is from one process
and the last half of the line is from another process. The example
B<Parallel grep> cannot be done reliably with B<make -j> because of
this.
B<make -j> computes a dependency graph before running jobs. Jobs run
by GNU B<parallel> does not depend on eachother.
(Very early versions of GNU B<parallel> were coincidently implemented
using B<make -j>).

View file

@ -40,7 +40,7 @@ prereqlocal: installparallel
which timeout || (echo timeout is required for testsuite; /bin/false)
prereqremote: installparallel startvm
parallel --timeout 5 --tag ssh parallel@parallel-server{} parallel --minversion 20121021 ::: 1 2 3 || (echo parallel on remote required for testsuite; /bin/true)
parallel --timeout 10 --tag ssh parallel@parallel-server{} parallel --minversion 20121021 ::: 1 2 3 || (echo parallel on remote required for testsuite; /bin/true)
startvm:
# Make sure we can reach the virtual machines

View file

@ -1,7 +1,7 @@
#!/bin/bash
# SSH only allowed to localhost/lo
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj2 -k --joblog /tmp/jl-`basename $0` -L1
cat <<'EOF' | sed -e s/\$SERVER1/$SERVER1/\;s/\$SERVER2/$SERVER2/ | parallel -vj2 --retries 3 -k --joblog /tmp/jl-`basename $0` -L1
echo '### --hostgroup force ncpu'
parallel --delay 0.1 --hgrp -S @g1/1/parallel@lo -S @g2/3/lo whoami\;sleep 0.2{} ::: {1..8} | sort
@ -64,4 +64,14 @@ echo '### Uniq {=perlexpr=} in return - not used in command'
echo '### functions and --nice'
myfunc() { echo OK $*; }; export -f myfunc; parallel --nice 10 --env myfunc -S parallel@lo myfunc ::: func
echo '### bug #45906: {= in header =}'
rm -f returnfile45906;
parallel --rpl '{G} $_=lc($_)' -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: RETURNFILE45906;
ls returnfile45906
echo '### bug #45907: --header : + --return {header}'
rm returnfile45907;
ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907;
ls returnfile45907
EOF

View file

@ -105,3 +105,11 @@ echo '### functions and --nice'
### functions and --nice
myfunc() { echo OK $*; }; export -f myfunc; parallel --nice 10 --env myfunc -S parallel@lo myfunc ::: func
OK func
echo '### bug #45906: {= in header =}'
### bug #45906: {= in header =}
rm -f returnfile45906; parallel --rpl '{G} $_=lc($_)' -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: RETURNFILE45906; ls returnfile45906
returnfile45906
echo '### bug #45907: --header : + --return {header}'
### bug #45907: --header : + --return {header}
rm returnfile45907; ppar --header : -S parallel@lo --return {G} --cleanup echo {G} '>' {G} ::: G returnfile45907; ls returnfile45907
returnfile45907