<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - FcAtomicLock fails on OS X on network mounts"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=82358">82358</a>
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>fontconfig-bugs@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>FcAtomicLock fails on OS X on network mounts
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>freedesktop@behdad.org
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Mac OS X (All)
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>michael-lists@physcip.uni-stuttgart.de
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>x86-64 (AMD64)
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>2.11
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>library
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>fontconfig
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On OS X systems (in my case, OS X 10.9.4), if the cache folder is on a mounted
network share (e.g. because the user's home directory is on an SMB or AFP
server), running fc-cache will fail to write to ~/.cache/fontconfig. This means
the lengthy caching process is performed every time fontconfig is used.

The issue can be fixed by applying the patch below as evidently, OS X returns
ENOTSUP when link() is performed on a file system that does not support
hardlinks instead of EPERM.

The issue occurs in fontconfig 2.10 and 2.11, possibly older ones as well.

--- 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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>