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

[BUG] rofi-calc crashes after typing first character when run from dwm keybind #2088

Open
2 tasks done
intael opened this issue Jan 23, 2025 · 12 comments
Open
2 tasks done
Labels

Comments

@intael
Copy link

intael commented Jan 23, 2025

Rofi version (rofi -v)

Version: 1.7.8-dirty

Configuration

https://gist.github.com/intael/75adaa6d3904c88da89cf7d5bea4389e

Theme

https://gist.github.com/intael/735bc351098e80ab58a5aa8287610152

Timing report

No response

Launch command

rofi -modi calc -show calc -no-show-match -no-sort

Step to reproduce

The issue occurs when using this plugin: https://github.com/svenstaro/rofi-calc

Step 1: Define a dwm keybind like this:

static const char *roficalc[] = {"rofi", "-show", "calc", "-no-show-match", " -no-sort", NULL};
static const Key keys[] = { {MODKEY, XK_x, spawn, {.v = roficalc}} }

Step 2: Use the keybind. The rofi calc window will shut down after entering the first character.

Expected behavior

When pressing the key the roficalc window correctly appears, but it shuts down after pressing the first character.

Actual behavior

When I press the key, the rofi calc window appears but it shuts down after typing the first character. Looking at dwm's logs I see the following:

** (process:45348): WARNING **: 17:07:04.497: Mode 'calc' does not have a type set. Please update mode/plugin.

(process:45348): GLib-WARNING **: 17:07:05.263: ../glib/glib/gmain.c:5892: waitid(pid:45353, pidfd=10) failed: No child processes (10). See documentation of g_child_watch_source_new() for possible causes.

** (process:45348): ERROR **: 17:07:05.263: Process errored with: Child process exited abnormally

Additional information

The command works correctly when running it from the shell (zsh), but doesnt when run from a dwm keybind.

Using rofi-calc via AUR package rofi-calc-git r201.c54d8e7-1

Using wayland display server protocol

  • No, I don't use the wayland display server protocol

I've checked if the issue exists in the latest stable release

  • Yes, I have checked the problem exists in the latest stable version
@intael intael added the bug label Jan 23, 2025
@DaveDavenport
Copy link
Collaborator

Out of curiosity? why is this reported here and not at the plugin?

Is this plugin compiled against this version of rofi?

@DaveDavenport
Copy link
Collaborator

DaveDavenport commented Jan 23, 2025

nevermind.

@DaveDavenport DaveDavenport closed this as not planned Won't fix, can't repro, duplicate, stale Jan 23, 2025
@DaveDavenport DaveDavenport reopened this Jan 23, 2025
@DaveDavenport
Copy link
Collaborator

Can you generate a backtrace? but I am pretty sure this is a plugin bug, not a rofi bug.

@intael
Copy link
Author

intael commented Jan 23, 2025

Out of curiosity? why is this reported here and not at the plugin?

I'm wild-guessing it's a rofi issue since the plugin works correctly when I run it from the shell. It only seems to crash when running this from a dwm keybind. I could very well be wrong of course.

Is this plugin compiled against this version of rofi?

How can I check that? I compiled the plugin from the latest commit of its repo.

@DaveDavenport
Copy link
Collaborator

 I'm wild-guessing it's a rofi issue since the plugin works correctly when I run it from the shell. It only seems to crash when running this from a dwm keybind. I could very well be wrong of course.

I don't see how this follows? if it work when you launch rofi from a shell? then how is it being launched from dwm an indication that it is a rofi issue? It is the same rofi (I hope) ...

Normally when things work differently when launched from keybinding is that the environment is different.
So that is something I would investigate.

Given that it crashes when the plugin calls qalc? and the crash you report seems to be in something waiting on a subprocess,

./glib/glib/gmain.c:5892: waitid(pid:45353, pidfd=10) failed: No child processes (10). See documentation of g_child_watch_source_new() for possible causes.

I suspect that qalc crashes directly, then taking the plugin with it, that then takes rofi with it.

@svenstaro ^^ I think this is a plugin issue, what do you think?

@intael
Copy link
Author

intael commented Jan 23, 2025

You're most likely right. Thanks a lot for the pointers and for having a look. Do you prefer I close this issue and move it to the plugin repo?

@svenstaro
Copy link
Contributor

No idea why this would fail like this. :/

@DaveDavenport
Copy link
Collaborator

@intael Can you figure this one out:

Normally when things work differently when launched from keybinding is that the environment is different.
So that is something I would investigate.

then try to launch qalc in the environment of 'dwm' keybinding, see if it works. It might be an invalid locale?

@intael
Copy link
Author

intael commented Jan 24, 2025

then try to launch qalc in the environment of 'dwm' keybinding, see if it works. It might be an invalid locale?

Tried now to switch the keybind to calling qalc directly from a script:

static const char *qalc[] = {"/home/intael/.dwm/qalc.sh", NULL};
#!/bin/zsh
echo $(qalc 1 + 1)

But it works, I can see this in dwm's logs:

1 + 1 = 2

@DaveDavenport
Copy link
Collaborator

you are changing the environment as you do not call it directly. You are launching a shell first (zsh). This is more equivalent to calling it from a terminal (where same shell is launched).

@intael
Copy link
Author

intael commented Jan 24, 2025

Good point. Calling the qalc binary from the dwm keybind seems to work too:

static const char *qalc[] = {"qalc", "1 + 1", NULL};

Works as well regardless of the amount of tokens I pass to qalc:

static const char *qalc[] = {"qalc", "1", NULL};

@DaveDavenport
Copy link
Collaborator

odd. thx for testing.

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

No branches or pull requests

3 participants