Gentoo Archives: gentoo-user

From: walt <w41ter@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: unix philosophy question for old farts: the original purpose for /tmp ?
Date: Tue, 16 Dec 2014 18:06:19
Message-Id: m6ps9m$ir$1@ger.gmane.org
In Reply to: Re: [gentoo-user] unix philosophy question for old farts: the original purpose for /tmp ? by Alan McKinnon
1 On 12/15/2014 11:17 PM, Alan McKinnon wrote:
2 > On 16/12/2014 02:17, walt wrote:
3 >> I confess I've never thought much about why /tmp exists, but today I was
4 >> inconvenienced when an end-user utility (uudeview) ran out of space on /tmp
5 >> while doing an ordinary end-user task processing very large end-user files.
6 >>
7 >> Why is an end-user program using a "system" directory like /tmp in the first
8 >> place?
9 >>
10 >> I suspect that the need for /tmp is now gone, but I'm prepared to be wrong :)
11 >>
12 >>
13 >>
14 >
15 >
16 > /tmp was always intended to be used exactly the way you are using it:
17 >
18 > yes, it is a "system directory" because it's located in / but you have
19 > permissions to use it. The mode is 1777 so everyone can
20 > read/write/execute the contents but it's also sticky (the 1) so only you
21 > can delete what you put there. It's a general-use scratch pad area that
22 > everyone can use safely, unfortunately in these days of huge cheap disks
23 > some apps abuse it by writing gigantic files there and you run out of space.
24 >
25 > How have you set /tmp up? Is it on-disk or a tmpfs? You might need to
26 > make it bigger.
27
28 systemd puts /tmp on a tmpfs by default, and this ancient machine has a mere
29 4GB of ram :) I didn't know about the TMPDIR environment (thanks, redwolfe)
30 so I worked around the problem by rebooting with openrc, which uses my original
31 /tmp on the hard drive. (Exactly the excuse I need to buy more RAM :)
32
33
34 > /tmp is still very much in use and very much needed, it isn't going
35 > anywhere soon. The FHS has something interesting to say about /tmp,
36 > along the lines of:
37 >
38 > "A general use scratch pad area where files written are not expected to
39 > survive successive invocations of the program that wrote them". That's
40 > interesting as it means the sysadmin can delete everything in /tmp at
41 > any time for any reason,
42
43 bofh can delete them for no reason at all while you're still using them :)
44
45 > and all apps will continue to work just fine as
46 > if they had not been deleted at all :-)

Replies