rschmitt / heatseeker

A high-performance Selecta clone, written in Rust.
MIT License
214 stars 10 forks source link

Intermittent panic on a None value #41

Closed jonahx closed 4 years ago

jonahx commented 4 years ago

This bug seems to occur randomly after hitting enter to make your selection:

stty: 'standard input': unable to perform all requested operations                    
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:378:21                                                                       
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.  

It's most easily explained with a quick video.

15s video of bug

I recorded until I got a success followed by a failure. Note the difference wasn't due to the names selected (dir a in the case of success; file create_public in the case a failure): the same command, in succession, has produced success and failures on both, as I was playing around.

Machine / Install Info:

rschmitt commented 4 years ago

Do you think you could run this with a debug build and RUST_BACKTRACE enabled?

rschmitt commented 4 years ago

I can't immediately reproduce what you're seeing, but the problem evidently has something to do with terminal settings (stty), making it tricky to reproduce your test environment exactly. Additionally, you're running on a fairly old version of macOS which I don't have access to.

In addition to the full backtrace, it would be helpful if you could do the following:

  1. Open a fresh terminal
  2. Run stty -a
  3. Reproduce the bug
  4. Run stty -a again
  5. Paste the output of each stty -a invocation here
rschmitt commented 4 years ago

Please also run the following command to determine whether you have multiple stty executables on your $PATH:

zsh -c 'whence -asv stty'
jonahx commented 4 years ago

Please also run the following command to determine whether you have multiple stty executables on your $PATH:

$ zsh -c 'whence -asv stty'
stty is /usr/local/opt/coreutils/libexec/gnubin/stty -> /usr/local/Cellar/coreutils/8.31/bin/gstty
stty is /bin/stty

In addition to the full backtrace, it would be helpful if you could do the following:

Last login: Sat Dec  7 21:13:28 on ttys007
~/code/j/aoc2019 (master) $ stty -a
speed 9600 baud; rows 45; columns 176;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; status = ^T; min = 1; time = 0;
-parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff ixany imaxbel iutf8
opost -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe -echok -echonl -noflsh -tostop -echoprt echoctl echoke -flusho -extproc
~/code/j/aoc2019 (master) $ \ls | hs | xargs nvim
~/code/j/aoc2019 (master) $ \ls | hs | xargs nvim 
~/code/j/aoc2019 (master) $ \ls | hs | xargs nvim
~/code/j/aoc2019 (master) $ \ls | hs | xargs nvim
stty: 'standard input': unable to perform all requested operations 
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value',
src/libcore/option.rs:378:21 
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.                                                                                                  ~/code/j/aoc2019 (master) $ stty -a                                                                                                                                             speed 9600 baud; rows 45; columns 176;                                                                                                                                          intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y; rprnt = ^R; werase = ^W; lnext = ^V;        discard = ^O; status = ^T; min = 1; time = 0;  -parenb -parodd cs8 hupcl -cstopb cread -clocal -crtscts -ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff ixany imaxbel iutf8 opost -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 isig icanon iexten echo echoe -echok -echonl -noflsh- tostop -echoprt echoctl echoke -flusho -extproc                        

Do you think you could run this with a debug build and RUST_BACKTRACE enabled?

Sure. Can you link me to instructions? I didn't see them in the README and have never used Rust before.

rschmitt commented 4 years ago
$ zsh -c 'whence -asv stty'
stty is /usr/local/opt/coreutils/libexec/gnubin/stty -> /usr/local/Cellar/coreutils/8.31/bin/gstty
stty is /bin/stty

Aha! This is what I suspected. You have GNU coreutils installed from homebrew, and hs is picking up the GNU variant from your $PATH. I suppose I could fix this by invoking /bin/stty instead of leaving it to chance.

jonahx commented 4 years ago

Thank you very much for the quick turnaround!

And btw, I forgot to say it before, but I absolutely love this tool and have been evangelizing it at work.

Should I follow the building instructions in the README and put that binary in my PATH before the homebrew one, or will the homebrew version be updated automatically soon as part of your CD? (Just didn't see it yet).

Thanks again! Jonah

rschmitt commented 4 years ago

And btw, I forgot to say it before, but I absolutely love this tool and have been evangelizing it at work.

Thanks!

Should I follow the building instructions in the README and put that binary in my PATH before the homebrew one, or will the homebrew version be updated automatically soon as part of your CD? (Just didn't see it yet).

Homebrew and Cargo are both updated now. Chocolatey (for Windows) takes a while. If you still get panics, I can follow up with another release which will include debug symbols and enable backtraces by default.