From 854a6261862738daf6ff0158a839fa9aa4a75bff Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 17 Nov 2014 18:19:08 +0000 Subject: [PATCH] Make /var/tmp a symbolic link to /tmp. The creation of /var/tmp in the often space-constrained /var filesystem was a historical mistake. There are big implications for the daemons which assume they won't run out of space, and this is a first step towards trying to improve the situation. Move /tmp to the same 7-day expiration rules that /var/tmp had. vi.recover works just as well as before, except on memory filesystems; indicating that vi should be repaired to write files into homedirs or something. done with rpe ok many --- src/etc/Makefile | 3 ++- src/etc/daily | 15 ++------------- src/etc/mtree/4.4BSD.dist | 8 +------- src/etc/rc | 8 ++++---- 4 files changed, 9 insertions(+), 25 deletions(-) diff --git a/src/etc/Makefile b/src/etc/Makefile index d2c00030..11e58c09 100644 --- a/src/etc/Makefile +++ b/src/etc/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.398 2014/10/03 19:22:38 deraadt Exp $ +# $OpenBSD: Makefile,v 1.399 2014/11/17 18:19:08 deraadt Exp $ TZDIR= /usr/share/zoneinfo LOCALTIME= Canada/Mountain @@ -210,6 +210,7 @@ distribution-etc-root-var: distrib-dirs ${DESTDIR}/etc/rc.d && \ ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 555 ${RCDAEMONS} \ ${DESTDIR}/etc/rc.d + cd ${DESTDIR}/var; ln -fs ../tmp touch ${DESTDIR}/usr/share/sysmerge/etcsum touch ${DESTDIR}/usr/share/sysmerge/examplessum cd ${DESTDIR}/ && \ diff --git a/src/etc/daily b/src/etc/daily index b22ad6bc..3d913bb5 100644 --- a/src/etc/daily +++ b/src/etc/daily @@ -1,5 +1,5 @@ # -# $OpenBSD: daily,v 1.81 2014/07/02 13:39:41 sthen Exp $ +# $OpenBSD: daily,v 1.82 2014/11/17 18:19:08 deraadt Exp $ # From: @(#)daily 8.2 (Berkeley) 1/25/94 # # For local additions, create the file /etc/daily.local. @@ -50,18 +50,7 @@ if [ -d /tmp -a ! -L /tmp ]; then find -x . \ \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ -o -path ./portslocks -o -path './tmux-*' \) \ - -prune -o -type f -atime +3 -execdir rm -f -- {} \; 2>/dev/null - find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ - ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ - -execdir rmdir -- {} \; >/dev/null 2>&1; } -fi - -if [ -d /var/tmp -a ! -L /var/tmp ]; then - cd /var/tmp && { - find -x . \ - \( -path './ssh-*' -o -path ./.X11-unix -o -path ./.ICE-unix \ - -o -path ./portslocks -o -path './tmux-*' \) \ - -prune -o ! -type d -atime +7 -execdir rm -f -- {} \; 2>/dev/null + -prune -o -type f -atime +7 -execdir rm -f -- {} \; 2>/dev/null find -x . -type d -mtime +1 ! -path ./vi.recover ! -path ./.X11-unix \ ! -path ./.ICE-unix ! -path ./portslocks ! -name . \ -execdir rmdir -- {} \; >/dev/null 2>&1; } diff --git a/src/etc/mtree/4.4BSD.dist b/src/etc/mtree/4.4BSD.dist index 03b58656..f529df7e 100644 --- a/src/etc/mtree/4.4BSD.dist +++ b/src/etc/mtree/4.4BSD.dist @@ -1,4 +1,4 @@ -# $OpenBSD: 4.4BSD.dist,v 1.267 2014/10/09 04:24:30 tedu Exp $ +# $OpenBSD: 4.4BSD.dist,v 1.268 2014/11/17 18:19:08 deraadt Exp $ /set type=dir uname=root gname=wheel mode=0755 @@ -779,12 +779,6 @@ var .. .. - # ./var/tmp - tmp mode=01777 - vi.recover mode=01777 - .. - .. - # ./var/unbound unbound etc uname=root gname=wheel mode=0755 diff --git a/src/etc/rc b/src/etc/rc index aa6aa039..6344f268 100644 --- a/src/etc/rc +++ b/src/etc/rc @@ -1,4 +1,4 @@ -# $OpenBSD: rc,v 1.443 2014/11/05 17:07:59 millert Exp $ +# $OpenBSD: rc,v 1.444 2014/11/17 18:19:08 deraadt Exp $ # System startup script run by init on autoboot # or after single-user. @@ -438,12 +438,12 @@ fi echo clearing /tmp -# prune quickly with one rm, then use find to clean up /tmp/[lq]* +# prune quickly with one rm, then use find to clean up /tmp/[lqv]* # (not needed with mfs /tmp, but doesn't hurt there...) -(cd /tmp && rm -rf [a-km-pr-zA-Z]*) +(cd /tmp && rm -rf [a-km-pr-uw-zA-Z]*) (cd /tmp && find . -maxdepth 1 ! -name . ! -name lost+found ! -name quota.user \ - ! -name quota.group -execdir rm -rf -- {} \;) + ! -name quota.group ! -name vi.recover -execdir rm -rf -- {} \;) setup_X_sockets