Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Oct 2006 11:26:19 +0100
From:      Ceri Davies <ceri@submonkey.net>
To:        Yar Tikhiy <yar@comp.chem.msu.su>
Cc:        Maxime Henrion <mux@FreeBSD.org>, cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org, Andrzej Tobola <ato@iem.pw.edu.pl>
Subject:   Re: cvs commit: src/etc/rc.d cleartmp
Message-ID:  <20061018102619.GE92966@submonkey.net>
In-Reply-To: <20061017214655.GC75464@comp.chem.msu.su>
References:  <200610161301.k9GD1j0C074012@repoman.freebsd.org> <20061017173133.GD70184@comp.chem.msu.su> <20061017210527.GD92966@submonkey.net> <20061017214655.GC75464@comp.chem.msu.su>

next in thread | previous in thread | raw e-mail | index | archive | help

--Y7xTucakfITjPcLV
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Oct 18, 2006 at 01:46:55AM +0400, Yar Tikhiy wrote:
> On Tue, Oct 17, 2006 at 10:05:28PM +0100, Ceri Davies wrote:
> > On Tue, Oct 17, 2006 at 09:31:33PM +0400, Yar Tikhiy wrote:
> > > On Mon, Oct 16, 2006 at 01:01:45PM +0000, Yar Tikhiy wrote:
> > > > yar         2006-10-16 13:01:45 UTC
> > > >=20
> > > >   FreeBSD src repository
> > > >=20
> > > >   Modified files:
> > > >     etc/rc.d             cleartmp=20
> > > >   Log:
> > > >   Improve cleartmp in a number of aspects:
> > > >  =20
> > > >   + Use rc.subr(8) features properly.
> > > >   + Do the whole job of obliterating /tmp contents in find(1).
> > > >   + Leave lost+found and quota.{user,group} in /tmp only if root-ow=
ned.
> > > >   + Make the overall structure clearer by first removing the X dirs
> > > >     (perhaps along with the rest of /tmp) and then re-creating them.
> > > >   + Use "find -exec rm -rf {} +" for efficiency: each rm instance g=
ets
> > > >     a chance to kill as much files in /tmp as ARG_MAX permits.
> > >=20
> > > I was asked a few times why "-prune -exec rm -rf" had been chosen
> > > over "-delete".  My initial reason was that -delete would keep
> > > bogus lost+found and quota.{user,group} entries found in subdirs
> > > of /tmp.  Well, on second thought, the find command line can be
> > > tweaked so that -delete works as wanted.  E.g.:
> > >=20
> > >                 cd /tmp && find -x . ! -name . \
> > >                     ! \( -path ./lost+found -type d -user root \) \
> > >                     ! \( \( -path ./quota.user -or -path ./quota.grou=
p \) \
> > >                         -type f -user root \) \
> > >                     -delete

<snip>

> > Given that we're deleting everything anyway, wouldn't it be possible to
> > remove quota.{group,user} regardless and let quotacheck recreate them if
> > required?  This shouldn't take too long since there won't be much there.
>=20
> I haven't used quotas for quite a while, but I used to believe that
> administrative limits were stored in those files, too, not only
> current usage values.  Therefore quotas on /tmp usage would be
> effectively cancelled after a reboot if we just removed the files.

Sorry, of course you're right.

> > Also, if X requires certain directories, wouldn't it be better to blow
> > them away here and have them created from a boot time script?  Otherwise
> > I don't understand how they ever get created.

<snip>

> Oh, perhaps it isn't clear that this script is controlled by two
> partially independent rc.conf vars, clear_tmp_enable and clear_tmp_X.
> Their defaults are NO and YES, respectively.  In this mode, cleartmp
> removes only the X dirs from /tmp and then creates them.  If the
> settings are YES and YES, it removes all from /tmp (except a few)
> and then creates the X dirs.  For YES and NO, it just purges all
> junk from /tmp and creates nothing.

Ah hah.

Ceri
--=20
That must be wonderful!  I don't understand it at all.
                                                  -- Moliere

--Y7xTucakfITjPcLV
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (FreeBSD)

iD8DBQFFNgFLocfcwTS3JF8RAup+AKCWvp7cfjPhWt1tuSF5DmUKOb3otwCgqOZH
1AwICVOzAZl2P3g1S8XIFtg=
=BOfq
-----END PGP SIGNATURE-----

--Y7xTucakfITjPcLV--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061018102619.GE92966>