<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 --- - Pathnames mangled under windows"
href="https://bugs.freedesktop.org/show_bug.cgi?id=74559">74559</a>
</td>
</tr>
<tr>
<th>Assignee</th>
<td>fontconfig-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Summary</th>
<td>Pathnames mangled under windows
</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>Windows (All)
</td>
</tr>
<tr>
<th>Reporter</th>
<td>tomsies@mighty.co.za
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86 (IA32)
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Component</th>
<td>library
</td>
</tr>
<tr>
<th>Product</th>
<td>fontconfig
</td>
</tr></table>
<p>
<div>
<pre>I have compiled fontconfig as a static library (not a dll) on Windows (Windows
7) using Mingw64 under MSYS.
The issue I am facing is that all the path names inside of fontconfig are being
mangled from the provided /dir/subdir/fonts to c:\msys\dir\subdir\fonts. For
example in the test folder of the source tree I see fonts.conf.in
<fontconfig>
<dir>@FONTDIR@</dir>
<cachedir>@CACHEDIR@</cachedir>
</fontconfig>
which translates (under MSYS) to the correct answer of
<fontconfig>
<dir>/home/dirk/mybuild/test/fonts</dir>
<cachedir>/home/dirk/mybuild/test/cache.dir</cachedir>
</fontconfig>
However if I now run fc-list, fc-cat or whatever either in a Windows command
prompt, or in the MSYS shell I get no output. If I change the <dir> tag to
<dir>c:\msys\home\dirk\mybuild\test\fonts</dir>, I get output when running on
windows command prompt. No matter what combination of stuff I put in fonts.conf
execution in the MSYS shell fails. Note that the environment variable
FONTCONFIG_FILE is being correctly treated as a unix path under MSYS, and a
windows path under windows command prompt (i.e. I don't get "Fontconfig error:
Cannot load default config file" when these are set appropriately). However
from there on the path mangeling takes effect on the paths and files defined in
the fonts.conf. Note, I don't know if the package is not reading the fonts.conf
under MSYS (after checking for its existence), or if the file is being parsed
and the file / path names are getting messed up after they are read.
On inspection I see that there is a bunch of code in fontconfig (copied from
fccfg.c) that does:
#ifdef _WIN32
{
char *p;
if(!GetModuleFileName(NULL, (LPCH) fontconfig_path,
sizeof(fontconfig_path))) ........
#endif
This test (_WIN32) does not take account of whether the library is compiled as
a dll (shared) or not. I have not checked the windows API to see if it returns
a path when invoked from a static library, but documentation indicates that it
will.
The test also does not care that the execution environment is unix like (MSYS,
CygWin) or Windows. I haven't looked at this under CygWin and cannot comment if
the same issue applies, but I assume it will.
In all events a path returned by the windows GetModuleFileName API is not going
to work with unix like paths used in standard c. With a test like this at
compile time, perhaps a better test would be
#if defined (_WIN32) && defined (_MSCVER)
on the assumption that if microsofts compiler is involved then the target is
vanilla windows? Or otherwise a test for _POSIX to see if standard path
resolution can be done?</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>