Gentoo Archives: gentoo-user

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

Replies