Subject: bin/30702: Respect $TMPDIR in /etc/daily
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: Daniel =?iso-8859-1?Q?N=E9ri?= <daniel.neri@sigicom.se>
List: netbsd-bugs
Date: 07/09/2005 00:50:00
>Number: 30702
>Category: bin
>Synopsis: Respect $TMPDIR in /etc/daily & /etc/security
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Jul 09 00:50:00 +0000 2005
>Originator: Daniel Neri
>Release: NetBSD 2.0_STABLE
>Organization:
Sigicom AB, Stockholm, Sweden
>Environment:
System: NetBSD ebbot.hq.sigicom.net 2.0_STABLE NetBSD 2.0_STABLE (EBBOT) #8: Tue Jul 5 10:43:30 CEST 2005 dne@ebbot.hq.sigicom.net:/usr/src/sys/arch/i386/compile/EBBOT i386
Architecture: i386
Machine: i386
>Description:
/etc/daily and /etc/security have hardcoded /tmp prefix for temporary
dir creation. If /tmp is small, it would be nice to be able to have
temporary data written to e.g. /var/tmp instead, to avoid nightly
"device out of space" errors.
With the patch below, the temp dir prefix for these scripts can be
controlled by setting $TMPDIR in /etc/daily.conf.
>How-To-Repeat:
Set up a small /tmp partition (e.g. 30M). Watch it fill up during
nightly /etc/daily run.
>Fix:
Index: etc/daily
===================================================================
RCS file: /cvsroot/src/etc/daily,v
retrieving revision 1.58.2.1
diff -p -U5 -r1.58.2.1 daily
--- etc/daily 30 May 2004 07:22:09 -0000 1.58.2.1
+++ etc/daily 9 Jul 2005 00:02:48 -0000
@@ -63,11 +63,11 @@ echo "Uptime: " `uptime`
#if [ -d /var/rwho -a ! -h /var/rwho ] ; then
# cd /var/rwho && {
# find . ! -name . -mtime +7 -exec rm -f -- {} \; ; }
#fi
-DAILYDIR=`mktemp -d /tmp/_daily.XXXXXX` || exit 1
+DAILYDIR=`mktemp -d -t _daily` || exit 1
trap "/bin/rm -rf $DAILYDIR ; exit 0" EXIT INT QUIT
if ! cd "$DAILYDIR"; then
echo "Can not cd to $DAILYDIR".
Index: etc/security
===================================================================
RCS file: /cvsroot/src/etc/security,v
retrieving revision 1.88
diff -p -U5 -r1.88 security
--- etc/security 9 Feb 2004 09:04:13 -0000 1.88
+++ etc/security 9 Jul 2005 00:02:48 -0000
@@ -36,11 +36,11 @@ work_dir=$backup_dir/work
if [ ! -d "$work_dir" ]; then
mkdir -p "$work_dir"
fi
-SECUREDIR=`mktemp -d /tmp/_securedir.XXXXXX` || exit 1
+SECUREDIR=`mktemp -d -t _securedir` || exit 1
trap "/bin/rm -rf $SECUREDIR ; exit 0" EXIT INT QUIT PIPE
if ! cd "$SECUREDIR"; then
echo "Can not cd to $SECUREDIR".
Index: etc/weekly
===================================================================
RCS file: /cvsroot/src/etc/weekly,v
retrieving revision 1.17
diff -p -U5 -r1.17 weekly
--- etc/weekly 18 Jun 2001 10:54:02 -0000 1.17
+++ etc/weekly 9 Jul 2005 00:02:48 -0000
@@ -36,11 +36,11 @@ fi
# -n "`find -f /usr/src ! -fstype local -prune -or -type d -print -prune`" ];
#then
# echo ""
# echo "Looking for checked out files:"
#
-# TDIR=`mktemp -d /tmp/_checkout.XXXXXX` || exit 1
+# TDIR=`mktemp -d -t _checkout` || exit 1
# trap "/bin/rm -rf $TDIR ; exit 0" EXIT INT QUIT
# for file in `find -f /usr/src ! -fstype local -prune -or \
# -name 'p.*' -print | egrep 'SCCS/p\.'`; do
# owner=`awk '{ print $3 }' $file`
# echo "$owner $file"
<how to correct or work around the problem, if known (multiple lines)>