nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Erroneous bash continuation gets LexerNoViableAltException error but continues to run.

Open grosscol opened this issue 1 year ago • 0 comments

Bug report

(Please follow this template replacing the text between parentheses with the requested information)

Expected behavior and actual behavior

Expect nextflow workflow to error and halt.

Actual behavior is to print error message, but continue with erroneous process. Emitting error unknown recognition error type: groovyjarjarantlr4.v4.runtime.LexerNoViableAltException

Steps to reproduce the problem

Have a bash script with a line continuation that has a trailing space.

infiles = Channel.fromPath(".*")                                                
                                                                                
process foo {                                                                   
  input:                                                                        
  file infile from infiles                                                      

  script:                                                                       
  """
  # A trailing space after the '\' on the following line triggers this issue.                                                                           
  echo ${infile} |\                                                             
  wc -l                                                                         
  """                                                                           
}  

Program output

∫ grosscol/scratch ⮞ nextflow run lexer_error.nf 
N E X T F L O W  ~  version 20.10.0
Launching `lexer_error.nf` [cranky_lovelace] - revision: 365f5d420f
unknown recognition error type: groovyjarjarantlr4.v4.runtime.LexerNoViableAltException
executor >  local (4)
[28/df5a52] process > foo (3) [100%] 4 of 4 ✔

(Copy and paste here output produced by the failing execution. Please highlight it as a code block. Whenever possible upload the .nextflow.log file.)

Environment

  • Version: 20.10.0 build 5430
  • System: Linux 5.15.0-46-generic
  • Runtime: Groovy 3.0.5 on OpenJDK 64-Bit Server VM 13.0.7+5-Ubuntu-0ubuntu120.04
  • Bash version: GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

Additional context

The above will generate a shell script that may actually run, but is missing the pipe and continuation. An example .command.sh with the missing pipe and continuation:

#!/bin/bash -ue
echo scratch.R 
wc -l

I suspect this is what caused the error in described in the prior issue: https://github.com/nextflow-io/nextflow/issues/2680

grosscol avatar Sep 06 '22 19:09 grosscol