Commit 437f0329 authored by Akira TAGOH's avatar Akira TAGOH

Fix empty XDG_CACHE_HOME Behavior

Use the default $HOME/.cache one for empty XDG_CACHE_HOME.

Fixes #243
parent 4a1cf888
Pipeline #176573 passed with stage
in 6 minutes and 35 seconds
......@@ -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
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