[Fontconfig] How necessary is 'scandir'?

Raimund Steger rs at mytum.de
Sun Feb 15 05:01:37 PST 2015

On 02/12/15 03:59, Akira TAGOH wrote:
> If the own scandir works on the platforms where don't have POSIX version
> of scandir, we could drop that check. if anyone confirm, that would be
> appreciated.

The question is, for what cases would we need our own scandir. Because:

(1) On Win32, FcDirChecksum isn't used (we use 
FcStat/GetFileAttributesEx only)

(2) On all platforms we supported before 
38ab7ab2fbd83c0c62e4b78302b5fe89da0cb79e (where the configure check was 
introduced), scandir *is* available. Either the POSIX one (in the sense 
of [1]) which uses dirent comparators or the one that uses void* [2].

Because of that, we wouldn't need to specifically test for [1] and could 
just assume it's there, avoiding clashes with UNIX compilers that can't 
execute our test because of -Werror.

Now what about platforms where there is indeed neither 
GetFileAttributesEx nor any version of scandir? I admit that these were 
probably supported before 0ac6c98294d666762960824d39329459b22b48b7 
(https://bugs.freedesktop.org/show_bug.cgi?id=25535) and aren't now. If 
we wanted to support those, then yes, we would need to check for both 
scandir versions, although the check for the POSIX variant could be a 
simple fallback that doesn't need -Werror. And even then, we could 
probably simply ignore the result of FcIsFsMtimeBroken as the change 
addressed FAT file systems on UNIX/Linux only. I mean, the set of 
UNIX/Linux systems that don't have scandir and at the same time use a 
font directory on FAT is probably rather small...


[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/alphasort.html
[2] http://netbsd.gw.com/cgi-bin/man-cgi?scandir+3+NetBSD-current

> On Thu, Feb 12, 2015 at 7:55 AM, Raimund Steger <rs at mytum.de
> <mailto:rs at mytum.de>> wrote:
>     On 02/11/15 19:40, Michael Felt wrote:
>         Yes, xlC, and I was hoping it was just a stray gcc flag.
>     If that's indeed the reason, you can:
>     (0) To confirm whether it is, replace WERROR_CFLAGS="-Werror" with
>     WERROR_CFLAGS="" in configure.ac <http://configure.ac>, run
>     autoconf, configure etc.
>     If that works:
>     (1) find an equivalent flag for XL C and create a patch, just like
>     the one for SunPRO [1]. If I understand the documentation right [2],
>     this could be "-qmaxerr=1:w" (increase the number 1 if some
>     'statement not reached' stuff gets in your way), but it's difficult
>     to say without an actual installation to test.
>     (2) create a patch similar to (1), but set WERROR_CFLAGS="" or
>     disable the scandir check altogether when compiling with XL C. I
>     believe before [3] there wasn't even a scandir check, and the change
>     was only to silence warnings on NetBSD if I read the commit right. I
>     doubt you will have any problem on AIX.
>     Actually I'm still somewhat unhappy that configure wants to
>     acknowledge the POSIX version of scandir specially when only
>     recognizing the NetBSD version would probably have sufficed ...
>     would have saved us a lot of if's, maybe even the one for $os_win32.
>     But I'll shut my mouth again.
>     -Raimund
>     [1]
>     http://cgit.freedesktop.org/__fontconfig/commit/?id=__694368667a15341ea30b37a36e9540__e6b1492680
>     <http://cgit.freedesktop.org/fontconfig/commit/?id=694368667a15341ea30b37a36e9540e6b1492680>
>     [2]
>     http://www-01.ibm.com/support/__knowledgecenter/SSGH2K_13.1.0/__com.ibm.xlc131.aix.doc/__compiler_ref/opt_maxerr.html?__lang=en
>     <http://www-01.ibm.com/support/knowledgecenter/SSGH2K_13.1.0/com.ibm.xlc131.aix.doc/compiler_ref/opt_maxerr.html?lang=en>
>     [3]
>     http://cgit.freedesktop.org/__fontconfig/commit/?id=__38ab7ab2fbd83c0c62e4b78302b5fe__89da0cb79e
>     <http://cgit.freedesktop.org/fontconfig/commit/?id=38ab7ab2fbd83c0c62e4b78302b5fe89da0cb79e>
> --
> Akira TAGOH

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