diff --git a/Makefile b/Makefile index 2807b725..b70463b9 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,17 @@ parallel.1: parallel pod2man parallel > parallel.1 install: parallel parallel.1 - cp parallel /usr/local/bin/parallel - cp parallel.1 /usr/local/man/man1/parallel.1 + install -D -m 755 parallel $(DESTDIR)/usr/bin/parallel + install -D -m 644 parallel.1 $(DESTDIR)/usr/share/man/man1/parallel.1 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) +clean: + rm -f parallel.1 + dist: rm -rf ./unittest/input-files/random_dirs_*_newline || /bin/true rm -rf ./unittest/tmp || /bin/true diff --git a/parallel b/parallel index 8de57f27..6b4e8629 100755 --- a/parallel +++ b/parallel @@ -245,7 +245,9 @@ characters. For example this B: B>B<{}.diff"> -because > needs to be interpreted by the shell. +B + +because > and | need to be interpreted by the shell. 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 it defaults to /bin/echo. So the B functionality is missing. -Quoting in B works like B<-q> in B. Doing B> B<{}.wc"> using B seems to be impossible. +Quoting in B works like B<-q> in B. This means +composed commands and redirection is impossible: B> B<{}.wc"> or B cannot be done using +B. =head1 BUGS @@ -301,6 +305,8 @@ parallel "wc {} >> B<{}.wc"> using B seems to be impossible. Filenames beginning with '-' can cause some commands to give 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 @@ -474,7 +480,8 @@ sub generate_command_line { push @all_word_arg, $substituted; } 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 { # Normal replace @@ -855,11 +862,17 @@ sub print_job { } seek $_, 0, 0 for $out, $err; if($Global::debug) { - while( <$err> ) { print STDERR "ERR: $_" } - while( <$out> ) { print STDOUT "OUT: $_" } - } else { - print STDERR <$err>; - print STDOUT <$out>; + print STDERR "ERR:\n"; + } + my $buf; + while(sysread($err,$buf,1000_000)) { + print STDERR $buf; + } + if($Global::debug) { + print STDOUT "OUT:\n"; + } + while(sysread($out,$buf,1000_000)) { + print STDOUT $buf; } debug("<\fB{}.diff"\fR .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 If you get errors like: .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 \&\fBcat | sh\fR functionality is missing. .PP -Quoting in \fBxargs\fR works like \fB\-q\fR in \fBparallel\fR. Doing \fBls | -parallel "wc {} \fR> \fB{}.wc"\fR using \fBxargs\fR seems to be impossible. +Quoting in \fBxargs\fR works like \fB\-q\fR in \fBparallel\fR. This means +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" .IX Header "BUGS" Filenames beginning with '\-' can cause some commands to give 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" .IX Header "REPORTING BUGS" Report bugs to . diff --git a/unittest/actual-results/test10 b/unittest/actual-results/test10 index da43de87..041aae9e 100644 --- a/unittest/actual-results/test10 +++ b/unittest/actual-results/test10 @@ -8,3 +8,5 @@ b35d8e49be8d94899b719c40d3f1f4bb - 6 119994 697800 1c0c49286e5b5b18437e51b438ea5475 - Chars per line: 116300 +'a' +'a' diff --git a/unittest/tests-to-run/test08.sh b/unittest/tests-to-run/test08.sh index c6f543f6..38db99c8 100644 --- a/unittest/tests-to-run/test08.sh +++ b/unittest/tests-to-run/test08.sh @@ -2,7 +2,9 @@ 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 2 echo | sort diff --git a/unittest/tests-to-run/test10.sh b/unittest/tests-to-run/test10.sh index cf714067..c2e1becb 100644 --- a/unittest/tests-to-run/test10.sh +++ b/unittest/tests-to-run/test10.sh @@ -15,3 +15,7 @@ echo -n "Chars per line: " CHAR=$(cat ~/.mop/:parallel | wc -c) LINES=$(cat ~/.mop/:parallel | wc -l) 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 "'{}'" diff --git a/unittest/wanted-results/test10 b/unittest/wanted-results/test10 index da43de87..041aae9e 100644 --- a/unittest/wanted-results/test10 +++ b/unittest/wanted-results/test10 @@ -8,3 +8,5 @@ b35d8e49be8d94899b719c40d3f1f4bb - 6 119994 697800 1c0c49286e5b5b18437e51b438ea5475 - Chars per line: 116300 +'a' +'a'