Fix empty XDG_CACHE_HOME Behavior
Use the default $HOME/.cache one for empty XDG_CACHE_HOME. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/243
This commit is contained in:
parent
4a1cf888cf
commit
437f03299b
|
@ -1412,6 +1412,8 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!test_dir)
|
||||
fprintf (stderr, "Fontconfig error: No writable cache directories\n");
|
||||
if (d)
|
||||
FcStrFree (d);
|
||||
FcStrListDone (list);
|
||||
|
|
|
@ -2297,7 +2297,7 @@ FcConfigXdgCacheHome (void)
|
|||
|
||||
if (!_FcConfigHomeEnabled)
|
||||
return NULL;
|
||||
if (env)
|
||||
if (env && env[0])
|
||||
ret = FcStrCopy ((const FcChar8 *)env);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -423,4 +423,34 @@ else
|
|||
echo "No test-crbug1004254: skipped"
|
||||
fi
|
||||
|
||||
if [ "x$EXEEXT" = "x" ]; then
|
||||
|
||||
dotest "empty XDG_CACHE_HOME"
|
||||
prep
|
||||
export XDG_CACHE_HOME=""
|
||||
export old_HOME="$HOME"
|
||||
export temp_HOME=$(mktemp -d --tmpdir fontconfig.XXXXXXXX)
|
||||
export HOME="$temp_HOME"
|
||||
cp "$FONT1" "$FONT2" "$FONTDIR"
|
||||
if [ -n "${SOURCE_DATE_EPOCH:-}" ] && [ ${#SOURCE_DATE_EPOCH} -gt 0 ]; then
|
||||
touch -m -t "$(date -d @"${SOURCE_DATE_EPOCH}" +%y%m%d%H%M.%S)" "$FONTDIR"
|
||||
fi
|
||||
echo "<fontconfig><dir>$FONTDIR</dir><cachedir prefix=\"xdg\">fontconfig</cachedir></fontconfig>" > my-fonts.conf
|
||||
FONTCONFIG_FILE="$MyPWD"/my-fonts.conf $FCCACHE "$FONTDIR" || :
|
||||
if [ -d "$HOME"/.cache ] && [ -d "$HOME"/.cache/fontconfig ]; then : ; else
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "No \$HOME/.cache/fontconfig directory"
|
||||
ls -a "$HOME"
|
||||
ls -a "$HOME"/.cache
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export HOME="$old_HOME"
|
||||
rm -rf "$temp_HOME" my-fonts.conf
|
||||
unset XDG_CACHE_HOME
|
||||
unset old_HOME
|
||||
unset temp_HOME
|
||||
|
||||
fi # if [ "x$EXEEXT" = "x" ]
|
||||
|
||||
rm -rf "$FONTDIR" "$CACHEFILE" "$CACHEDIR" "$BASEDIR" "$FONTCONFIG_FILE" out
|
||||
|
|
Loading…
Reference in New Issue