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

Re: Perhaps programs should create the subdirectories they use for their temporary files



On Sat, Apr 04, 2009 at 11:00:54AM +0200, Guus Sliepen wrote:
> I maintain a lot of systems that run on CompactFlash cards of a few GB, but
> also have 1 or 2 GB of RAM. I mount a tmpfs over /var/cache/apt/archives, so I
> can upgrade the system without using a large amount of space on flash, and to
> prevent wear. Apt always complains about /var/cache/apt/archives/partial not
> being there, so I either have to write an init script that creates it after the
> tmpfs is mounted, or (what I normally do is to) have a small script to perform
> updates, which creates the missing directories.
> 
> The problem is that some programs (apt-get, PolicyKit, etc.) store temporary
> files in /var/run or /var/cache in their own subdirectories, but expect
> something else to create these directories for them. I think we should require
> these programs to create their own subdirectories at runtime. It is very simple
> to add an mkdir() command to these programs. If the directory already exists,
> it is a no-op.

  /var/cache is intended for cached data from applications. Such data is
  locally generated as a result of time-consuming I/O or calculation. The
  application must be able to regenerate or restore the data. Unlike
  /var/spool, the cached files can be deleted without data loss. The data
  must remain valid between invocations of the application and rebooting the
  system.

  Files located under /var/cache may be expired in an application specific
  manner, by the system administrator, or both. The application must always
  be able to recover from manual deletion of these files (generally because
  of a disk space shortage). No other requirements are made on the data
  format of the cache directories.

apt only uses /var/cache, which the *system* is expected to preserve across
reboots.  If apt isn't able to recreate these directories at runtime, that's
an apt bug, yes; but if you don't preserve /var/cache across reboots, that's
arguably a bug in your configuration, since /var/cache is supposed to be
preserved just as /var/lib in the default case.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org


Reply to: