Patch for other/2141

Joseph S. Myers jsm28@cam.ac.uk
Thu Mar 22 15:18:00 GMT 2001


This patch should fix other/2141 (some non-POSIX /bin/sh shells exit
on set -C).  It seems to work on i686-pc-linux-gnu when forced to use
the temporary directory code, at least as far as correctly not
removing the directory when an aborted PR is being saved there.

OK to commit to mainline and 3.0 branch?

2001-03-22  Joseph S. Myers  <jsm28@cam.ac.uk>

	* gccbug.in: Use a temporary directory when the mktemp command is
	not available.

--- gccbug.in.orig	Wed Jan  3 20:30:44 2001
+++ gccbug.in	Thu Mar 22 22:57:43 2001
@@ -82,25 +82,16 @@
 	TEMP=`mktemp $TMPDIR/pXXXXXX` || exit 1
 	BAD=`mktemp $TMPDIR/pbadXXXXXX` || exit 1
 	REF=`mktemp $TMPDIR/pfXXXXXX` || exit 1
+	REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF"
 else
-	TEMP0=$TMPDIR/po$$
-	TEMP=$TMPDIR/p$$
-	BAD=$TMPDIR/pbad$$
-	REF=$TMPDIR/pf$$
-	# set -C _may_ use O_EXCL, but it need not.
-	set -C
-	bad_temp=0
-	: > $TEMP0 || bad_temp=1
-	: > $TEMP || bad_temp=1
-	: > $BAD || bad_temp=1
-	: > $REF || bad_temp=1
-	if [ $bad_temp = 1 ]; then
-		rm -f $TEMP0 $TEMP $BAD $REF
-		exit 1;
-	fi
-	set +C
+	TEMPD=$TMPDIR/pd$$
+	TEMP0=$TEMPD/po$$
+	TEMP=$TEMPD/p$$
+	BAD=$TEMPD/pbad$$
+	REF=$TEMPD/pf$$
+	mkdir $TEMPD || exit 1
+	REMOVE_TEMP="rm -rf $TEMPD"
 fi
-REMOVE_TEMP="rm -f $TEMP0 $TEMP $BAD $REF"
 
 # find a user name
 if [ "$LOGNAME" = "" ]; then

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list