kdmurray.blog

The crossroads of life and tech

Subversion – Can’t move [file]. The file or directory has become corrupted and is unreadable

Update 2011-02-11: Since the post was originally published Microsoft has issued a hotfix for this issue, which is slated to be included in Windows 7 SP1.

I recently ran into a problem on my fancy new machine while trying to commit a rather large number of files into an SVN repository. The error message stated that some of the files in the .svn control directory had become corrupted and unreadable.

After Googling around a bit I came across a post on the CollabNet issue log which identified this as an issue with the NTFS stack on Windows 7. This post included another link to a Microsoft technet discussion about the issue.

The long and the short of it is that this is an identified issue in the NTFS implementation in all editions of Windows 7 (both 32 and 64 bit versions). The indexing service is locking files which SVN is trying to move. This only appears to be a problem with large batch transactions. Smaller ones, for me at least, have been working just fine but YMMV.

In case you don’t want to read the whole discussion thread, here’s the response from the NTFS team developer who responded to the community reports:

This is a known regression in Windows 7 in the NTFS file system.  It occurs when doing a superceding rename over a file that has an atomic oplock on it (atomic oplocks are a new feature in Windows 7).  The indexer uses atomic oplocks which is why it helped when you disabled the indexer.  Explorer also uses atomic oplocks which is why you are still seeing the issue.  When this occurs STATUS_FILE_CORRUPT is incorrectly returned and the volume is marked “dirty” which is a signal to the system that chkdsk needs to be run.  No actual corruption has occured.

Neal Christiansen
NTFS Development Lead

The identified workaround for this issue is to stop the indexing service. If you don’t use search very often you can disable it. If you do, you can just stop the service and allow it to restart the next time you restart Windows.

The next trick, of course, is finding the indexing service.  In Windows 7 the service has been renamed “Windows Search”. It serves essentially the same functions as the old “Indexing Service”.

There have been some reports that this issue affects Windows Vista as well, but I don’t have a Vista machine to test with.

Fixing Bootcamp Clock Issue on Windows 7

win7transparentFor the longest time I simply lived with the fact that my system clock didn’t behave properly in my Windows partition when I had BootCamp setup on the macbook. It didn’t matter what I did, I couldn’t seem to find a way to keep the clock properly synchronized.  The problem stems from how Apple decided to implement the system clock which is different from the way that most PC manufacturers do.

Apple’s hardware always returns time in UTC, most PCs update the system clock to local time and won’t require a conversion of that time so of course the default Windows settings aren’t really set up for BootCamp (though you’d think the BootCamp installer could correct this…)

The solution, as it turns out, is a simple registry key change to tell Windows that the system’s clock is using UTC time.  One value in one key, that’s all it takes:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001

BootcampUtcClockFix.reg

Another solution that I found over at superuser.com is to modify OS X to change the time at startup and at shutdown. To me, this seems like more of a hack than the “unsupported” registry key. Windows 7 has been working well under this configuration and has even successfully interpreted the daylight saving time change.

Camping out with Windows 7

Windows 7

I’ve been looking for a better way to do my Windows dev work at home for a while now.  I’ve explored a few different options including VMs and Mono, none of which suited the needs that I have.

I’m not someone who has to have the latest & greatest computers to get my stuff done. The things I use my computer for don’t require a whole lot of horsepower. Truth be told, the newest computer in the whole house is my three-year-old Macbook. So when it came to deciding which of the three machines in my house were going to get the Windows 7 treatment it wasn’t hard to decide.

Apple has said that they won’t be providing official support for Windows 7 on any of their machines for another few weeks, and when they do it’ll be on a limited subset of their Intel-based machines, and only for customers who’ve shelled out the extra $30 for Snow Leopard. Admittedly I’m not an expert in computer hardware, but I’ve been around the block enough times to know that “not officially supported” doesn’t mean “it won’t work”.

The first thing I tried to do was just clear some disk space and run the boot-camp wizard to set up a partition for Windows. Once again I ran into the problem of OS X not being able to reorganize the files on disk to create a contiguous partition. This doesn’t usually pose a problem with computers that have a disk defragmenting tool but of course OS X has some redimentary defrag technology built-in and thus the notion that “Mac’s don’t need to be defragged”. I call shenanigans.

Once I resigned myself to the fact that the only way I was getting back to the nirvana of dual booting was going to be to re-image the Macbook again, I backed up the system, procured a copy of Snow Leopard and got started with the process. Reinstalling OS X was about the same as with Leopard. A couple of new options but nothing earth shattering. The Windows 7 installation on the was also nothing special. Smooth and straightforward as we’d expect out of any modern OS, but it did move fairly quickly.

If you happen to be reading this before you do your installs there’s one useful piece of information in the 14 page document that Apple says you need to read before trying the scary installation of Windows on your Mac. That would be that the drivers for Windows are located on your Snow Leopard install disk. I spent about 3 hours trying to find drivers.

Even though Apple says Windows 7 isn’t supported, the included drivers on the Snow Leopard disk (intended for use with Vista) work just fine.  Windows also reports that some drivers fail to install properly, but in my case there’s nothing overtly wrong. Network, audio, video keyboards & mice are all working as expected with the exception of multitouch functionality on the trackpad. Since I’ll be using the Windows side of the machine most often when connected to a full desk setup (KVM) I’m not too worried about it.