#44566: fontconfig: fc-cache fails on AFP/SMB homes, cache rebuilt on every launch -----------------------------+-------------------------------- Reporter: michael-lists@… | Owner: macports-tickets@… Type: defect | Status: new Priority: Normal | Milestone: Component: ports | Version: 2.3.1 Keywords: | Port: fontconfig -----------------------------+-------------------------------- Our user accounts have their home directories on an AFP or SMB server. If the fontconfig cache is outdated (e.g. because fonts have been added to /Library/Fonts since fontconfig was last updated via MacPorts), it gets rebuilt when you run {{{fc-cache}}} or use a program that depends on fontconfig (such as gnuplot when outputting to PDF). Unfortunately, fontconfig fails to successfully build a cache at ~/.cache/fontconfig if that folder is on a network home directory. This means that the lengthy caching procedure (1-3 minutes) is run every time a program depending on fontconfig is run. The caching issue can be fixed by applying the following patch: {{{ --- src/fcatomic.c.orig 2012-05-28 15:58:56.000000000 +0900 +++ src/fcatomic.c 2014-08-07 11:47:45.000000000 +0200 @@ -131,7 +131,7 @@ FcAtomicLock (FcAtomic *atomic) return FcFalse; } ret = link ((char *) atomic->tmp, (char *) atomic->lck); - if (ret < 0 && errno == EPERM) + if (ret < 0 && (errno == EPERM || errno == ENOTSUP)) { /* the filesystem where atomic->lck points to may not supports * the hard link. so better try to fallback }}} and adding it to the Portfile: {{{ --- /tmp/Portfile 2014-08-07 11:49:34.000000000 +0200 +++ /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/graphics/fontconfig/Portfile 2014-08-07 11:50:31.000000000 +0200 @@ -38,7 +38,7 @@ lappend add_fonts ${prefix}/share/fonts set docdir ${prefix}/share/doc/${name} -patchfiles patch-docbook-4.2.diff +patchfiles patch-docbook-4.2.diff patch-fcatomic.diff # *** No scandir function available. # https://bugs.freedesktop.org/show_bug.cgi?id=77034 }}} An identical bug affecting the Haiku operating system was reported upstream two years ago (see https://bugs.freedesktop.org/show_bug.cgi?id=30077#c17) and ended up being closed because by POSIX, ''link()'' should only return ''EPERM'' in this situation, i.e. this is an OS bug and not a fontconfig bug. We could try reporting it anyway, but in the meantime a patch in MacPorts would be helpful. -- Ticket URL: <https://trac.macports.org/ticket/44566> MacPorts <http://www.macports.org/> Ports system for OS X