[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

/var/cache/ (was Re: Issues with Multi-Arch:same packages on purge)



On Mon, Apr 22, 2013 at 08:51:01PM +0200, Guillem Jover wrote:
> The following snippet seems suspect, although not a big issue anyway
> as it's just removing a cache file, although it might leave files
> behind on remove/purge:
> 
> ,---
>   if [ -d /usr/lib/gio/modules ]; then
>     # Purge the cache
>     if [ $(dpkg --print-architecture) = amd64 ]; then
>         rm -f /usr/lib/gio/modules/giomodule.cache
>         rmdir -p --ignore-fail-on-non-empty /usr/lib/gio/modules
>     fi
>   fi
> `---
[...]
> (Unrelated but, why are those cache files not under /var/cache/ instead?)

Because any program that uses /var/cache/ must be able to work properly even
if files in that dir get removed, usually by recreating the cache.  If your
program can't handle this at run (as opposed to install) time, the cache
must go somewhere else.  I'd still use /var/ rather than /usr/, though.

For example, apt keeps downloaded packages in /var/cache/apt/ and lists in
/var/lib/apt/, as it can transparently handle removal of the former but not
the latter.  It'd be a matter of a single "apt-get update", but you can't
do that as non-root.

-- 
ᛊᚨᚾᛁᛏᚣ᛫ᛁᛊ᛫ᚠᛟᚱ᛫ᚦᛖ᛫ᚹᛖᚨᚲ


Reply to: