nextflow-io/nextflow

Nextflow on POSIX breaking on input paths starting with hyphen / dash ('-')

Open

#5,186 opened on 2024年7月31日

GitHub で見る
 (1 comment) (0 reactions) (0 assignees)Groovy (3,382 stars) (784 forks)batch import
good first issuesoftware/bash

説明

Bug report

Nextflow is breaking on paths starting with hyphen / dash ('-') because the POSIX shell scripts are interpreting those files as command-line options.

Expected behavior and actual behavior

Nextflow should be able to deal with files with leading hyphens, usually by separating options and arguments by a double dash ('--') in shell commands.

Instead it's letting POSIX shell commands interpret those files as command-line options.

Steps to reproduce the problem

Step 1: Create the ~/minimal directory with the minimal.nf file as below within it:

process test {
    input:
        path(input_file)
    shell:
        '''
        cat -- '!{input_file}'
        '''
}

workflow {
    channel.fromPath("${moduleDir}/test/*")
    | test
}

Step 2: Execute those commands

cd ~/minimal
mkdir test
echo 'This is something' > 'test/-something'
nextflow run minimal.nf

Program output

N E X T F L O W   ~  version 24.04.3

Launching `minimal.nf` [pensive_ride] DSL2 - revision: b7dbed7779

executor >  local (1)
[71/cb15ef] test (1) [100%] 1 of 1, failed: 1 ✘
WARN: Got an interrupted exception while taking agent result | java.lang.InterruptedException
ERROR ~ Error executing process > 'test (1)'

Caused by:
  Process `test (1)` terminated with an error exit status (1)


Command executed:

  cat -- '-something'

Command exit status:
  1

Command output:
  (empty)

Command error:
  rm: invalid option -- 's'
  Try 'rm --help' for more information.

Work dir:
  /home/valle/workspace/exp/minimal/work/71/cb15ef8d5d310beab290e1a92e295e

Tip: when you have fixed the problem you can continue the execution adding the option `-resume` to the run command line

 -- Check '.nextflow.log' file for details

Environment

  • Nextflow version: 24.04.3 build 5916
  • Java version: openjdk 17.0.6 2023-01-17 LTS
  • Operating system: Ubuntu 20.04.6 LTS
  • Bash version: (use the command $SHELL --version): GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

コントリビューターガイド