chmln / handlr

A better xdg-utils
MIT License
616 stars 24 forks source link

Panic when mimeapps.list is not writable #54

Open 1sixth opened 2 years ago

1sixth commented 2 years ago

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.

SenchoPens commented 2 years ago

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

Artturin commented 2 years ago

this was fixed in https://github.com/chmln/handlr/pull/48 however there hasn't been a release since