Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#52029 closed defect (fixed)

fontconfig 2.12.1 breaks wine and wine-devel

Reported by: mf2k (Frank Schima) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.4
Keywords: haspatch Cc: jyrkiwahlstedt, mojca (Mojca Miklavec), paul@…, dgonyier (Dwaine Gonyier), LeoFCardoso (Leonardo), petrov@…, tc01@…
Port: fontconfig wine

Description

The recent update to fontconfig 2.12.1 breaks both wine and wine-devel for me. While this is likely an upstream issue, I'm documenting the problem here.

Here is the runtime error I see:

$ wine myapp.exe
err:winediag:nulldrv_CreateWindow Application tried to create a window, but no driver could be loaded.
err:winediag:nulldrv_CreateWindow The explorer process failed to start.
err:ole:apartment_createwindowifneeded CreateWindow failed with error 0

Going back to fontconfig 2.12.0 fixes it.

$ port installed fontconfig 
The following ports are currently installed:
  fontconfig @2.12.0_1+universal (active)
  fontconfig @2.12.1_0+universal

Attachments (3)

wine-devel.diff (1.2 KB) - added by mf2k (Frank Schima) 8 years ago.
SystemFontsDetails.txt (170.5 KB) - added by tc01@… 8 years ago.
Details of Apple Fonts that causes this bug.
patch-src-fccache.c.diff (603 bytes) - added by tc01@… 8 years ago.
Patch for Fontconfig 2.12.1 security patch bug

Download all attachments as: .zip

Change History (22)

comment:1 Changed 8 years ago by mf2k (Frank Schima)

Bug filed with wine bug tracker at <https://bugs.winehq.org/show_bug.cgi?id=41152>.

comment:2 Changed 8 years ago by mf2k (Frank Schima)

Port: wine added

I got some interesting feedback that I will be testing soon.

@ryan: Is there a particular reason we use fontconfig with wine and wine-devel? Can we disable it? I will test without it later tonight hopefully.

"For what it's worth, Wine does not use FontConfig by default on macOS. It uses the native Mac font APIs, instead. MacPorts overrides this by specifying --with-fontconfig as a configure option. Should still work, of course.

Also, which user/graphics driver is your prefix configured to use? Can't hurt to add +x11drv,+macdrv channels to the log that Nikolay requested. "

Do you know what graphics driver he is asking for? I see none of those in the configure.args.

comment:3 Changed 8 years ago by mf2k (Frank Schima)

I built it using --without-fontconfig and it does work again. However it seems like a lower resolution because the windows are bigger now.

Maybe can we get a variant for fontconfig that is the default but at least I can turn it off if needed to get it to run?

I tried playing with the Mac driver by setting --without-x but there was no obvious change - it still had the bigger windows.

Last edited 8 years ago by mf2k (Frank Schima) (previous) (diff)

Changed 8 years ago by mf2k (Frank Schima)

Attachment: wine-devel.diff added

comment:4 Changed 8 years ago by mf2k (Frank Schima)

I have attached a patch for wine-devel to add a default variant for fontconfig usage.

comment:5 Changed 8 years ago by mf2k (Frank Schima)

Keywords: haspatch added

comment:6 Changed 8 years ago by bnilsson11

Same with me.

If I uninstall 2.12.1 and use the previous 2.12.0_1 wine starts working again.

comment:7 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added

Cc Me!

comment:8 Changed 8 years ago by paul@…

Cc: paul@… added

Cc Me!

comment:9 Changed 8 years ago by dgonyier (Dwaine Gonyier)

Cc: dgonyier@… added

Cc Me!

comment:10 Changed 8 years ago by LeoFCardoso (Leonardo)

Cc: leonardo.f.cardoso@… added

Cc Me!

comment:11 Changed 8 years ago by petrov@…

Cc: petrov@… added

Cc Me!

comment:12 Changed 8 years ago by bnilsson11

The new wine 1.8.4_0 is still broken with fontconfig 2.12.1. Works with fontconfig 2.12.0.

Last edited 8 years ago by bnilsson11 (previous) (diff)

comment:13 Changed 8 years ago by bnilsson11

Is there a way to blacklist updates of a specific port? I am using wine in my daily work, and now I have to disable my weekly "port upgrade outdated" to keep it working due to the broken fontconfig 2.12.1/wine combination. If I could block the fontconfig upgrade, wine would be fine. It seems this will not be fixed anytime soon...

comment:14 Changed 8 years ago by mf2k (Frank Schima)

@ryandesign: Are you OK with the patch I submitted which adds a variant to allow this port to function without command line gymnastics?

Last edited 8 years ago by mf2k (Frank Schima) (previous) (diff)

comment:15 Changed 8 years ago by tc01@…

It took me a while but I nailed down what the cause of this bug, and the font files involved. It has to do with the security patch at https://cgit.freedesktop.org/fontconfig/commit/?id=7a4a5bd7897d216f0794ca9dbce0a4a5c9d14940 .

The following patch code:

for (j = font->num, l = FcPatternEltValues(e); j >= 0 && l; j--, l = FcValueListNext(l))
    if (l->next != NULL && !FcIsEncodedOffset(l->next))
        break;
if (j < 0)
    return FcFalse;

is the cause of the bug. It is supposed to check the following:

"Iterating linked lists must not take longer than the amount of elements specified. A violation of this rule can break a possible endless loop."

Font->num doesn't indicate the elements in the linked list, and I couldn't find any variable which tracks this within its data structure. The linked list contains the Font Family names for different languages. Font->num indicates the number of elts a pattern has, so there is no relationship between them.

On the Mac there are 33 fonts within the /System/Library/Fonts directory which causes an issue with the above code since they contain Font Family names in 31 different languages and the Pattern has 23 elts. (see attached file SystemFontDetails.txt for font details)

I have attached my patch file patch-src-fccache.c.diff to fix this bug in Fontconfig 2.12.1

Changed 8 years ago by tc01@…

Attachment: SystemFontsDetails.txt added

Details of Apple Fonts that causes this bug.

Changed 8 years ago by tc01@…

Attachment: patch-src-fccache.c.diff added

Patch for Fontconfig 2.12.1 security patch bug

comment:16 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: tc01@… added

Looks like the fontconfig developers came to a similar conclusion in the upstream bug report. I've committed their patch. Please check whether fontconfig @2.12.1_1 (r152719) has fixed this problem.

comment:17 Changed 8 years ago by bnilsson11

Seems to be working for me now. Thanks for the effort.

comment:18 Changed 8 years ago by mf2k (Frank Schima)

Resolution: fixed
Status: newclosed

Yes, it works for me too now.

comment:19 Changed 8 years ago by bnilsson11

Works, however when looking closer, small fonts are much uglier than before, and harder to read. Seems like "sub pixel grey-scaling" is not used. But this is another issue, at least wine now works.

Note: See TracTickets for help on using tickets.