Today I've been working with a piece of third-party software. I was having big problems getting it working and decided to delve into its source (which was included). I'm not going to name the application (and I've obscured the details below), but the bug is so epic that it manages to combine on a single line four separate types of bugs: a design bug, two implementation bugs, a security hole and an out of date comment. The program needs to copy a file into a directory. In the process of doing so it sets write permission on the directory into which the file will be copied. The first bug is the design: the program shouldn't be updating permissions on a directory without the user having requested the change. If the directory isn't writable an exception should be generated and an appropriate error displayed. This particular JavaScript program avoided all that by just setting write permission. It did it like this: dir.permissions = 666; // Make the file wri