This reminds me of a bug I ran into in some beta software on Windows many years ago:
1. Create the directory "C:\APPNAME-tmp"
2. Change the current directory to "C:\APPNAME-tmp"
3. Recursively delete everything under the current directory.
This worked fine for thousands of users until I came along -- running Windows 2000, with the "C:\" directory read-only for unprivileged users, running as an unprivileged user. At that point it became:
1. Try, and fail, to create the directory "C:\APPNAME-tmp"
2. Try, and fail, to change the current directory to "C:\APPNAME-tmp"
3. Recursively delete everything under the current directory, which is my home directory.
The authors were very apologetic when I pointed out the bug.