Re: [hackers] [st][PATCH] x.c: modify xsettitle to work with musl libc
On 2020-07-03 18:40:09+0200, Hiltjo Posthuma <hiltjo_AT_codemadness.org> wrote:
> On Wed, Jul 01, 2020 at 09:29:25PM +0200, joris.kbos_AT_gmail.com wrote:
> > From: Joris Klaasse Bos <joris.kbos_AT_gmail.com>
> > Before this commit, running st on a system with musl libc would
> > result in a segmentation fault. This is because musl implements
> > locales differently, which means the function
> > Xutf8TextListToTextProperty would fail, because the locale isn't
> > supported, leading to nonexistent memory being freed.
> > I've fixed this by checking if the locale is supported and using
> > XStringListToTextProperty otherwise.
> > ---
> > x.c | 7 +++++--
> > 1 file changed, 5 insertions(+), 2 deletions(-)
> > diff --git a/x.c b/x.c
> > index 210f184..a9632cb 100644
> > --- a/x.c
> > +++ b/x.c
> > _AT_@ -1585,8 +1585,11 @@ xsettitle(char *p)
> > XTextProperty prop;
> > DEFAULT(p, opt_title);
> > - Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
> > - &prop);
> > + if (XSupportsLocale())
> > + Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
> > + &prop);
> > + else
> > + XStringListToTextProperty(&p, 1, &prop);
> > XSetWMName(xw.dpy, xw.win, &prop);
> > XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
> > XFree(prop.value);
> > --
> > 2.27.0
> Just tested it on Voidlinux musl and don't see an issue here.
(I'm not OP)
FWIW, Up-2-Date VoidLinux musl XSupportsLocale() is true.
So, with this new code it still run into old code path.
I'm using st with VoidLinux musl from 2018,
I think st must be fine from as far as that time.
> What locale are you using? Can you post the output of locale?
> Can you provide more details of your system / setup and possibly a simple
> command to reproduce the issue more easily and cause a crash?
> Kind regards,
Received on Sat Jul 04 2020 - 03:02:56 CEST
This archive was generated by hypermail 2.3.0
: Sat Jul 04 2020 - 03:12:32 CEST