chmln/handlr

Panic when mimeapps.list is not writable

1sixth opened this issue · 2 comments

It seems that handlr expects mimeapps.list to be writable even handlr doesn't need to write to it.

$ handlr --version
handlr 0.6.4
$ chmod -w ~/.config/mimeapps.list
$ export RUST_BACKTRACE=full
$ handlr --version
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })', src/apps/user.rs:12:65
stack backtrace:
   0:     0x5643ea23f4a5 - <unknown>
   1:     0x5643ea1d3c8c - <unknown>
   2:     0x5643ea23e9e4 - <unknown>
   3:     0x5643ea23e7cf - <unknown>
   4:     0x5643ea25e468 - <unknown>
   5:     0x5643ea25e3e6 - <unknown>
   6:     0x5643ea25e3a2 - <unknown>
   7:     0x5643ea15f100 - <unknown>
   8:     0x5643ea15f432 - <unknown>
   9:     0x5643ea16ed9e - <unknown>
  10:     0x5643ea172c1c - <unknown>
  11:     0x5643ea234a43 - <unknown>
  12:     0x5643ea15d18b - <unknown>
  13:     0x5643ea1e9c83 - <unknown>
  14:     0x5643ea1e28e3 - <unknown>
  15:     0x5643ea1e5662 - <unknown>
  16:     0x7efe507f0b25 - __libc_start_main
  17:     0x5643ea16975e - <unknown>
  18:                0x0 - <unknown>

I think handlr should try to write to mimeapps.list only if called with set, unset and add.

That makes it a no-go on declarative distros like NixOS and Guix :(

this was fixed in #48 however there hasn't been a release since