Fixed bug #45998: --pipe to function broken.

This commit is contained in:
Ole Tange 2015-09-18 22:28:47 +02:00
parent f4addae676
commit 0c7f6c91e6
4 changed files with 20 additions and 3 deletions

View file

@ -237,12 +237,16 @@ New in this release:
* <<kontaktet 2015-06-22 Afventer svar fra journal>> GNU Parallel was used (unfortunately with wrong citation) in: TADSim: Discrete Event-Based Performance Prediction for Temperature-Accelerated Dynamics http://vruehle.de/publications/2015c.pdf
* Third-party selling GNU Parallel T-shirts http://www.aliexpress.com/item/2015F-BSO-GNU-LOGO-GNU-PARALLEL-men-s-shirt-sleeve-visual-illusion-error/32464827966.html
* Joys of gnu parallel http://scottolesen.com/index.php/2015/08/26/joys-of-gnu-parallel/
* 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/
* What It Looks Like to Process 3.5 Million Books http://blog.gdeltproject.org/what-it-looks-like-to-process-3-5-million-books/
* LExploration De Données Twitter http://blog.inovia-conseil.fr/?p=233
* Bug fixes and man page updates.

View file

@ -6006,7 +6006,7 @@ sub empty_input_wrapper {
# Returns:
# $wrapped_command = the wrapped command
my $command = shift;
my $script = '$c="'.::perl_quote_scalar($command).'";'.
my $script = '$c="'.::perl_quote_scalar($Global::shell." -c ".::shell_quote_scalar($command)).'";'.
::spacefree(0,q{
if(sysread(STDIN, $buf, 1)) {
open($fh, "|-", $c) || die;
@ -8345,7 +8345,7 @@ sub new {
# with the {= perl expr =}
# Avoid replacing inside existing {= perl expr =}
while(s{((^|\257>)[^\257]*?) # Don't replace after \257 unless \257>
\Q$rpl\E}
\Q$rpl\E}
{$1\257<$Global::rpl{$rpl}\257>}xg) {
}
# Do the same for the positional replacement strings
@ -8354,7 +8354,7 @@ sub new {
if($posrpl =~ s/^\{//) {
# Only do this if the shorthand start with {
while(s{((^|\257>)[^\257]*?) # Don't replace after \257 unless \257>
\{(-?\d+)\Q$posrpl\E}
\{(-?\d+)\Q$posrpl\E}
{$1\257<$3 $Global::rpl{$rpl}\257>}xg) {
}
}

View file

@ -206,6 +206,12 @@ echo '### bug #45939: {2} in {= =} fails'
parallel echo '{= s/O{2}//=}' ::: OOOK
parallel echo '{2}-{=1 s/O{2}//=}' ::: OOOK ::: OK
echo '**'
echo '### bug #45998: --pipe to function broken'
myfunc() { echo $1; cat; }; export -f myfunc; echo OK | parallel --pipe myfunc {#}
EOF
echo '### 1 .par file from --files expected'
find /tmp{/*,}/*.{par,tms,tmx} 2>/dev/null -mmin -10 | wc -l

View file

@ -436,5 +436,12 @@ parallel echo '{= s/O{2}//=}' ::: OOOK
OK
parallel echo '{2}-{=1 s/O{2}//=}' ::: OOOK ::: OK
OK-OK
echo '**'
**
echo '### bug #45998: --pipe to function broken'
### bug #45998: --pipe to function broken
myfunc() { echo $1; cat; }; export -f myfunc; echo OK | parallel --pipe myfunc {#}
1
OK
### 1 .par file from --files expected
1