Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -- to printf #4212

Closed
arnaudceol opened this issue Aug 24, 2023 · 1 comment · Fixed by #4213
Closed

Add -- to printf #4212

arnaudceol opened this issue Aug 24, 2023 · 1 comment · Fixed by #4213
Labels

Comments

@arnaudceol
Copy link

We are running nextflow in our instititute on a HPC cluster (pbspro). From time to time the the jobs fail with the following message:

Command wrapper:
  /var/spool/pbs/mom_priv/jobs/1746174.hpcfe01.SC: line 317: printf: -1: invalid option
  printf: usage: printf [-v var] format [arguments]

The error refers to the on_exit part of teh scripts:

on_exit() {
    exit_status=${nxf_main_ret:=$?}
    printf $exit_status > /scratch/work/b8/be8af4032f03985a745180e11b5b9d/.exitcode
    set +u
    [[ "$tee1" ]] && kill $tee1 2>/dev/null
    [[ "$tee2" ]] && kill $tee2 2>/dev/null
    [[ "$ctmp" ]] && rm -rf $ctmp || true
    rm -rf $NXF_SCRATCH || true
    sync || true
    exit $exit_status
}

There may be many reasons for the original error to occurs (almost all the time the pipeline calls samtools, it may also be related to some latency on our cluster).

Nevertheless it may be useful to protect the string given to printf in order to avoid errors at this step. It should be doable with by adding -- : printf -- $exit_status (see for instance https://unix.stackexchange.com/questions/22764/dashes-in-printf)

@pditommaso
Copy link
Member

Issues solved in less than 4 hours! OSS is great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants