The Microsoft Guy

We’ve a couple of field reports from contributors this month, both involving “Microsoft Guys”, none of whom, it should go without saying, actually work for Mircosoft.

The first pair were bought in for a workshop on some web framework where Microsoft tries to do with .Net what it failed to do with Java. It didn’t go very well and, on the last day descended into a farce when the Microsoft Guy tried to set-up a Linux server and failed.

Only to be expected, really. In trying to “integrate Linux into a Windows environment” this consultant hacked around with the Linux server trying to make it Microsoft compliant until it wouldn’t boot anymore. Possibly as a form of protest, but more likely because the Microsoft Guy bungled the configuration trying to make it work.

That’s not to say that his presentation wasn’t effective, albeit not the effect he wanted to give. Everybody present has now seen for themselves what can happen if you try to make Linux behave like Microsoft – which it was never designed to be.

The second report is about a more junior Agile developer with a couple of projects under his belt and with the opposite problem to the above. He was having trouble making Windows do what it was designed to do: Write files to storage.

He had been hired as a contract developer on the project on the grounds that his wife works for Microsoft. There wasn’t actually a vacancy for him, but to have somebody on the team, even as a temp, who was married to a Microsoft employee was considered so desirable that they fired a developer for no other reason than to create a vacancy for him to fill.

He was put on bug-fixing, and one of the first bug-reports he got was an end-user who had tried to back-up application configuration files to a USB stick, using the built-in “back-up to USB” feature of the application software the developer was working on, only for it to fail with a “No space on device” operating-system error.

The user had verified that there was enough space on the stick, so raised a bug report.

Our Microsoft Guy, let’s call him Matey, rejected the report as it “couldn’t be reproduced”. Predictably it was re-opened again a week later by the same customer. One of the software testers then picked up the report and was able to recreate the problem, establish the root cause, and suggest the fix.

The problem was that there was only one sector free on the customer’s USB stick. One sector, which in this case was 4096 bytes, could only ever hold one file. There were three files to be saved, less than 1k in total size, but you may only write one file per sector.

Format C:\

This is by design. It is why we have to format storage before we can use it.

Microsoft Windows remains, at its heart, a Disk-Operating System (DOS) and the file-allocation method is perhaps one of the most fundamental features that Windows, and all other DOSs, are built-upon. File allocation works by splitting data files into sector-sized chunks, then writing them anywhere on the disk where there happens to be sectors free for them. As files are constantly added and deleted to disks it is often the case there isn’t enough contiguous free-space and files become fragmented.

This file fragmentation, with parts of the file scattered all over the disk, is a highly efficient method of storage. To read the files requires some kind of index to tell the operating system which sectors hold a particular file’s data such that the file can be stitched back together again when it is needed.

So this bug report was solved. There was enough space on the customer’s USB stick to save all of the data but only enough free sectors to store one file. A conflict that is inherent in file allocation tables and of little to no consequence on a hard-disk which would be unlikely to ever be in a condition of only having one sector free combined with a user who needs to save “just one more sector” of data. This is particularly true of Windows which writes thousands of megabytes to temporary files which are routinely stored on the same partition as OS and user data.

When USB sticks were introduced the same logical format was retro-fitted to them so that they would be compatible with existing file systems, as were CDRW and DVDRW prior to USB. The relatively small storage capacity of a USB stick, together with it’s cost-per-MB, and wear-levelling considerations, increases the likelihood that a customer, particularly a business customer that has purchased 12,000 identical USB sticks for its employees, will want to maximize it’s storage.

The tester offered this analysis along with a couple of solutions: Archive the files into a ZIP before writing to disk. This would ensure that all the data was in one file, small enough that it could be written to a single sector. Or for a quick fix, calculate the amount of space rounded up to the nearest sector boundry for each file with:

f/s + 1 if f % s > 0

Where f and s are natural numbers representing filesizes f and sector size s.

In the analysis above, with three files respectively of 512, 28, and 12 bytes to be saved, we would have calculated three sectors times a sector size of 4096, requires 12288 bytes free on the disk. Combining them into a single archive, assuming no compression, would have required one sector, or 4096 bytes free space.

Matey simply added the file-sizes together without taking into account how a disk is actually formatted, thus adding 512 + 28 + 12 he arrived at the erroneous figure of 552 bytes when in fact he required over 12k.

Since the ZIP libraries were already being used elsewhere in the code, both solutions were fairly simple and would require no more than a day or two in effort, including re-testing and documentation.

Ego Bruised, Can’t Be Bothered

Both of these proposed solutions turned out to be beyond both Matey’s ability and inclination to implement. Effort and understanding of the issue were not his thing, so instead he documented it as “a bug in the operating system”. After all, his own knowledge of the system he is supposed to be an expert in, because his wife is a sale’s woman for the company that makes it, has just been called into question. Indeed, what would it do to his credibility as “the Microsoft Guy” if he has just been lectured by a lowly Linux-leaning tester on a topic as basic as “how Windows stores files”.

So he puts it in writing to his employer that this is “a bug in the operating system” with “blame Microsoft” screaming out from between the lines. He then convinced the jack-off SPL who hired him to adopt the standard Microsoft-oriented solution: Refuse to fix it, lie about it, and tell the customer to go buy 12,000 bigger USB sticks.

After the tester sat with the developer and showed him the exact steps on how to recreate the bug on his own development env, Matey could still not accept that it was in his code and had to childishly pass it off as Microsoft’s fault. And his equally software sub-project leader, herself a temporary-hire, accepted it.

This is typcial of the arrogant Agile world of Microsoft. When your own lax attitude to the job comes up and bites you in the ass, you sink further into your own ignorance, make a fool of yourself in front of those who know the job better, and throw the customer’s money at a problem that only exists because you are too lazy to even understand it, let alone write the few lines of code required to fix it. And being Agile, the whole scrum will pull together as a team to back you up because, like you, they don’t know any better either and they are just as terrified of losing their precious jobs as you are.

It’s so much easier to waste the customer’s money, especially when you can wheel out the big names of Agile and Microsoft to woo your schmuck customers into buying your third-rate products.