Commit 13d2a47d authored by Akira TAGOH's avatar Akira TAGOH

Fix unexpected cache name by double-slash in path

parent faec0b51
...@@ -612,7 +612,7 @@ FcConfigMapFontPath(FcConfig *config, ...@@ -612,7 +612,7 @@ FcConfigMapFontPath(FcConfig *config,
{ {
FcStrList *list; FcStrList *list;
FcChar8 *dir; FcChar8 *dir;
const FcChar8 *map; const FcChar8 *map, *rpath;
FcChar8 *retval; FcChar8 *retval;
list = FcConfigGetFontDirs(config); list = FcConfigGetFontDirs(config);
...@@ -627,15 +627,17 @@ FcConfigMapFontPath(FcConfig *config, ...@@ -627,15 +627,17 @@ FcConfigMapFontPath(FcConfig *config,
map = FcStrTripleSecond(dir); map = FcStrTripleSecond(dir);
if (!map) if (!map)
return 0; return 0;
retval = FcStrBuildFilename(map, path + strlen((char *) dir), NULL); rpath = path + strlen ((char *) dir);
while (*rpath == '/')
rpath++;
retval = FcStrBuildFilename(map, rpath, NULL);
if (retval) if (retval)
{ {
size_t len = strlen ((const char *) retval); size_t len = strlen ((const char *) retval);
if (retval[len-1] == '/') while (len > 0 && retval[len-1] == '/')
{ len--;
/* trim the last slash */ /* trim the last slash */
retval[len-1] = 0; retval[len] = 0;
}
} }
return retval; return retval;
} }
......
...@@ -156,6 +156,10 @@ ls -l $CACHEDIR > out2 ...@@ -156,6 +156,10 @@ ls -l $CACHEDIR > out2
if cmp out1 out2 > /dev/null ; then : ; else if cmp out1 out2 > /dev/null ; then : ; else
echo "*** Test failed: $TEST" echo "*** Test failed: $TEST"
echo "cache was created/updated." echo "cache was created/updated."
echo "Before:"
cat out1
echo "After:"
cat out2
exit 1 exit 1
fi fi
if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then
...@@ -220,7 +224,35 @@ if cmp flist1 flist2 > /dev/null ; then ...@@ -220,7 +224,35 @@ if cmp flist1 flist2 > /dev/null ; then
fi fi
rm -rf $TESTTMPDIR $TESTTMP2DIR out1 out2 xxx flist1 flist2 stat1 stat2 bind-fonts.conf rm -rf $TESTTMPDIR $TESTTMP2DIR out1 out2 xxx flist1 flist2 stat1 stat2 bind-fonts.conf
dotest "Check consistency of MD5 in cache name"
prep
mkdir -p $FONTDIR/sub
cp $FONT1 $FONTDIR/sub
$FCCACHE $FONTDIR
sleep 1
(cd $CACHEDIR; ls -1 --color=no *cache*) > out1
TESTTMPDIR=`mktemp -d /tmp/fontconfig.XXXXXXXX`
mkdir -p $TESTTMPDIR/cache.dir
sed "s!@FONTDIR@!$TESTTMPDIR/fonts!
s!@REMAPDIR@!<remap-dir as-path="'"'"$FONTDIR"'"'">$TESTTMPDIR/fonts</remap-dir>!
s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < $TESTDIR/fonts.conf.in > bind-fonts.conf
cat bind-fonts.conf
$BWRAP --bind / / --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE $TESTTMPDIR/build/test/bind-fonts.conf $TESTTMPDIR/build/fc-cache/fc-cache$EXEEXT $TESTTMPDIR/fonts
(cd $TESTTMPDIR/cache.dir; ls -1 --color=no *cache*) > out2
if cmp out1 out2 > /dev/null ; then : ; else
echo "*** Test failed: $TEST"
echo "cache was created unexpectedly."
echo "Before:"
cat out1
echo "After:"
cat out2
exit 1
fi fi
rm -rf $TESTTMPDIR out1 out2 bind-fonts.conf
else
echo "No bubblewrap installed. skipping..."
fi # if [ x"$BWRAP" != "x" -a "x$EXEEXT" = "x" ]
if [ "x$EXEEXT" = "x" ]; then if [ "x$EXEEXT" = "x" ]; then
dotest "sysroot option" dotest "sysroot option"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment