uptime-kuma icon indicating copy to clipboard operation
uptime-kuma copied to clipboard

Bugfix: Wrong database permissions when copying from read-only location

Open JulienMalka opened this issue 2 years ago • 5 comments

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)

JulienMalka avatar Sep 23 '22 02:09 JulienMalka

Hey @louislam could you take a look at this? Thanks!

JulienMalka avatar Oct 16 '22 09:10 JulienMalka

Friendly ping @louislam

JulienMalka avatar Dec 14 '22 10:12 JulienMalka

Is it possible run this statement only if NixOS?

louislam avatar Jan 02 '23 16:01 louislam

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.

RaitoBezarius avatar Jan 02 '23 16:01 RaitoBezarius

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.

JulienMalka avatar Jan 06 '23 14:01 JulienMalka

Hey @louislam, this is still important to me.

JulienMalka avatar Feb 03 '23 07:02 JulienMalka

ping @louislam

JulienMalka avatar Feb 26 '23 17:02 JulienMalka

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).

JulienMalka avatar Mar 10 '23 22:03 JulienMalka