From patchwork Tue May 6 13:17:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 29708 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f197.google.com (mail-pd0-f197.google.com [209.85.192.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7BF0520534 for ; Tue, 6 May 2014 13:17:08 +0000 (UTC) Received: by mail-pd0-f197.google.com with SMTP id g10sf29743047pdj.8 for ; Tue, 06 May 2014 06:17:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=fLn5scqWPnz/y7cqqPyLDN3+6dpzrD6oI0/tgI8trik=; b=cwe3j/yOs3u42MmMDMwYJy0Y88oFtIg//N4b4+kUe1KGP0sCnXgULbzU1VWV/QqMhC fo+7jXuJPKw1jdje2S6xlUxZ9EJYL10B9KnNF8GquY3NWI723go5WMkd/VU/BIGltpeE iB5aZCnqcVlr2FfgrI9jecvItTMife9t3jz6E8NCVzDDhn9hrOUiTcEySfBvqGZAMvkR rHZsqFYERYllD4uOHrt7AdAXv38jRyX2ZkvTWxgN0+SrBHNQWJJQQhIYZ5lhxYG7uYRZ KaEoKSRjChMGuIXsuWvUks3yE1X4FpaFaV+JwEQbWq5s5lYHnl5ReTAINeKqcIolWJ58 MPBw== X-Gm-Message-State: ALoCoQlxOK3zRuCfdx2cykDfO1cNwp80ZEEji8SXYnCIGaHAmG+2M4Ml30LihdhpJj2H12U4OzSr X-Received: by 10.66.139.9 with SMTP id qu9mr1012549pab.41.1399382227150; Tue, 06 May 2014 06:17:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.132 with SMTP id u4ls2868163qga.36.gmail; Tue, 06 May 2014 06:17:07 -0700 (PDT) X-Received: by 10.52.130.225 with SMTP id oh1mr27603273vdb.8.1399382226991; Tue, 06 May 2014 06:17:06 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id ge9si1101743veb.206.2014.05.06.06.17.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 06 May 2014 06:17:06 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id il7so672057vcb.4 for ; Tue, 06 May 2014 06:17:06 -0700 (PDT) X-Received: by 10.58.116.175 with SMTP id jx15mr26666213veb.9.1399382226856; Tue, 06 May 2014 06:17:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp222692vcb; Tue, 6 May 2014 06:17:06 -0700 (PDT) X-Received: by 10.194.242.4 with SMTP id wm4mr585660wjc.88.1399382225999; Tue, 06 May 2014 06:17:05 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id dj6si5645357wjc.242.2014.05.06.06.17.05 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 May 2014 06:17:05 -0700 (PDT) Received-SPF: none (google.com: pm215@archaic.org.uk does not designate permitted sender hosts) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WhfEy-0003sN-80; Tue, 06 May 2014 14:17:00 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, qemu-trivial@nongnu.org, Don Slutz , Paolo Bonzini Subject: [PATCH] configure: Put tempfiles in subdir so we can clean up libtool files Date: Tue, 6 May 2014 14:17:00 +0100 Message-Id: <1399382220-14874-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , When libtool support was added to configure, the new temporary files were left out of the list of files cleaned up on exit; this results in a lot of stale .lo files being left around in /tmp. Worse, libtool creates a /tmp/.libs directory which we can't easily clean up. Put all our temporary files in a single temporary directory created via mktemp -d, so we can easily clean it up. This has the bonus result that we no longer use $RANDOM (which silently expands to the empty string if your shell is not bash, and so is pretty useless). Note that because we now use mktemp's tempdir-finding logic rather than handrolling it, we no longer honour TEMPDIR (only TMPDIR). Signed-off-by: Peter Maydell --- I don't know why we were looking at TEMPDIR; that code was in there from the initial commit by Fabrice back in 2003... configure | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 870c939..84c600f 100755 --- a/configure +++ b/configure @@ -2,26 +2,25 @@ # # qemu configure script (c) 2003 Fabrice Bellard # -# set temporary file name -if test ! -z "$TMPDIR" ; then - TMPDIR1="${TMPDIR}" -elif test ! -z "$TEMPDIR" ; then - TMPDIR1="${TEMPDIR}" -else - TMPDIR1="/tmp" + +TMPDIR1=$(mktemp -t -d) +if [ $? -ne 0 ]; then + echo "ERROR: failed to create temporary directory" + exit 1 fi -TMPC="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.c" -TMPB="qemu-conf-${RANDOM}-$$-${RANDOM}" +TMPB="qemu-conf" +TMPC="${TMPDIR1}/${TMPB}.c" TMPO="${TMPDIR1}/${TMPB}.o" TMPCXX="${TMPDIR1}/${TMPB}.cxx" TMPL="${TMPDIR1}/${TMPB}.lo" TMPA="${TMPDIR1}/lib${TMPB}.la" -TMPE="${TMPDIR1}/qemu-conf-${RANDOM}-$$-${RANDOM}.exe" +TMPE="${TMPDIR1}/${TMPB}.exe" # NB: do not call "exit" in the trap handler; this is buggy with some shells; # see <1285349658-3122-1-git-send-email-loic.minier@linaro.org> -trap "rm -f $TMPC $TMPO $TMPCXX $TMPE" EXIT INT QUIT TERM +trap "rm -rf ${TMPDIR1}" EXIT INT QUIT TERM + rm -f config.log # Print a helpful header at the top of config.log