Opened 10 years ago

Closed 8 years ago

#44566 closed defect (fixed)

fontconfig: fc-cache fails on AFP/SMB homes, cache rebuilt on every launch

Reported by: michael-lists@… Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.3.1
Keywords: Cc:
Port: fontconfig

Description

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.

Change History (6)

comment:1 Changed 10 years ago by michael-lists@…

Cc: michael-lists@… added
Last edited 10 years ago by michael-lists@… (previous) (diff)

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

Cc: michael-lists@… removed
Owner: changed from macports-tickets@… to ryandesign@…

In the future, please Cc the port maintainers (port info --maintainers fontconfig). As reporter, you do not need to Cc yourself.

comment:3 Changed 10 years ago by ryandesign (Ryan Carsten Schmidt)

Yes, this should be reported to the developers of fontconfig. I don't like committing to forever maintaining a patch that is not specific to MacPorts' needs.

comment:4 Changed 10 years ago by michael-lists@…

I reported the bug on Friday (https://bugs.freedesktop.org/show_bug.cgi?id=82358) and it was just fixed today: http://cgit.freedesktop.org/fontconfig/commit/?id=841753a93f0e5698663b7931b8456e7b96259f54. As the next fontconfig release is probably still several months away, including the patch against the current version in MacPorts would be helpful.

comment:5 Changed 8 years ago by mkuron (Michael Kuron)

Fontconfig 2.12 has been released in the meantime, which fixes the issue reported here. Please close this ticket.

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

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.