parallel: Fixed bug #65840: --dry-run doesn't apply filters.

This commit is contained in:
Ole Tange 2024-06-10 23:23:19 +02:00
parent 39807949ba
commit 2f2fba268f
3 changed files with 14 additions and 2 deletions

View file

@ -11105,6 +11105,7 @@ sub start($) {
if($Global::interactive or $Global::stderr_verbose) {
$job->interactive_start();
}
$job->openoutputfiles();
# Must be run after $job->interactive_start():
# $job->interactive_start() may call $job->skip()
if($job->{'commandline'}{'skip'}
@ -11112,9 +11113,9 @@ sub start($) {
not $job->filter()) {
# $job->skip() was called or job filtered
$command = "true";
}
$job->openoutputfiles();
} else {
$job->print_verbose_dryrun();
}
my($stdout_fh,$stderr_fh) = ($job->fh(1,"w"),$job->fh(2,"w"));
if($opt::dryrun or $opt::sqlmaster) { $command = "true"; }
$ENV{'PARALLEL_SEQ'} = $job->seq();

View file

@ -16,6 +16,12 @@ export -f stdsort
# Test amount of parallelization
# parallel --shuf --jl /tmp/myjl -j1 'export JOBS={1};'bash tests-to-run/parallel-local-0.3s.sh ::: {1..16} ::: {1..5}
par_filter_dryrun() {
echo 'bug #65840: --dry-run doesnot apply filters'
parallel -k --filter='"{1}" ne "Not"' echo '{1} {2} {3}' ::: Not Is ::: good OK
parallel --dr -k --filter='"{1}" ne "Not"' echo '{1} {2} {3}' ::: Not Is ::: good OK
}
par_uninstalled_sshpass() {
echo '### sshpass must be installed for --sshlogin user:pass@host'
sshpass=$(command -v sshpass)

View file

@ -236,6 +236,11 @@ par_file_ending_in_newline ### Hans found a bug giving unitialized variable
par_file_ending_in_newline gzip /tmp/parallel_f1
par_file_ending_in_newline gzip '/tmp/parallel_f2
par_file_ending_in_newline '
par_filter_dryrun bug #65840: --dry-run doesnot apply filters
par_filter_dryrun Is good
par_filter_dryrun Is OK
par_filter_dryrun echo Is good
par_filter_dryrun echo Is OK
par_fish ### https://github.com/fish-shell/fish-shell/issues/5582
par_fish OK
par_group-by_colsep_space ### --colsep " " should work like ","