echo a | parallel -qX echo  "'"{}"' "
Trailing \ in regex m/\'{}\'\/ at /home/tange/bin/parallel line 479, <STDIN> line 1.

echo a | parallel -qX echo  "'{}'"
<<infinite loop>>
This commit is contained in:
Ole Tange 2009-08-26 14:33:14 +02:00
parent ae9ed6753c
commit 9d593557ce
7 changed files with 51 additions and 16 deletions

View file

@ -2,12 +2,17 @@ parallel.1: parallel
pod2man parallel > parallel.1 pod2man parallel > parallel.1
install: parallel parallel.1 install: parallel parallel.1
cp parallel /usr/local/bin/parallel install -D -m 755 parallel $(DESTDIR)/usr/bin/parallel
cp parallel.1 /usr/local/man/man1/parallel.1 install -D -m 644 parallel.1 $(DESTDIR)/usr/share/man/man1/parallel.1
unittest: parallel unittest/tests-to-run/* unittest/wanted-results/* unittest: parallel unittest/tests-to-run/* unittest/wanted-results/*
echo | mop || (echo mop is required for unittest; /bin/false)
seq 1 2 | mop || (echo seq is required for unittest; /bin/false)
(cd unittest; sh Start.sh) (cd unittest; sh Start.sh)
clean:
rm -f parallel.1
dist: dist:
rm -rf ./unittest/input-files/random_dirs_*_newline || /bin/true rm -rf ./unittest/input-files/random_dirs_*_newline || /bin/true
rm -rf ./unittest/tmp || /bin/true rm -rf ./unittest/tmp || /bin/true

View file

@ -245,7 +245,9 @@ characters. For example this B<will not work>:
B<ls | parallel -q "diff {} foo >>B<{}.diff"> B<ls | parallel -q "diff {} foo >>B<{}.diff">
because > needs to be interpreted by the shell. B<ls | parallel -q "ls {} | wc -l">
because > and | need to be interpreted by the shell.
If you get errors like: If you get errors like:
@ -292,8 +294,10 @@ the last half of the line is from another process.
If no command is given to B<xargs> it defaults to /bin/echo. So the If no command is given to B<xargs> it defaults to /bin/echo. So the
B<cat | sh> functionality is missing. B<cat | sh> functionality is missing.
Quoting in B<xargs> works like B<-q> in B<parallel>. Doing B<ls | Quoting in B<xargs> works like B<-q> in B<parallel>. This means
parallel "wc {} >> B<{}.wc"> using B<xargs> seems to be impossible. composed commands and redirection is impossible: B<ls | parallel "wc
{} >> B<{}.wc"> or B<ls | parallel "echo {}; ls {}|wc"> cannot be done using
B<xargs>.
=head1 BUGS =head1 BUGS
@ -301,6 +305,8 @@ parallel "wc {} >> B<{}.wc"> using B<xargs> seems to be impossible.
Filenames beginning with '-' can cause some commands to give Filenames beginning with '-' can cause some commands to give
unexpected results, as it will often be interpreted as an option. unexpected results, as it will often be interpreted as an option.
Some Bash specific constructs like '<(cmd)' do not work. They can be
fixed by prepending '/bin/bash -c'. How much slower will that be?
=head1 REPORTING BUGS =head1 REPORTING BUGS
@ -474,7 +480,8 @@ sub generate_command_line {
push @all_word_arg, $substituted; push @all_word_arg, $substituted;
} }
my $all_word_arg = join(" ",@all_word_arg); my $all_word_arg = join(" ",@all_word_arg);
$job_line =~ s/$wordarg/$all_word_arg/; my ($quoted_wordarg) = shell_quote($wordarg);
$job_line =~ s/$quoted_wordarg/$all_word_arg/;
} }
} else { } else {
# Normal replace # Normal replace
@ -855,11 +862,17 @@ sub print_job {
} }
seek $_, 0, 0 for $out, $err; seek $_, 0, 0 for $out, $err;
if($Global::debug) { if($Global::debug) {
while( <$err> ) { print STDERR "ERR: $_" } print STDERR "ERR:\n";
while( <$out> ) { print STDOUT "OUT: $_" } }
} else { my $buf;
print STDERR <$err>; while(sysread($err,$buf,1000_000)) {
print STDOUT <$out>; print STDERR $buf;
}
if($Global::debug) {
print STDOUT "OUT:\n";
}
while(sysread($out,$buf,1000_000)) {
print STDOUT $buf;
} }
debug("<<joboutput $command\n"); debug("<<joboutput $command\n");
close $out; close $out;

View file

@ -124,7 +124,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "PARALLEL 1" .IX Title "PARALLEL 1"
.TH PARALLEL 1 "2009-04-27" "perl v5.10.0" "User Contributed Perl Documentation" .TH PARALLEL 1 "2009-08-26" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
@ -347,7 +347,9 @@ characters. For example this \fBwill not work\fR:
.PP .PP
\&\fBls | parallel \-q "diff {} foo \fR>\fB{}.diff"\fR \&\fBls | parallel \-q "diff {} foo \fR>\fB{}.diff"\fR
.PP .PP
because > needs to be interpreted by the shell. \&\fBls | parallel \-q \*(L"ls {} | wc \-l\*(R"\fR
.PP
because > and | need to be interpreted by the shell.
.PP .PP
If you get errors like: If you get errors like:
.PP .PP
@ -392,12 +394,17 @@ the last half of the line is from another process.
If no command is given to \fBxargs\fR it defaults to /bin/echo. So the If no command is given to \fBxargs\fR it defaults to /bin/echo. So the
\&\fBcat | sh\fR functionality is missing. \&\fBcat | sh\fR functionality is missing.
.PP .PP
Quoting in \fBxargs\fR works like \fB\-q\fR in \fBparallel\fR. Doing \fBls | Quoting in \fBxargs\fR works like \fB\-q\fR in \fBparallel\fR. This means
parallel "wc {} \fR> \fB{}.wc"\fR using \fBxargs\fR seems to be impossible. composed commands and redirection is impossible: \fBls | parallel "wc
{} \fR> \fB{}.wc"\fR or \fBls | parallel \*(L"echo {}; ls {}|wc\*(R"\fR cannot be done using
\&\fBxargs\fR.
.SH "BUGS" .SH "BUGS"
.IX Header "BUGS" .IX Header "BUGS"
Filenames beginning with '\-' can cause some commands to give Filenames beginning with '\-' can cause some commands to give
unexpected results, as it will often be interpreted as an option. unexpected results, as it will often be interpreted as an option.
.PP
Some Bash specific constructs like '<(cmd)' do not work. They can be
fixed by prepending '/bin/bash \-c'. How much slower will that be?
.SH "REPORTING BUGS" .SH "REPORTING BUGS"
.IX Header "REPORTING BUGS" .IX Header "REPORTING BUGS"
Report bugs to <bug\-parallel@tange.dk>. Report bugs to <bug\-parallel@tange.dk>.

View file

@ -8,3 +8,5 @@ b35d8e49be8d94899b719c40d3f1f4bb -
6 119994 697800 6 119994 697800
1c0c49286e5b5b18437e51b438ea5475 - 1c0c49286e5b5b18437e51b438ea5475 -
Chars per line: 116300 Chars per line: 116300
'a'
'a'

View file

@ -2,7 +2,9 @@
cd input-files/test08 cd input-files/test08
ls | parallel -q perl -ne '/_PRE (\d+)/ and $p=$1; /hatchname> (\d+)/ and $1!=$p and print $ARGV,"\n"' ls \
| parallel -q perl -ne '/_PRE (\d+)/ and $p=$1; /hatchname> (\d+)/ and $1!=$p and print $ARGV,"\n"' \
| sort
seq 1 10 | parallel -j 1 echo | sort seq 1 10 | parallel -j 1 echo | sort
seq 1 10 | parallel -j 2 echo | sort seq 1 10 | parallel -j 2 echo | sort

View file

@ -15,3 +15,7 @@ echo -n "Chars per line: "
CHAR=$(cat ~/.mop/:parallel | wc -c) CHAR=$(cat ~/.mop/:parallel | wc -c)
LINES=$(cat ~/.mop/:parallel | wc -l) LINES=$(cat ~/.mop/:parallel | wc -l)
echo "$CHAR/$LINES" | bc echo "$CHAR/$LINES" | bc
# Bug before 2009-08-26 causing regexp compile error or infinite loop
echo a | parallel -qX echo "'"{}"' "
echo a | parallel -qX echo "'{}'"

View file

@ -8,3 +8,5 @@ b35d8e49be8d94899b719c40d3f1f4bb -
6 119994 697800 6 119994 697800
1c0c49286e5b5b18437e51b438ea5475 - 1c0c49286e5b5b18437e51b438ea5475 -
Chars per line: 116300 Chars per line: 116300
'a'
'a'