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

swaybar: add NULL check when listing workspaces #5367

Merged
merged 1 commit into from
May 20, 2020

Conversation

milkey-mouse
Copy link
Contributor

For some reason my version of sway doesn't show workspace names:

$ swaymsg -t get_outputs
Output HDMI-A-1 '(null) (null) (null)' (inactive)
Output HDMI-A-2 '(null) (null) (null)' (inactive)

Which is weird, but it's no reason to crash swaybar. The field is
totally missing from the JSON, so it ends up doing strcmp(NULL, name)
which is undefined behavior.

For some reason my version of sway doesn't show workspace names:

    $ swaymsg -t get_outputs
    Output HDMI-A-1 '(null) (null) (null)' (inactive)
    Output HDMI-A-2 '(null) (null) (null)' (inactive)

Which is weird, but it's no reason to crash swaybar. The field is
totally missing from the JSON, so it ends up doing strcmp(NULL, name)
which is undefined behavior.
Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this can happen when all outputs are disabled.

Thanks!

@emersion emersion merged commit 45e4e92 into swaywm:master May 20, 2020
@milkey-mouse
Copy link
Contributor Author

That's the weird thing, none of my outputs are disabled. I'm writing this in a window on HDMI-A-1 right now. I think it's a graphics driver issue, but everything is working fine. I know get_outputs has worked correctly before so something else must have changed.

I do have workspaces turned off though (or at least, I only have one workspace enabled, and workspaces disabled on the swaybar config). Maybe that has something to do with it?

I didn't consider this worth opening an issue for because it seems harmless and I have no idea what the problem is (and it probably isn't sway's fault anyway).

@milkey-mouse milkey-mouse deleted the fix-swaybar branch May 20, 2020 22:08
@emersion
Copy link
Member

Do you have debug logs?

Make sure to grab the latest wlroots commit, it contains some maybe-related fixes.

@milkey-mouse
Copy link
Contributor Author

Here are my debug logs: https://gist.github.com/milkey-mouse/dac49c33fb66a55d558a3ef278a7c3f7

The problem shows up the same in sway/wlroots 1.4 and master, although master also takes ~10 seconds to exit (which sway 1.4 doesn't).

@Xyene
Copy link
Member

Xyene commented May 21, 2020

This is caused by a bug upstream in json-c (json-c/json-c#599). #5349 and #5350 have more info; it's been fixed upstream but not yet repackaged everywhere.

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

Successfully merging this pull request may close these issues.

3 participants