This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

snapshot 20050114 race


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Something between the stock 1.5.12-1 and the 20050114 snapshot introduced
a data race on removing a directory shortly after being in it.  I couldn't
narrow it down to a repeatable testcase, but notice the difference between
these two runs of a subset of the coreutils-5.3.0 testsuite:

$ make check
make  check-TESTS
make[1]: Entering directory `/home/eblake/coreutils-5.3.0/tests/chgrp'
PASS: no-x
PASS: posix-H
rm: cannot remove directory `basic.1912': Device or resource busy
PASS: basic
rm: cannot remove directory `slink.3060': Device or resource busy
PASS: deref
PASS: recurse
==================
All 5 tests passed
==================
make[1]: Leaving directory `/home/eblake/coreutils-5.3.0/tests/chgrp'
$ make check
make  check-TESTS
make[1]: Entering directory `/home/eblake/coreutils-5.3.0/tests/chgrp'
PASS: no-x
PASS: posix-H
rm: cannot remove directory `basic.4052': Device or resource busy
PASS: basic
rm: cannot remove directory `slink.632': Device or resource busy
PASS: deref
rm: cannot remove directory `recurse.3160': Device or resource busy
PASS: recurse
==================
All 5 tests passed
==================
make[1]: Leaving directory `/home/eblake/coreutils-5.3.0/tests/chgrp'

As seen by the difference on the `recurse' test, the snapshot is
sometimes, but not always, failing to remove the temporary directory right
after cd'ing out of it.  The testsuite is calling /bin/sh scripts with the
idiom:
$ cat race.sh
#! /bin/sh
pwd=`pwd`
tmp=race.$$
trap 'cd $pwd; rm -rf $tmp' 0
mkdir $tmp
cd $tmp
mkdir d
touch f f2 d/f3
#do tests on chgrp $tmp
exit 0

Adding a delay between the cd and rm of the trap makes the rm work all the
time, and reverting to the 1.5.12 release no longer has the problem.  I
wonder if the new code in chown() is causing this race.

- --
Life is short - so eat dessert first!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFB6Ams84KuGfSFAYARAvhiAJ46YwRnehdxAFEeJZQnzuTs0TMdpgCgpsmY
rNcKQLZHqc0ZeiABq1QGsLg=
=glSG
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]