uptime-kuma
uptime-kuma copied to clipboard
Bugfix: Wrong database permissions when copying from read-only location
Tick the checkbox if you understand [x]:
- [x] I have read and understand the pull request rules.
Description
This changes makes sure that the correct permissions are set for the database file when it is being copied from a read-only location. The current behavior is that the database file is being copied with the same permissions as the origin folder, which in case of a read-only folder is a read-only permission. This is pertinent for example for NixOS packaging. NixOS is a linux distribution where all packages are stored in a read-only store. The matter has been discussed here.
Type of change
Please delete any options that are not relevant.
- Bug fix (non-breaking change which fixes an issue)
Checklist
- [x] My code follows the style guidelines of this project
- [x] I ran ESLint and other linters for modified files
- [x] I have performed a self-review of my own code and tested it
- [ ] I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
- [x] My changes generate no new warnings
- [ ] My code needed automated testing. I have added them (this is optional task)
Hey @louislam could you take a look at this? Thanks!
Friendly ping @louislam
Is it possible run this statement only if NixOS?
Is it possible run this statement only if NixOS?
Yes it's possible but every time and then, people using an immutable system, it can be Fedora Silverblue, etc. will have similar issues and will ask to be added here, all in all, it does not sound a good idea to me because the code should ensure that database is of the right permissions to use it, so it's a no-op on other distributions.
I'd agree with @RaitoBezarius, the proposed contribution only set permissions for kuma.db to the correct value, in cases (probably with most distributions) where kuma.db is copied from a writable location this should have no effect. In distributions like NixOS and some other where the packages are installed into an immutable store, my contributions ensure that kuma.db will be writable by uptime-kuma.
Hey @louislam, this is still important to me.
ping @louislam
It seems that the maintainer is not interested in reviewing/merging this one line change. I'll close this PR and continue to maintain a specific patch for NixOS (see here).