May 25, 2006

It Works on My Machine - An Interesting Bug

An interesting bug today...

I was testing the Admin tool of a product.

For this particular release, when the Administrator logs in to the Admin tool for the first time, he is warned that the database is out of date and will automatically be upgraded.  When he clicks "Yes", the upgrade is supposed to start.

When I tried it, I got the expected warning and clicked "Yes".  But the upgrade didn't happen.  Instead, I got an error message indicating that the database could not be upgraded, and to check that the user had permission to upgrade the database. 
Very odd!

I made sure everything was set up correctly.
I uninstalled, installed the prior version, installed the current version, and tried again.
Still, it didn't work.

After a few more attempts, I collected the error message and log files, and wrote an Issue Report.

The Issue Report came back as "Not Reproducible".

I brought the developer over and showed him the bug.  It was clearly easily reproducible.

I attached a pre-upgrade version of the database I was using to the Issue Report and sent it back to the developer.
Again he tried, and again the upgrade worked fine on his machine.

I tried a few more things on my machine - still it failed each time.
I asked the developer to try a clean install, rather than the debug version he normally used - still it worked each time for him.

The developer and I tried it together on my machine, and we stumbled on the answer.

Normally the User field of the Admin tool login is case-insensitive.
It doesn't matter if I login as "administrator" or "Administrator".

In this case, I could still correctly login either way.
But, if I logged in as "administrator" (which I usually do) - the upgrade failed.
If I logged in as "Administrator" (which the developer usually does) - the upgrade worked.

It turns out that the User field was being validated during login and again just before the upgrade.  For login, the field was validated in a case-insensitive manner.  For upgrade the field was validated in a case-sensitive manner.

While it was a bit frustrating to have to circle around so many times before we determined the cause, I'm very glad that this one didn't get out to the customers!