Larry Hastings <la...@hastings.org> added the comment: % rm -rf @test rm: cannot remove `...@test': Permission denied
And, before you helpfully chime in with "chmod", yes I know how to run that too. I stuck in and figured it out. The bug: "test_on_error" in "test_shutil" is out of sync with how "shutil.rmtree" runs. "test_on_error" deliberately constructs a directory that is not executable to the current user, then calls "shutil.rmtree" to delete it, passing in an "onerror" callback of "check_args_to_onerror" so it can observe how it fails. "check_args_to_onerror". expects to be called twice; the first time it expects the failing function to be "os.remove". In fact, the first failure is "os.listdir". This fails, throws an exception, and the test is over. Which means the cleanup code in "test_on_error" (the subsequent "chmod" and "rmtree" calls) don't get executed, the "@test" with mode 400 is left behind, and now we have cascading errors. Attached is a patch that fixes "check_args_to_onerror" on my machine. For good measure, it also changes "cleanup_test_droppings" in "regrtest" cleanup code so it chmods a directory to 0o700 before attempting to remove it. The patch was written against py3k/trunk r71304. I find it hard to believe that I'm the only person running "make test" in py3k/trunk not on Windows and not as root. So I theorize os.listdir behaves differently on different OSes. I'm on Ubuntu 9.04, and os.listdir fails if called on a directory that is not executable. Perhaps, on the omnipresent Macs, this is permissible? If so, the tests in "check_args_on_error" when errorState is 0 should be rewritten, either to accept any of the possible arguments or to branch on sys.platform and accept specific arguments. ---------- Added file: http://bugs.python.org/file13639/lch.test_shutil.r71304.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5676> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com