This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Do not leave files behind in /tmp from testing
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Roland McGrath <roland at hack dot frob dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Thu, 15 Oct 2015 21:22:19 +0000
- Subject: Re: Do not leave files behind in /tmp from testing
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 10 dot 1510152049430 dot 6002 at digraph dot polyomino dot org dot uk> <20151015211437 dot 0A13E2C3C14 at topped-with-meat dot com>
On Thu, 15 Oct 2015, Roland McGrath wrote:
> > * io/tst-fcntl.c (do_prepare): Do not call add_temp_file here.
> > (do_test): Call add_temp_file here instead.
>
> This is a regression in the TEST_DIRECT case. Is there a reason you can't
> move the mkstemp call into do_prepare as is done in other test cases?
I don't see why this should be a regression - the only effect should be
that a file ending with XXXXXX (that doesn't exist) doesn't get added to
the list of temporary files, but a name that does exist gets added after
creation. There's no point calling add_temp_file on a file that doesn't
and won't exist. I don't know if the test has a reason for not calling
mkstemp until after fork.
As I read the code, temporary files will be deleted in both the parent and
the child, as the list is preserved across fork. If anything, that would
make it cleaner to do all the file creation after fork (in do_test not
do_prepare) so that files are only deleted once, rather than both parent
and child trying to delete the same file in the case of files created
before fork.
--
Joseph S. Myers
joseph@codesourcery.com