Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

panic when mimeapps.list doesn't end with newline? #52

Open
ghost opened this issue Oct 3, 2021 · 1 comment
Open

panic when mimeapps.list doesn't end with newline? #52

ghost opened this issue Oct 3, 2021 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 3, 2021

Thanks for this excellent piece of software.

Version: 0.6.4

When my mimeapps.list doesn't end with a newline I get this panic:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseApps(Error { variant: ParsingError { positives: [value_char], negatives: [] }, location: Pos(308), line_col: Pos((11, 22)), path: None, line: "text/*=emacs.desktop;", continued_line: None })', src/apps/user.rs:12:65
stack backtrace:
   0:     0x55eac2c5c82e - <unknown>
   1:     0x55eac2bfd04c - <unknown>
   2:     0x55eac2c5bf64 - <unknown>
   3:     0x55eac2c5bd9d - <unknown>
   4:     0x55eac2c7a108 - <unknown>
   5:     0x55eac2c7a086 - <unknown>
   6:     0x55eac2c7a042 - <unknown>
   7:     0x55eac2b82210 - <unknown>
   8:     0x55eac2b824f2 - <unknown>
   9:     0x55eac2b90b96 - <unknown>
  10:     0x55eac2c3155b - <unknown>
  11:     0x55eac2c52658 - <unknown>
  12:     0x55eac2b87aab - <unknown>
  13:     0x55eac2c0fe53 - <unknown>
  14:     0x55eac2c0b693 - <unknown>
  15:     0x55eac2c0ddc3 - <unknown>
  16:     0x7fc3d22e2b25 - __libc_start_main
  17:     0x55eac2b8cbbe - <unknown>
  18:                0x0 - <unknown>

When I add a newline, there is no issue.

I think handlr should throw an error here or ignore it.

@Lehmanator
Copy link

Getting a similar issue when an entry in mimeapps.list doesn't have a string on the right-hand side of the =.

$ handlr get x-scheme-handler/matrix

thread 'main' panicked at src/apps/user.rs:12:65:
called `Result::unwrap()` on an `Err` value: ParseApps(Error { variant: ParsingError { positives: [value_char], negatives: [] }, location: Pos(121), line_col: Pos((5, 12)), path: None, line: "audio/mpeg=␊", continued_line: None })
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: core::ops::function::FnOnce::call_once
   4: once_cell::imp::OnceCell<T>::initialize::{{closure}}
   5: once_cell::imp::initialize_inner
   6: once_cell::imp::OnceCell<T>::initialize
   7: handlr::main

This was on NixOS where my user ~/.config/mimeapps.list had some entries lines with no app on the right hand side of the association. Removing the empty entries fixed this for me.

Not sure if lines without the assignment argument are valid in the mimetypes.list spec, but handlr should probably report the malformed file & line number instead of panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant