Subject: TMPDIR for bulk builds
To: None <pkgsrc-bulk@NetBSD.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: pkgsrc-bulk
Date: 03/16/2007 19:09:17
I had this patch for over a year and I used it several times but not 
recently:

Index: mk/bulk/pre-build
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bulk/pre-build,v
retrieving revision 1.66
diff -u -r1.66 pre-build
--- mk/bulk/pre-build	28 Jan 2007 19:23:22 -0000	1.66
+++ mk/bulk/pre-build	17 Mar 2007 00:06:36 -0000
@@ -80,8 +80,10 @@
 fi
 
 # On non-NetBSD platforms we need to keep the bootstrap-files!
+# XXX: this tmp file creation is unsafe
+TMPDIR="${TMPDIR:-/tmp}"
 if [ x"$BMAKE" = x"bmake" ]; then
-	( cd "$LOCALBASE" && tar cf /tmp/$$.tar \
+	( cd $LOCALBASE && tar cf ${TMPDIR}/bootstrap$$.tar                  \
 		sbin/mtree sbin/pkg_add sbin/pkg_admin sbin/pkg_create       \
 		sbin/pkg_delete sbin/pkg_info sbin/pkg_view sbin/linkfarm    \
 		share/mk/sys.mk share/mk/bsd.dep.mk share/mk/bsd.depall.mk   \
@@ -150,7 +152,7 @@
 
 cd "$LOCALBASE" && rm -fr * && rm -fr .??*;
 if [ x"$BMAKE" = x"bmake" ]; then
-	( cd "$LOCALBASE" && tar xf /tmp/$$.tar )
+	( cd $LOCALBASE && tar xf ${TMPDIR}/bootstrap$$.tar )
 fi
 
 # Stuff known to be broken