Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 498924 - x11-misc/dmenu-4.5-r3: xft-patch introduces incorrect case-fallthrough
Summary: x11-misc/dmenu-4.5-r3: xft-patch introduces incorrect case-fallthrough
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal minor (vote)
Assignee: Jeroen Roovers (RETIRED)
URL: http://tools.suckless.org/dmenu/patch...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-01-22 14:00 UTC by Hans-Peter Deifel
Modified: 2016-03-01 03:54 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
New version of the xft-patch (dmenu-4.5-xft-3.patch,12.31 KB, patch)
2014-01-22 14:03 UTC, Hans-Peter Deifel
Details | Diff
Diff to original gentoo xft patch (changes-to-orig-xft-patch.patch,582 bytes, patch)
2014-01-22 14:06 UTC, Hans-Peter Deifel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hans-Peter Deifel 2014-01-22 14:00:35 UTC
The following part of the patch introduces an unintended fallthrough in a case statement:

@@ -359,7 +376,8 @@ keypress(XKeyEvent *ev) {
 	case XK_Return:
 	case XK_KP_Enter:
 		puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
-		exit(EXIT_SUCCESS);
+		ret = EXIT_SUCCESS;
+		running = False;
 	case XK_Right:



This means that everytime the user selects an entry, instead of exiting right away, dmenu selects the next entry (behaviour of XK_Right), redraws and exits immediately afterwards. Normally, one wouldn't notice the last redraw because the time is too short, but compositing managers such as compton have a fade-out effect that takes the last image of a closed window and fade it out slowly. Which means that you get to see the wrongly selected entry.

Reproducible: Always

Steps to Reproduce:
1. Install and start compton
2. Open dmenu with a list of entries and select the first one with Return
Actual Results:  
The next entry is selected, the menu fades away and the original entry is returned on stdout.

Expected Results:  
The current entry should stay selected during fade-out
Comment 1 Hans-Peter Deifel 2014-01-22 14:03:43 UTC
Created attachment 368432 [details, diff]
New version of the xft-patch

Patch to add "break" statements to prevent case-fallthroughs
Comment 2 Hans-Peter Deifel 2014-01-22 14:06:19 UTC
Created attachment 368434 [details, diff]
Diff to original gentoo xft patch
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-22 14:26:30 UTC
This is a more or less "upstream" patch (see URL). Did you point this out to the authors of that patch yet?
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-22 15:10:47 UTC
I can't really test this myself as I use a window manager that does not keeps images of windows around and immediately destroys them instead. The patch went into -r4 whereas -r3 still uses the old patch - let's keep this bug report open for a while so people can see where to complain.
Comment 5 Hans-Peter Deifel 2014-01-22 17:22:56 UTC
Thanks for the fast response.

I sent the patch to the suckless.org list: http://lists.suckless.org/dev/1401/19703.html

Note, that gentoo still differs from the upstream patch, because the patch from bug #470812 never got sent upstream.
Comment 6 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-23 00:30:02 UTC
(In reply to Hans-Peter Deifel from comment #5)

> Note, that gentoo still differs from the upstream patch, because the patch
> from bug #470812 never got sent upstream.

I never got a user response on that and no further bug reports either.
Comment 7 Jeroen Roovers (RETIRED) gentoo-dev 2016-03-01 03:54:22 UTC
4.6 is going stable and has Xft support built in.