tools icon indicating copy to clipboard operation
tools copied to clipboard

DSL2 Modules are created with only read permissions

Open IllustratedMan-code opened this issue 2 years ago • 7 comments

Description of the bug

Created module files only have read permissions. This is odd because the user has to edit the module file once it is created.

Command used and terminal output

$ nf-core modules create

                                          ,--./,-.
          ___     __   __   __   ___     /,-._.--~\
    |\ | |__  __ /  ` /  \ |__) |__         }  {
    | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                          `._,._,'

    nf-core/tools version 2.4.1 - https://nf-co.re
    There is a new version of nf-core/tools available! (2.6)


WARNING  Can't find a '.nf-core.yml' file that defines 'repository_type'                                                                                                                                              
module_utils.py:380? Is this repository an nf-core pipeline or a fork of nf-core/modules? Pipeline
INFO     To avoid this prompt in the future, add the 'repository_type' key to a root '.nf-core.yml' file.                                                                                                             
module_utils.py:391? Would you like me to add this config now? [y/n] (y): y
INFO     Config added to '.nf-core.yml'                                                                                                                                                                               
module_utils.py:395INFO     Repository type: pipeline                                                                                                                                                                                           
create.py:92INFO     Press enter to use default values (shown in brackets) or type your own responses. ctrl+click underlined text to open links.                                                                                         create.py:96Name of tool/subtool: test/test
WARNING  Could not find Conda dependency using the Anaconda API: 'test'                                                                                                                                                     
create.py:167Do you want to enter a different Bioconda package name? [y/n]: n
WARNING  Could not find Conda dependency using the Anaconda API: 'test'                                                                                                                                                     
create.py:174         Building module without tool software and meta, you will need to enter this information manually.                                                                                                                               
GitHub Username: (@author): 
GitHub Username: (@author): IllustratedMan-code
WARNING  Does not look like a valid GitHub username (must start with an '@')!                                                                                                                                               
create.py:209GitHub Username: (@author): @IllustratedMan-code
INFO     Provide an appropriate resource label for the process, taken from the nf-core pipeline template.                                                                                                                   
create.py:217         For example: process_low, process_medium, process_high, process_long                                                                                                                                                            
? Process resource label: process_low
INFO     Where applicable all sample-specific information e.g. 'id', 'single_end', 'read_group' MUST be provided as an input via a 
Groovy Map called 'meta'. This information may not be required in some instances, for    create.py:231         example indexing reference genome files.                                                                                                                                                                                        
Will the module require a meta map of sample information? [y/n] (y): y
INFO     Created / edited following files:                                                                                                                                                                                  
create.py:269           ./modules/local/test/test.nf

$ ls -l modules/local/test/test.nf
-r--r--r-- 1 david users 4526 Oct 12 12:46 modules/local/test/test.nf

System information

OS: Nixos Python 3.8.12 nf-core/tools 2.4.1

IllustratedMan-code avatar Oct 12 '22 16:10 IllustratedMan-code

When using this command and selecting : nf-core modules create fastqc --author @IllustratedMan-code --label process_low --meta --force and selecting modules for repository type, I get errors like this: PermissionError: [Errno 13] Permission denied: './modules/fastqc/main.nf' which indicate to me that nf-core is unable to write to the file.

IllustratedMan-code avatar Oct 12 '22 18:10 IllustratedMan-code

I also checked that it wasn't a default file permissions issue:

$ touch test.txt
$ ls -l test.txt
-rw-r--r-- 1 david users 0 Oct 12 14:04 test.txt
$ echo "hello, world" >> test.txt
$ cat test.txt
hello, world

I can definitely read and write to a file I have created with default permissions.

IllustratedMan-code avatar Oct 12 '22 18:10 IllustratedMan-code

I can't reproduce the problem.

asp8200 avatar Mar 18 '24 09:03 asp8200

This is a Nix/NixOS-specific issue because files in /nix/store are by default read-only and nf-core mirrors theses file permissions when setting up a project. This is why @asp8200 probably cannot reproduce it. I don't think this can be fixed on the Nix-side and I don't think this is a todo on the nf-core side. But it could be. For example, nf-core could not simply mirror the file permissions but always make sure that write access is guaranteed afterwards. Here are further details. I'm happy to help here.

rollf avatar Apr 25 '24 04:04 rollf

Things that would need to be fixed for Nix/NixOS (as far as I can tell now):

  • +r operations on all template files
  • +x on /bin/*
  • Do not fix the shebang in /bin/*, python files, etc.

rollf avatar Apr 26 '24 08:04 rollf