-
Notifications
You must be signed in to change notification settings - Fork 340
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
Template directory on read-only filesystem makes cordova crash #588
Comments
If I understand it correctly, in you're environment you effectively have I think we could probably check and attempt to ensure that the directory permissions it creates have write access instead of assuming, but Cordova also relies on a lot of third-party tooling, like the Android SDK/Gradle, etc. So I'm not sure far that will go. For example, Gradle also fails installing the wrapper in this kind of environment:
So read-only filesystems is not something we can reasonably support because third-party tooling also doesn't support this kind of environments. |
Sorry for mis-explaining! This is not a So, as I would definitely not expect |
Ok, I still don't quite understand though. The template repository is found at https://github.com/apache/cordova-app-hello-world All the files appear to have owner R/W, group R/W, and world Read permissions, which I think should be sufficient? If you have a solution though, feel free to make a PR. |
TL;DR: I'm installing cordova from my package manager, which fetches the cordova repository and stores it on a filesystem where all files are 0444 (or 0555 depending on the file type). This is why just a recursive-copy doesn't work. The only solution I can think of would be to do a recursive I'm willing to open a PR with it, but seeing it's the same solution as it'd be for umask that you close… I'd just like to check that it sounds like a reasonable idea to you? (before I learn node to make it, as I've literally never developed in node yet, I'm using cordova to compile a rust wasm app to android, so it'd take me quite a while if it's for the PR to just be closed) Slightly-longer explanation for why cordova is on a chmod 0444 filesystem: I'm using NixOS, which does not respect FHS to provide features that are off-topic here but can be found on the internet. As such, binaries basically do not work well off the upstream package managers, including npm. So I'm using a tool that converts cordova's npm package into a nix package to be able to use it; but then nix package must live on that 0444 filesystem (because it's part of nix's design, required to provide said features) |
My concern is the template is only one cog of the machine.... We utilise several third-party tooling that also creates directories and file structures. Like the Android SDK uses Gradle as it's main build tool and Gradle projects installs a local gradle wrapper. These tools also generates folder structures and if they work in your environment as is, then awesome... but if they do not work, then that's a problem that cannot be solved by Cordova, even if we solve the problem with the Cordova app template. For example, if you create a folder and add the following files:
rootProject.name = 'gradletest'
// Can be left empty Then run To be clear, I don't necessary oppose any solutions to fix the template installation, but that only solves one build step. If it fails on another build step, particularly one controlled by third-party tooling like the Android SDK, then the effort of fixing the template installation is kind of wasted. |
Well, I have no idea what that's supposed to do, but I get the following result:
So I guess it works fine? That said, it's definitely possible that other things would break down the line, but at least all the commands except for the template-generating ones of cordova currently seem to work fine on my computer, if I just manually write the template contents :) |
It installs the gradle wrapper. I have been assuming you're potentially working with an Android project, in which case Cordova will effectively do this kind of build step eventually. But yes, it appeared to install the gradle wrapper fine, which looks promising. I'm not 100% sure where you need to add the changes to change the permissions, the template files themselves can be found at https://github.com/apache/cordova-app-hello-world but the installing of the template is likely handled by another package... I think https://github.com/apache/cordova-create
There is a chmod Node API, but it might be cumbersome to use since I think we need to recursively change the permission of the entire template directory structure + it's files. I'm linking Node 14 docs because Cordova still supports Node 14, so have to ensure we don't use any features added later. If you have questions about developing the PR, you can try asking our Slack community, or the Dev Mailing List. Of course you can also ask me but I'm not super familiar with that part of the codebase. Feel free to ping me/request me for review if you manage to develop a PR. |
Got it thanks! I'll do when I manage to get a PR done :) |
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
orcordova platform add
to work and chmod the files so that they become read-writable by meWhat 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
, butcordova 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 filesCommand or Code
Reproducer:
Environment, Platform, Device
Running cordova create on NixOS.
Version information
Cordova CLI 11.0.0
Checklist
The text was updated successfully, but these errors were encountered: