[Patches] [ python-Patches-404564 ] tempfile.py: Change order of tmp dirs

nobody nobody@sourceforge.net
Tue, 27 Feb 2001 09:16:52 -0800


Artifact #404564, was updated on 2001-02-27 05:11
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=404564&group_id=5470

Category: library
Group: None
Status: Open
Priority: 5
Submitted By: Gregor Hoffleit
Assigned to: Nobody/Anonymous
Summary: tempfile.py: Change order of tmp dirs

Initial Comment:
[cf. Debian bug#87538, http://bugs.debian.org/87538]

Please change the order of the dirs in the attemptdirs
list in Lib/tempfile.py. It seems more reasonable
according to the FHS (File System Hierarchy Standard),
if '/tmp' would precede '/var/tmp':

    attempdirs = ['/tmp', '/var/tmp', '/usr/tmp', pwd]

'/var/tmp' was added recently to the list (Aug 2000,
'Patch by tg@FreeBSD.org to try /var/tmp first. This
helps on 4.4BSD-based systems.'). I guess it would make
no difference if '/var/tmp' would only tried after
'/tmp'. 


In the words of James Troup <james@nocrew.org>:

"Well...

  o /var/tmp/ (at least on Debian) is not cleaned on
start-up like
    /tmp is

  o /var/tmp/ is often/sometimes on a different drive
and could
    potentially have a lot less free space than /tmp

  o it's not documented

  o it's unexpected

I think a better question might be: what's the
advantage of the
change?  *shrug*"


----------------------------------------------------------------------

Comment By: Skip Montanaro
Date: 2001-02-27 09:16

Message:
Logged In: YES 
user_id=44345

Then the standard is wrong. ;-)

I will rephrase: Any system that relies on boot-time cleanup
to keep a disk partition from filling up is broken.  /tmp is
generally on the root partition, the partition that is most
dangerous to allow to fill.


----------------------------------------------------------------------

Comment By: Gregor Hoffleit
Date: 2001-02-27 08:03

Message:
Logged In: YES 
user_id=5293

Regarding your statement:
  "If you want it cleaned up on reboot, simply modify your
startup scripts 
  or (better yet) add a daily or weekly cron job to zap old
files in /var/tmp."

The Linux Standard Base (more specifically: the File System
Hierarchy) says this about /var/tmp:

       5.12  /var/tmp : Temporary files preserved between
system reboots

       The /var/tmp directory is made available for programs
that require
       temporary files or directories that are preserved
between system
       reboots.  Therefore, data stored in /var/tmp is more
persistent than
       data in /tmp.

       Files and directories located in /var/tmp must not be
deleted when the
       system is booted.  Although data stored in /var/tmp
is typically deleted
       in a site-specific manner, it is recommended that
deletions occur at a
       less frequent interval than /tmp.


Therefore, if you setup your system to remove files in
/var/tmp on reboot, your system will not be compliant with
the Linux standard.

Moreover, the description for /tmp seems more appropriate
for tempfile IMHO:

       3.11  /tmp : Temporary files

       The /tmp directory shall be made available for
programs that require
       temporary files.

       Although data stored in /tmp may be deleted in a
site-specific manner,
       it is recommended that files and directories located
in /tmp be deleted
       whenever the system is booted.

       Programs shall not assume that any files or
directories in /tmp are
       preserved between invocations of the program.


----------------------------------------------------------------------

Comment By: Skip Montanaro
Date: 2001-02-27 07:46

Message:
Logged In: YES 
user_id=44345

Regarding this statement:

  /var/tmp/ is often/sometimes on a different drive and
  could potentially have a lot less free space than /tmp

It is a red herring.  /var is often given it's own separate
partition precisely because the / partition is often very
small.  I think /var/tmp should appear before /tmp.  If
you want it cleaned up on reboot, simply modify your
startup scripts or (better yet) add a daily or weekly cron
job to zap old files in /var/tmp.  After all, who cares
about cleanup at reboot on systems that can remain up for
more than a year?  What do you think this is - Windows? ;-)


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=404564&group_id=5470