You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2022/11/20 23:08:28 UTC
[GitHub] [cordova-cli] Ekleog opened a new issue, #588: Template directory on read-only filesystem makes cordova crash
Ekleog opened a new issue, #588:
URL: https://github.com/apache/cordova-cli/issues/588
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
<!-- Include all relevant information that might help understand and reproduce the problem -->
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
<!-- What command or code is needed to reproduce the problem? -->
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
<!-- In what environment, on what platform or on which device are you experiencing the issue? -->
Running cordova create on NixOS.
### Version information
<!--
What are relevant versions you are using?
For example:
Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
Other Frameworks: Ionic Framework and CLI version
Operating System, Android Studio, Xcode etc.
-->
Cordova CLI 11.0.0
## Checklist
<!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
- [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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] breautek commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1336259326
> Well, I have no idea what that's supposed to do, but I get the following result:
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
> before I learn node to make it, as I've literally never developed in node yet,
There is a [chmod](https://nodejs.org/docs/latest-v14.x/api/fs.html#fs_fspromises_chmod_path_mode) 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](https://join.slack.com/t/cordova/shared_invite/zt-z70vy6tx-7VNulesO0Qz0Od9QV4tc1Q) community, or the [Dev Mailing List](https://cordova.apache.org/contact/). 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] Ekleog commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
Ekleog commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1326613686
Sorry for mis-explaining! This is not a `umask` issue, just that the `cordova` template repository is `u-w`.
So, as `cordova` basically does `cp -R $templatedir $outdir` ([here for cordova create](https://github.com/apache/cordova-create/blob/master/index.js#L119), though I haven't checked where for cordova platform add), it carries over the `u-w` permission that was on the template files (but not on umask or anything), and then fails for further changes.
I would definitely not expect `umask u-w` situations to work with cordova, but I do think cordova also adding the write permission for the user before trying to change files would work. At least I can say that after manually fixing up the copied template permissions, everything else seems to work fine :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] breautek closed issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
breautek closed issue #588: Template directory on read-only filesystem makes cordova crash
URL: https://github.com/apache/cordova-cli/issues/588
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] breautek commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1336251329
My concern is the template is 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:
`settings.gradle`
```groovy
rootProject.name = 'gradletest'
```
`build.gradle`
```groovy
// Can be left empty
```
Then run `gradle wrapper`, does gradle successfully installs the wrapper?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] breautek commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1322199347
If I understand it correctly, in you're environment you effectively have `umask` set to something restrictive, like read-only, so when cordova creates a new directory, by default it only has readonly permissions. Is that correct?
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:
> * What went wrong:
Gradle could not start your build.
> Could not create service of type BuildLifecycleAwareVirtualFileSystem using GradleUserHomeServices.createVirtualFileSystem().
> java.io.FileNotFoundException: /home/norman/.gradle/.tmp/gradle_fs_probing9830715162890560142.tmp (Permission denied)
So read-only filesystems is not something we can reasonably support because third-party tooling also doesn't support this kind of environments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] Ekleog commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
Ekleog commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1339970710
Got it thanks! I'll do when I manage to get a PR done :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] Ekleog commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
Ekleog commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1336255583
Well, I have no idea what that's supposed to do, but I get the following result:
```
$ gradle wrapper
Starting a Gradle Daemon (subsequent builds will be faster)
BUILD SUCCESSFUL in 9s
1 actionable task: 1 executed
$ ls
build.gradle gradle gradlew gradlew.bat settings.gradle
```
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 :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] Ekleog commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
Ekleog commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1336204330
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 `chmod u+w` just between the copy and editing the files.
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)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org
[GitHub] [cordova-cli] breautek commented on issue #588: Template directory on read-only filesystem makes cordova crash
Posted by GitBox <gi...@apache.org>.
breautek commented on issue #588:
URL: https://github.com/apache/cordova-cli/issues/588#issuecomment-1326622052
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org