8000 modules using log redirects break when using conda · Issue #8455 · nf-core/modules · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

modules using log redirects break when using conda #8455

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

Open
2 tasks done
znorgaard opened this issue May 13, 2025 · 10 comments · May be fixed by #8476
Open
2 tasks done

modules using log redirects break when using conda #8455

znorgaard opened this issue May 13, 2025 · 10 comments · May be fixed by #8476
Labels
bug Something isn't working

Comments

@znorgaard
Copy link
Contributor

Have you checked the docs?

Description of the bug

Processes that include lines like: 2> >(tee output.log >&2) break if run with conda. Specifically discovered when working with fastp.

Switching them to 2>| >(tee output.log >&2) will fix the issue.

Command used and terminal output

unzip fulcrumgenomics-example.zip
cd fulcrumgenomics-example/
nextflow run main.nf -profile "docker" # works!
nextflow run main.nf -profile "conda" # fails!



Command error:
  .command.sh: line 5: /dev/fd/63: cannot overwrite existing file

Relevant files

fulcrumgenomics-example.zip

System information

Nextflow version: 24.10.6
nf-core/tools version: 3.2.1
Hardware: M3 mac
Executor: local
Container engine: conda 24.11.3
OS: macOS 14.5

@znorgaard znorgaard added the bug Something isn't working label May 13, 2025
@nh13
Copy link
Member
nh13 commented May 13, 2025

Minimal example:

  1. Install java with with sdkman then nextflow as per docs
  2. Run ./nextflow run main.nf:
`main.nf
process EXAMPLE
{
	input:
	val message

	output:
	path('*.log')

	script:
	"""
	(
	 echo "error stream ${message}" >&2;
	 echo "output stream: ${message}";
	) 2> >(tee output.log >&2);
	"""
}


workflow  {
	Channel.of('Bonjour', 'Ciao', 'Hello', 'Hola') | EXAMPLE | view
}
`nextflow.config`
// Set bash options
process.shell = [
	"bash",
    "-C",         // No clobber - prevent output redirection from overwriting files.
    "-e",         // Exit if a tool returns a non-zero status/exit code
    "-u",         // Treat unset variables and parameters as an error
    "-o",         // Returns the status of the last command to exit..
    "pipefail"    //   ..with a non-zero status or zero if all successfully execute
]
output.log
./nextflow run main.nf

 N E X T F L O W   ~  version 25.04.1

Launching `main.nf` [confident_pike] DSL2 - revision: 9def87aeff

executor >  local (4)
ERROR ~ Error executing process > 'EXAMPLE (3)'

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


Command executed:

  (
   echo "error stream Hello" >&2;
   echo "output stream: Hello";
  ) 2> >(tee output.log >&2);

Command exit status:
  1

Command output:
  (empty)

Command error:
  .command.sh: line 5: /dev/fd/63: cannot overwrite existing file

Work dir:
  /path/to/nextflow/minimal/work/bc/f16f1ca4ed7437717c3807417c7866

Tip: view the complete command output by changing to the process work dir and entering the command `cat .command.out`

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

@mahesh-panchal
Copy link
Member

I think you're right. It's to do with noclobber being set.
https://unix.stackexchange.com/a/45203

It's the first time I've seen noclobber interacting like that though, particularly as it's only happening in a conda env. Why is it succeeding in the docker container?

@nh13
Copy link
Member
nh13 commented May 14, 2025

And why haven’t others encountered this when -C Has been part of the template for a while now?

@mahesh-panchal
Copy link
Member

🤷🏽 Very few people running pipelines on macs with conda perhaps. I think many use docker on mac.

@nh13
Copy link
Member
nh13 commented May 14, 2025

Ok, so it's bash vs zsh.

$ bash
$ set -C
$ (   echo "error stream Ciao" >&2;    echo "output stream: Ciao";   ) 2> >(tee output.log >&2);
bash: /dev/fd/63: cannot overwrite existing file

where as for zsh it prints as expected:

$ zsh
$ (   echo "error stream Ciao" >&2;    echo "output stream: Ciao";   ) 2> >(tee output.log >&2);
output stream: Ciao
error stream Ciao

hmmn

@nh13
Copy link
Member
nh13 commented May 14, 2025

bash fails with a simplified substitution:

$ bash --version
GNU bash, version 5.2.37(1)-release (aarch64-apple-darwin24.0.0)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ( echo "error" >&2 ) 2> >(cat)
bash: /dev/fd/63: cannot overwrite existing file

@nh13
Copy link
Member
nh13 commented May 14, 2025

Using /bin/bash (version 3.2 shipped with osx) works, but homebrew's does not

@nh13
Copy link
Member
nh13 commented May 14, 2025

Fails with bash installed with conda too. I also found someone else having the same problem: https://unix.stackexchange.com/questions/554843/how-to-allow-process-substitution-when-noclobber-is-set.

So I'd recommend the solution would be to update all redirects to use the >| redirect to ignore the clobber in this case. @mahesh-panchal does that sound like a reasonable solution?

@mahesh-panchal
Copy link
Member

Yes, that sounds good. Thanks for investigating further.

@znorgaard znorgaard linked a pull request May 14, 2025 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
0