[Fontconfig] fontconfig: Branch 'master' - 2 commits

Raimund Steger rs at mytum.de
Tue Jan 1 10:36:25 PST 2013


Behdad Esfahbod wrote:
> New commits:
> commit 1fbb0b3b15774c187c697a80fb3c89bc1f3e0006
> Author: Behdad Esfahbod <behdad at behdad.org>
> Date:   Sun Dec 30 19:08:42 2012 -0600
>
>      Don't warn if an unknown element is used in an expression
>
>      The type will be resolved at runtime...

> [...]

> diff --git a/src/fcxml.c b/src/fcxml.c
> index d31caf5..cf9c8dd 100644
> --- a/src/fcxml.c
> +++ b/src/fcxml.c
> @@ -594,6 +594,10 @@ FcTypecheckValue (FcConfigParse *parse, FcType value, FcType type)
>   	    return;
>   	if (type == (FcType) -1)
>   	    return;
> +	/* It's perfectly fine to use user-define elements in expressions,
> +	 * so don't warn in that case. */
> +	if (value == (FcType) -1)
> +	    return;
>   	FcConfigMessage (parse, FcSevereWarning, "saw %s, expected %s",
>   			 FcTypeName (value), FcTypeName (type));
>       }

Hm, while testing this I noticed that FcPatternDuplicate returns 0 if it 
comes across an element where the FcObjectValidType check fails, such as 
when a string was assigned to the 'dpi' property.

This causes a coredump in fc-match, which probably has been like this 
forever; only, the warning gave a hint previously which it doesn't do 
now. (fontconfig still prints a warning if FC_DEBUG=4096 
(FC_DBG_OBJTYPES) is set though.)

E. g. for the config:

<match target="font">
   <edit name="test_string" mode="assign">
     <string>test_string_value</string>
   </edit>
   <edit name="dpi" mode="assign">
     <name>test_string</name>
   </edit>
</match>

(which is of course invalid anyway) the following happens:

sun2:fontconfig)FC_DEBUG=4096 fc-match -v
FC_DEBUG=4096
FC_DEBUG=4096
FcPattern object dpi does not accept value  "test_string_value"Null pattern
zsh: segmentation fault (core dumped)  FC_DEBUG=4096 fc-match -v

Maybe the FC_DBG_OBJTYPES warnings would be better off as normal 
warnings? Although this would mean that the user sees at least two 
warnings in the case of a direct assignment (without <name>).

Everything else works just fine AFAICT.

Raimund



-- 
Worringer Str 31 Duesseldorf 40211 DE  home: <rs at mytum.de>
+49-179-2981632 icq 16845346           work: <rs at interface-ag.de>


More information about the Fontconfig mailing list