Template directory on read-only filesystem makes cordova crash
- Dominant language
- JavaScript
- Stars
- 967
- Forks
- 344
- Avg merge
- 8h 41m
- Merged PRs (30d)
- 9
Description
Hey! I've been trying to use cordova for a few hours, and am hitting a small issue.
Anyway, thank you for all the work you put into it!
# Bug Report
## Problem
### What is expected to happen?
If the template directory of cordova is on a read-only filesystem, I expect `cordova create` or `cordova platform add` to work and chmod the files so that they become read-writable by me
### What does actually happen?
Instead, cordova doesn't chmod the files, then tries to write to them and errors out.
## Information
I'm using NixOS, and this is the reason why my template directory is on a read-only filesystem: cordova as a whole is on a read-only filesystem. So the reproducer will be using nix, that can that said be installed on other OSes too.
This is easy to work around for `cordova create`, but `cordova platform add` is a bit harder to work around. The repro is also more complex so I'm not writing it down, but it should be the same fix anyway: after copying from a template directory cordova would need to chmod u+w the files
### Command or Code
Reproducer:
```
[/tmp]$ nix-shell -I channel:nixos-unstable -p nodePackages.cordova
[nix-shell:/tmp]$ cordova create test
Creating a new cordova project.
EACCES: permission denied, open '/tmp/test/config.xml'
```
### Environment, Platform, Device
Running cordova create on NixOS.
### Version information
Cordova CLI 11.0.0
## Checklist
- [x] I searched for existing GitHub issues
- [x] I updated all Cordova tooling to most recent version
- [x] I included all the necessary information above
Contributor guide
Research direction
Start by reproducing the read-only-template failure with `cordova create` using the NixOS command shown, then trace the template-copy path used by `cordova create` and `cordova platform add`. Done means copied files from a read-only template can be made user-writable before Cordova writes them, without breaking normal template copies; add or update regression coverage for both affected commands if the existing tests expose these paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100