All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	patches@linaro.org
Subject: Re: [Qemu-trivial] [PATCH] configure: Put tempfiles in a subdir of the build directory
Date: Mon, 19 May 2014 11:46:16 -0600	[thread overview]
Message-ID: <537A4368.4020203@redhat.com> (raw)
In-Reply-To: <1400519982-9264-1-git-send-email-peter.maydell@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

On 05/19/2014 11:19 AM, Peter Maydell wrote:
> 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
> as a subdirectory of the build directory, so we can easily clean it up,
> and don't need fragile or complicated code for creation to avoid it
> clashing with temporary directories from other instances of QEMU
> configure or being subject to attack from adversaries who can write
> to /tmp.
> 
> Since the temporaries now live in the build tree, we have no
> need to jump through hoops with a trap handler to try to remove
> them when configure exits; this fixes some weird bugs where hitting
> ^C during a configure run wouldn't actually make it stop, because
> we would run the trap handler but then not stop. (It is possible
> to get the trap handler semantics right but it is convoluted largely
> because of bugs in dash, so it is simpler to just avoid it.)
> 
> Note that "temporary files go in the build directory, not /tmp" is
> the way autoconf behaves.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

Reviewed-by: Eric Blake <eblake@redhat.com>

>  
> -# 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

While we don't need a trap that jumps through hoops, it may still be
nice to have a 'rm -r ${TMPDIR1}' at the end of configure.  Just because
we cleanup a leftover config-temp on start from an earlier aborted run
doesn't mean that a clean run shouldn't clean up after itself.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] configure: Put tempfiles in a subdir of the build directory
Date: Mon, 19 May 2014 11:46:16 -0600	[thread overview]
Message-ID: <537A4368.4020203@redhat.com> (raw)
In-Reply-To: <1400519982-9264-1-git-send-email-peter.maydell@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

On 05/19/2014 11:19 AM, Peter Maydell wrote:
> 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
> as a subdirectory of the build directory, so we can easily clean it up,
> and don't need fragile or complicated code for creation to avoid it
> clashing with temporary directories from other instances of QEMU
> configure or being subject to attack from adversaries who can write
> to /tmp.
> 
> Since the temporaries now live in the build tree, we have no
> need to jump through hoops with a trap handler to try to remove
> them when configure exits; this fixes some weird bugs where hitting
> ^C during a configure run wouldn't actually make it stop, because
> we would run the trap handler but then not stop. (It is possible
> to get the trap handler semantics right but it is convoluted largely
> because of bugs in dash, so it is simpler to just avoid it.)
> 
> Note that "temporary files go in the build directory, not /tmp" is
> the way autoconf behaves.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---

Reviewed-by: Eric Blake <eblake@redhat.com>

>  
> -# 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

While we don't need a trap that jumps through hoops, it may still be
nice to have a 'rm -r ${TMPDIR1}' at the end of configure.  Just because
we cleanup a leftover config-temp on start from an earlier aborted run
doesn't mean that a clean run shouldn't clean up after itself.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-05-19 17:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-19 17:19 [Qemu-trivial] [PATCH] configure: Put tempfiles in a subdir of the build directory Peter Maydell
2014-05-19 17:19 ` [Qemu-devel] " Peter Maydell
2014-05-19 17:46 ` Eric Blake [this message]
2014-05-19 17:46   ` Eric Blake
2014-05-19 17:50   ` [Qemu-trivial] " Peter Maydell
2014-05-19 17:50     ` [Qemu-devel] " Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=537A4368.4020203@redhat.com \
    --to=eblake@redhat.com \
    --cc=patches@linaro.org \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.