Wednesday, January 02, 2013

Possible bug with Windows’ Save As dialog

This morning I ran across a minor bug with the Windows common “Save As” dialog.  I ran across the bug in the Chrome browser, and then was able to reproduce it using plain old Windows Notepad (notepad.exe).  Bugs like this in common Windows components are rare enough that I figured it was worth a quick blog post.

Steps to reproduce:

1. Open the Save As dialog for an application.  (In my example, I opened a file named “myfile.txt” in Notepad, then did File | Save As.)

2. Navigate to a directory that already contains a file with the same name as the file to be saved.


3. In the Save As dialog, create a new folder, e.g. by clicking the “New folder” button.

4. Still in the Save As dialog, drag the existing copy of the file to the new folder to move it there.


5. Click the Save button.

At this point, I would expect Windows to just go ahead and save the file.  However, at this point Windows puts up a “File already exists. Do you want to replace it?” confirmation message, as if the existing copy of the file had not already been moved out of the way.


This is only questionably a “bug,” since it doesn’t really hurt anything by happening, other than possibly causing some minor surprise/confusion on the part of the user, who may think they didn’t actually move the original copy of the file as they had intended. 

I assume this is happening because the dialog is doing some kind of caching of the contents of the destination folder at the time the folder is opened, and then not actually comparing against the actual contents on disk again at the time that the user clicks the Save button.

I encountered this on Windows 7 (Pro, 64-bit).  I’m not sure whether or not this also happens on other Windows versions.

Obviously this “bug” is not a big deal at all, but irrespective of the occasionally-questionable popular perception of the quality of Microsoft products, I find Windows 7 to be generally pretty rock-solid stable when it comes to basic day-to-day operations (as it should be), so I was surprised to observe this behavior.  I wonder if this is “working as intended,” or if Microsoft actually would consider this a bug?