nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Fix #3217 fixOwnership not working

Open Kibubu opened this issue 1 year ago • 5 comments

Fixes the issue #3217

Not sure if --from root is there to preserve multiple UIDs from different process.

Signed-off-by: Kibubu [email protected]

Kibubu avatar Sep 19 '22 12:09 Kibubu

Indeed, the flag --from root is used to only apply ownership change to root owner files.

pditommaso avatar Sep 20 '22 07:09 pditommaso

So, should there be another solution that changes only those file created by the task an not those copied in for example?

Kibubu avatar Sep 20 '22 12:09 Kibubu

In your example, you are creating a user in the task execution and using to change the file ownership. Don't think it should be supported such use case

pditommaso avatar Sep 20 '22 12:09 pditommaso

You are correct, this example is rather fabricated, but since I guess he and myself stumbled upon it there might be more people involved. Most will probably just sudo rm those files.

My example could also be buried in script within the container and totally hidden from the user.

But as always if the consequences of removing the --from root clause are greater the benefits this PR and issue can be closed.

Kibubu avatar Sep 20 '22 15:09 Kibubu

Ultimately this is an old trick, that would be better to not use and we may even deprecate.

To prevent this problem the user of runOptions can provide a better solution

https://github.com/CRG-CNAG/CalliNGS-NF/blob/master/nextflow.config#L14

pditommaso avatar Sep 21 '22 13:09 pditommaso

Well I guess I'll close the PR but would leave the Issue open for further discussions.

Providing runOptions won't solve the demonstrated problem. The script should show the same behavior regardless of being executed inside a container or not. That also means modifying the script to suit the container could be considered an anti-pattern.

One option would be to add a note to the docs that only containers should not change UIDs during their execution. Or it is the responsibility of the container to chown all created files to the initial UID.

Kibubu avatar Sep 24 '22 19:09 Kibubu