Do not leave files behind in /tmp from testing
Joseph Myers
joseph@codesourcery.com
Thu Oct 15 21:22:00 GMT 2015
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
More information about the Libc-alpha
mailing list