mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-26 07:57:58 +00:00
parallel: fixed --results if argument contains \t \0 and /. This may have destroyed default --colsep=\t.
This commit is contained in:
parent
c8051ced91
commit
7a2e3d731b
|
@ -74,8 +74,9 @@ if($::opt_skip_first_line) {
|
|||
if($::opt_header and not $::opt_pipe) {
|
||||
my $fh = $fhlist[0];
|
||||
# split with colsep or \t
|
||||
# TODO should $header force $colsep = \t if undef?
|
||||
# $header force $colsep = \t if undef?
|
||||
my $delimiter = $::opt_colsep;
|
||||
$delimiter ||= '$';
|
||||
my $id = 1;
|
||||
for my $fh (@fhlist) {
|
||||
my $line = <$fh>;
|
||||
|
@ -675,7 +676,7 @@ sub parse_options {
|
|||
if(defined $::opt_tmpdir) { $ENV{'TMPDIR'} = $::opt_tmpdir; }
|
||||
if(defined $::opt_help) { die_usage(); }
|
||||
if(defined $::opt_colsep) { $Global::trim = 'lr'; }
|
||||
if(defined $::opt_header) { $::opt_colsep = defined $::opt_colsep ? $::opt_colsep : "\t"; }
|
||||
# if(defined $::opt_header) { $::opt_colsep = defined $::opt_colsep ? $::opt_colsep : "\t"; }
|
||||
if(defined $::opt_trim) { $Global::trim = $::opt_trim; }
|
||||
if(defined $::opt_arg_sep) { $Global::arg_sep = $::opt_arg_sep; }
|
||||
if(defined $::opt_arg_file_sep) { $Global::arg_file_sep = $::opt_arg_file_sep; }
|
||||
|
@ -4227,7 +4228,7 @@ sub args_as_filename {
|
|||
CORE::push(@res,
|
||||
$Global::input_source_header{$n+1},
|
||||
map { s/\\/\\\\/g;
|
||||
s/\t/\\\t/g;
|
||||
s/\t/\\t/g;
|
||||
s/\0/\\0/g;
|
||||
s:/:\\_:g; $_ }
|
||||
$rec_ref->[$n]->orig());
|
||||
|
|
|
@ -42,10 +42,10 @@ echo "bug #36657: --load does not work with custom ssh";
|
|||
parallel --load=1000% -S "/usr/bin/ssh localhost" echo ::: OK
|
||||
|
||||
echo "bug #34958: --pipe with record size measured in lines";
|
||||
seq 10 | parallel --pipe -L 4 cat\;echo FOO
|
||||
seq 10 | parallel -k --pipe -L 4 cat\;echo FOO | uniq
|
||||
|
||||
echo "bug #34958: --pipe with record size measured in lines";
|
||||
seq 10 | parallel --pipe -l 4 cat\;echo FOO
|
||||
seq 10 | parallel -k --pipe -l 4 cat\;echo FOO | uniq
|
||||
|
||||
echo "### Test --results";
|
||||
mkdir -p /tmp/parallel_results_test;
|
||||
|
@ -72,4 +72,9 @@ echo "### Test --results --header :";
|
|||
parallel -k --header : --results /tmp/parallel_results_test/testC echo {a} {b} ::: a I II ::: b III IIII
|
||||
ls /tmp/parallel_results_test/testC*; rm /tmp/parallel_results_test/testC*
|
||||
|
||||
echo "### Test --results --header : piped";
|
||||
mkdir -p /tmp/parallel_results_test;
|
||||
(echo Col; perl -e 'print "backslash\\tab\tslash/null\0eof\n"') | parallel --header : --result /tmp/parallel_results_test/testF_ true;
|
||||
ls /tmp/parallel_results_test/testF*; rm /tmp/parallel_results_test/testF*
|
||||
|
||||
EOF
|
||||
|
|
|
@ -181,3 +181,6 @@ II IIII
|
|||
/tmp/parallel_results_test/testCstdout_a I b IIII
|
||||
/tmp/parallel_results_test/testCstdout_a II b III
|
||||
/tmp/parallel_results_test/testCstdout_a II b IIII
|
||||
### Test --results --header : piped
|
||||
/tmp/parallel_results_test/testF_stderr_Col backslash\\tab\tslash\_null\0eof
|
||||
/tmp/parallel_results_test/testF_stdout_Col backslash\\tab\tslash\_null\0eof
|
||||
|
|
Loading…
Reference in a new issue