Andreas Metzler wrote:
> Iirc two days ago (Mon 19 Jan) wmaker stopped working, it crashes
> immediately. Downgrading libfontconfig1 from 2.17.1-3 to 2.15.0-2.4
> (and libpangoft2-1.0-0 to 1.56.4-1) makes the crash go away.

FWIW, I can't reproduce with xnest but that's probably because I
haven't rebooted for a while and have the old fontconfig library
loaded.  I don't want to reboot right now :)

The attached test program clearly demonstrates the problem.

> FcPatternObjectAddWithBinding (p=0x0, object=12, value=...,
>     binding=FcValueBindingStrong, append=1) at ./src/fcpat.c:654

The first argument (the pattern) shouldn't be NULL here; that's why
the crash happens.

> #1  0x00007ffff7f5e8b5 in makeFontOfSize (
>     font=0x555555641540 "sans 
> serif:pixelsize=12:xlfd=-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*", 
> size=0, fallback=0x0) at ./WINGs/wfont.c:109
>         pattern = 0x0
>         result = 0x7ffff7ddfb17 <_XAllocID+39> "H\211\330[\303\017\037@"

The problem is here: FcNameParse, which is called at the beginning of
makeFontOfSize (wfont.c:100), is unable to parse the string so it
destroys the created pattern.

Running the attached program on trixie gives:

$ ./fc
Pattern has 3 elts (size 16)
        family: "sans serif"(s)
        pixelsize: 12(f)(s) 13(f)(s)
        xlfd: <unknown>(s)

On unstable, it crashes in the same way as wmaker.  Passing only the
xlfd definition works, and the first part "sans serif:pixelsize=12"
also works.

On trixie:

$ fc-match "sans 
serif:pixelsize=12:xlfd=-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*"
DejaVuSans.ttf: "DejaVu Sans" "Book"

On unstable:

$ fc-match "sans 
serif:pixelsize=12:xlfd=-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*"
Fontconfig warning: using without calling FcInit()
Unable to parse the pattern

There's a bug reported for fontconfig upstream which might be related:

https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/505

After reading the FcNameParse documentation, it is not immediately
clear to me whether wmaker passes an illegitimate string which
suddenly stopped working or if it is a fontconfig bug that it no
longer parses valid strings.
#include <fontconfig/fontconfig.h>

int
main (void)
{
  const char *font = "sans serif:pixelsize=12"
    ":xlfd=-*-helvetica-medium-r-normal-*-%d-*-*-*-*-*-*-*";
  FcPattern *pat;

  FcInit ();
  pat = FcNameParse ((const FcChar8 *) font);
  FcPatternAddDouble (pat, FC_PIXEL_SIZE, (double)13);
  FcPatternPrint (pat);

  return 0;
}

/*
Local Variables:
compile-command: "make fc CFLAGS=-g LDLIBS=\"`pkg-config --libs fontconfig`\""
End:
*/

Reply via email to