"Bo Borgerson" <[EMAIL PROTECTED]> wrote:
> Regarding rev. 94a2bd5b, `tests: improve perl-based tempdir handling',
> I wonder if it might be worthwhile to add a PID check in the cleanup
> handler for race avoidance.
>
> I think File::Temp does this internally as well, but it looks like
> chmod_tree will just warn about the failed chdir and procede to
> recursively chmod whatever directory it was in at the time if $dir is
> yanked out from under it.

Yes.  Good catch.  It should obviously skip the find in that case.
Want to write the patch?

> I've included a patch that sets up the signal handler as a closure
> around a copy of the PID at the time of installation and only cleans
> up in the original process.

Protecting against clean-up races in multi-threaded tests is
definitely worthwhile.  Thanks!  Luckily for my ego, I think
none of the tests in coreutils are susceptible.
I prefer the closure, too.  Applied.

> From dd8e78633f60a4a266b870326ac87d9844dab02b Mon Sep 17 00:00:00 2001
> From: Bo Borgerson <[EMAIL PROTECTED]>
> Date: Mon, 28 Apr 2008 10:30:22 -0400
> Subject: [PATCH] Only cleanup test dirs from the process that created them.
>
> * tests/CuTmpdir.pm (import): Use closure around current PID to avoid cleanup 
> races.


_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to