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

--only appears to be broken #85

Closed
sdt16 opened this issue Nov 23, 2020 · 2 comments
Closed

--only appears to be broken #85

sdt16 opened this issue Nov 23, 2020 · 2 comments
Assignees

Comments

@sdt16
Copy link

sdt16 commented Nov 23, 2020

Whenever I use --only, procs panics or outputs nothing.

This is all on x86_64.

With rust nightly (rustc 1.49.0-nightly (f2bbdd0a3 2020-11-04)):

schuyler@laptop:~/dunst$ RUST_BACKTRACE=1 procs --no-header --only Pid i3
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/schuyler/.cargo/registry/src/github.com-1ecc6299db9ec823/procs-0.10.8/src/view.rs:150:20
stack backtrace:
   0: rust_begin_unwind
             at /rustc/f2bbdd0a3257cc980c934a92c5bf9808cf31728c/library/std/src/panicking.rs:495:5
   1: core::panicking::panic_fmt
             at /rustc/f2bbdd0a3257cc980c934a92c5bf9808cf31728c/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/f2bbdd0a3257cc980c934a92c5bf9808cf31728c/library/core/src/panicking.rs:69:5
   3: procs::view::View::filter
   4: procs::run
   5: procs::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

With stable (1.49.0):

schuyler@laptop:~/dunst$ procs --no-header --only Pid i3
schuyler@laptop:~/dunst$ echo $?
0

however, notice the lowercase p in 'pid':

schuyler@laptop:~/dunst$ procs --no-header --only pid i3
thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', /home/schuyler/.cargo/registry/src/github.com-1ecc6299db9ec823/procs-0.10.8/src/view.rs:150:20
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

If I have some time I'll try to dig into this myself.

@dalance dalance self-assigned this Nov 24, 2020
dalance added a commit that referenced this issue Nov 24, 2020
dalance added a commit that referenced this issue Nov 24, 2020
dalance added a commit that referenced this issue Nov 24, 2020
@dalance
Copy link
Owner

dalance commented Nov 24, 2020

Thank you for your report.

The crash seems to occur randomly caused by column kind search order.
pid matches PID or PPID randomly, and PPID becomes crash if PPID is not found in column config.

I changed the way of kind search, and added error handling.

@sdt16
Copy link
Author

sdt16 commented Nov 24, 2020

Fantastic! Thanks for the quick response. I'll try to test it sometime today.

@dalance dalance closed this as completed Jan 28, 2021
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

2 participants