Closed Wiian16 closed 5 months ago
Can reproduce. Sadly I have absolutely no idea why this happens all of a sudden. Do you have some time to dive into this perhaps? I'm not sure when I'll have time.
Same here. I've tried to git bisect, but I haven't found a good commit all the way back to v2.0.0. Probably something happened upstream.
Unfortunately, I am not familiar with C, so I won't be much help. I can tell you that it was probably a recent package update that broke it, but I had a large amount of updates (122) during my last upgrade, so I may not be able to track it down.
managed to get some insight into it with GDB (really tricky to do considering how rofi works) and the error in calc appears to be happening here, but the traceback is less-than-ideal
one thing I did notice is that libqalculate on arch recently-ish updated, and appears to return the same exit code (1) as rofi-calc said the subprocess was returning when given an illegal expression (in my case 70p), is this taken into account?
I downgraded my libqalculate to version 4.9.0, and that seems to have fixed the issue.
Somethings fucky with libqalculate 5 then. I don't really have time to dive into the specifics currently. I'd be very happy if someone could look into this. I'd be happy to review/merge/release.
so, I took the simplest test (-qalc-binary false
) and it crashes when I type anything, I think the problem is that it doesn't handle it properly when the qalc-binary
returns a non-zero exit code?
built libqalculate v4.9.0 from source, when pointing rofi-calc to that it works properly
...and as I suspected, v4.9.0, when given an invalid expression returns an exit code of 0, while v5 returns an exit code of 1
the program needs to be changed to properly handle the qalc-binary returning a non-zero exit code
here's a temporary workaround:
create a new script named qalc
in some directory in your PATH which appears before the directory the real qalc
binary is. i chose ~/.local/bin/qalc
. then just call the real qalc binary and then exit 0
:
#!/usr/bin/env bash
/usr/bin/qalc "$@"
exit 0
Also experiencing this. If I type sq
(trying to type sqrt
) it crashes like so (I think the warning is completely unrelated but just including all output):
** (process:85780): WARNING **: 22:45:08.529: Mode 'calc' does not have a type set. Please update mode/plugin.
** (process:85780): ERROR **: 22:45:10.225: Process errored with: Child process exited with code 1
[1] 85780 trace trap (core dumped) rofi -show calc -modi calc -no-show-match -no-sort
I also get this crash when I type r
and nothing else:
** (process:87212): WARNING **: 22:47:42.492: Mode 'calc' does not have a type set. Please update mode/plugin.
** (process:87212): ERROR **: 22:47:43.100: Process errored with: Child process exited with code 1
[1] 87212 trace trap (core dumped) rofi -show calc -modi calc -no-show-match -no-sort
Distro: Arch
Rofi fork: lbonn's Wayland fork, version 1.7.5+wayland3-1
rofi-calc version: 2.2.0-1
same issue on NixOS unstable can be solved be using downgrading libqalculate using overlays
# Add this to configuration.nix
nixpkgs.overlays = [
(final: prev: {
# see https://github.com/svenstaro/rofi-calc/issues/117
libqalculate = prev.libqalculate.overrideAttrs (_: rec {
pname = "libqalculate";
version = "4.8.1";
src = pkgs.fetchFromGitHub {
owner = "qalculate";
repo = "libqalculate";
rev = "v${version}";
sha256 = "sha256-4WqKlwVf4/ixVr98lPFVfNL6EOIfHHfL55xLsYqxkhY=";
};
});
})
];
Fixed by cc6cd37ac64a54f7cee8309a63f5eb7f9c9745f1.
Version
Version: 1.7.5+wayland2-1-gff2338c3 (makepkg)
Distro
Archcraft x86_64
Command
rofi -show calc -modi calc -no-show-match -no-sort
This problem started after a system upgrade, this command did not change
Steps to reproduce
Expected Behavior
Rofi calc shouldn't crash when using functions
Core dump