svenstaro / rofi-calc

🖩 Do live calculations in rofi!
MIT License
991 stars 32 forks source link

Segfault when attempting to calculate deteminant #72

Closed quantumech3 closed 3 years ago

quantumech3 commented 3 years ago

When I run rofi -modi calc -show calc -calc-command 'xdotool type --clearmodifiers "{result}"' and attempt to type det([[1,0],[0,1]), I get the following error message:

** (process:14304): ERROR **: 14:18:50.962: Process errored with: Child process killed by signal 11
[1]    14304 trace trap (core dumped)  rofi -modi calc -show calc -calc-command  -verbose

I am using Ubuntu 20.04. I hope the information I provided is useful, but please let me know if you need anything else to solve this problem.

Qalc runs this command fine in the terminal which leads me to believe that this is a problem with rofi-calc.

svenstaro commented 3 years ago

Could you try building rofi and qalculate from source running those?

quantumech3 commented 3 years ago

I will do that, but I think I found the issue. It seems to be a qalc problem actually I was wrong. I traced the problem back to the subprocess spawning that happening periodically when calling qalc and discovered that qalc segfaults when I run qalc -s update_exchange_rates "det([[". I think what this means is that I can solve the issue by making rofi-calc only evaluate my expression after I press return. When I add det([[1,0],[0,1]]) to the history file and run it in rofi, the command works, so maybe the problem can be solved by preemptively handling bad syntax while the user is still typing a query since qalc doesnt.

quantumech3 commented 3 years ago

I made a pull request with a janky fix for this issue. It will not query qalc if input is either 'det([[' or 'det(['.

svenstaro commented 3 years ago

Thanks, but frankly this is the wrong place to fix this behavior in qalc. Rather than masking the issue, we should try to get it fixed upstream. A segfault should never occur, after all! Can you contact upstream about this and link the upstream issue report here please?

quantumech3 commented 3 years ago

Sure I can do that.

quantumech3 commented 3 years ago

Here is the issue I made https://github.com/Qalculate/libqalculate/issues/324

svenstaro commented 3 years ago

Thanks. Just out of interest: Did you try building current qalc from source? Maybe the issue was already resolved upstream.

quantumech3 commented 3 years ago

Thanks. Just out of interest: Did you try building current qalc from source? Maybe the issue was already resolved upstream.

No I didnt, turns out that was the problem haha.