Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 772245 - app-editors/mousepad-0.5.2 "select all" broken on some arch
Summary: app-editors/mousepad-0.5.2 "select all" broken on some arch
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal major (vote)
Assignee: XFCE Team
URL: https://gitlab.xfce.org/apps/mousepad...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-23 14:36 UTC by David Duchesne
Modified: 2021-03-01 18:57 UTC (History)
6 users (show)

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


Attachments
emerge --info on core2/GCC9 system (file_772245.txt,7.75 KB, text/plain)
2021-02-23 14:49 UTC, David Duchesne
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Duchesne 2021-02-23 14:36:00 UTC
Quote from my message on the forum :
After updating mousepad to 0.5.2.
I'm unable to use "select all", either by the shortcut (ctrl+A) or clicking in the menu "select all".

Now the strange thing begins.. On my desktop (which uses GCC 10.2.0 and bdver2 march), there is no issue. Works as expected.
It only happens on my laptop, which uses GCC 9.3.0 and core2 march..
Otherwise no difference between my systems, same profile (hardened), same packages and both are fully updated..

I tried to compile it with debug enabled and ran it with gdb but since it doesn't crash, it doesn't show much info.
So legit bug ? Or something else ?

edit : Made two gif to show the issue :
https://i.ibb.co/T4STgQJ/core2.gif
https://i.ibb.co/xXHkwKS/bdver2.gif

An user can confirm the issue on his system as well, quote :

I can verify this glitch. [...]
My primary desktop is 9.3.0 and my system compiled native (Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz). 


Reproducible: Always
Comment 1 David Duchesne 2021-02-23 14:49:33 UTC
Created attachment 688143 [details]
emerge --info on core2/GCC9 system
Comment 2 Jory A. Pratt gentoo-dev 2021-02-23 16:04:53 UTC
I have checked this on a core2 system, I have checked my aarch64 machines an a i686 machine. All work as expected, which would suggest a permissions issue with ~/.config/Mousepad
Comment 3 David Duchesne 2021-02-23 17:07:25 UTC
(In reply to Jory A. Pratt from comment #2)
> I have checked this on a core2 system, I have checked my aarch64 machines an
> a i686 machine. All work as expected, which would suggest a permissions
> issue with ~/.config/Mousepad

Permissions were fine but I deleted ~/.config/Mousepad to start fresh anyway -> Issue persists.
I tried also to create a new user with a fresh xfce profile, same issue.

Then I put mousepad-0.5.1 in my localrepo and compiled it and it works fine again. So it seems mousepad-0.5.2, at least on my system and figueroa's system on the forum.
Comment 4 David Duchesne 2021-02-23 17:08:43 UTC
(In reply to David Duchesne from comment #3)
> (In reply to Jory A. Pratt from comment #2)
> > I have checked this on a core2 system, I have checked my aarch64 machines an
> > a i686 machine. All work as expected, which would suggest a permissions
> > issue with ~/.config/Mousepad
> 
> Permissions were fine but I deleted ~/.config/Mousepad to start fresh anyway
> -> Issue persists.
> I tried also to create a new user with a fresh xfce profile, same issue.
> 
> Then I put mousepad-0.5.1 in my localrepo and compiled it and it works fine
> again. So it seems mousepad-0.5.2, at least on my system and figueroa's
> system on the forum.
*So it seems mousepad-0.5.2 has an issue
Comment 5 Andy Figueroa 2021-02-23 20:24:05 UTC
I confirm the existence of this bug. Newly installed Mousepad-0.5.2 no select-all.

Downgraded to 0.5.1 via local repo, select-all works as normal.

I'm on a stable, up-to-date, amd64 system.
Comment 6 David Duchesne 2021-02-24 17:13:16 UTC
After some compile test, I found that the following commit is causing the issue on my amd64 / core2 system.

https://gitlab.xfce.org/apps/mousepad/-/commit/5b3baf90cc6934d623042525e00f2648f6d3c6f4

The previous commit doesn't cause any issue (select all works)
Comment 7 Robin Couto 2021-03-01 07:17:38 UTC
I reproduced this and narrowed it down to having glib-2.66.7 compiled with gcc-9.3.0 while gcc-10.2.0 produces a working library. The aforementioned commit switches to signalling glib for this bit of buffer management instead of doing it in-house. The symptom is such that if you first select any amount of text and then hit Ctrl+A, it deselects everything, as if glib is using null or only one position for both the beginning and end of the new selection, instead of using the beginning and end of the text.
Comment 8 Robin Couto 2021-03-01 07:44:48 UTC
P.S. Normally, CFLAGS="-march=amdfam10 -O2 -pipe" so I tried the others:
-O, -O1, -O2, -O3, -Ofast, -Og -> fail
-Os, -O0 -> pass
Comment 9 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-03-01 08:16:53 UTC
Thank you for your detailed research!

Let's see what glib maintainers think of it.  CC-ing toolchain in case they have any idea what could go wrong here.
Comment 10 Mart Raudsepp gentoo-dev 2021-03-01 12:10:36 UTC
I think the code behaviour in that mousepad commit is just undefined behaviour.

select-all signal takes a boolean parameter, that says if to select all or unselect all. If you don't pass it, it's probably undefined behaviour and it does whatever happens to be in some next bytes on signal emission data or something.

https://developer.gnome.org/gtk3/stable/GtkTextView.html#GtkTextView-select-all

They need to do
g_signal_emit_by_name (window->active->textview, "select-all", TRUE);
not
g_signal_emit_by_name (window->active->textview, "select-all");
Comment 11 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-03-01 12:23:48 UTC
Thanks for the reply.  I'll send a patch upstream.
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2021-03-01 12:39:08 UTC
Let's wait if upstream replies, and then I'll backport it.
Comment 13 Larry the Git Cow gentoo-dev 2021-03-01 13:15:12 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47ca700313a5a01e042d1308598b10e2fdc24af4

commit 47ca700313a5a01e042d1308598b10e2fdc24af4
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2021-03-01 13:12:55 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2021-03-01 13:15:09 +0000

    app-editors/mousepad: Backport select-all fix
    
    Closes: https://bugs.gentoo.org/772245
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 .../mousepad/files/mousepad-0.5.2-select-all.patch | 28 ++++++++++++++++++++++
 ...sepad-0.5.2.ebuild => mousepad-0.5.2-r1.ebuild} |  4 ++++
 ...sepad-0.5.3.ebuild => mousepad-0.5.3-r1.ebuild} |  4 ++++
 3 files changed, 36 insertions(+)
Comment 14 Robin Couto 2021-03-01 14:26:59 UTC
oh, that is funny. Obviously I never expected 'select-all' handler to have its own power to select none. TIL:RTFD. Thanks!