PowerShell and svnadmin dump/load

Recently I was migrating several Subversion repos­i­to­ries from a Windows server over to a Solaris one and ran into a rather frus­trat­ing issue. Actually it's quite an in­ter­est­ing problem, but was frus­trat­ing due to the size of the repos­i­to­ries involved, and my fear that repos­i­to­ries were borked.

It all started with my decision to fire up PowerShell rather than cmd.exe to do the initial dump of the re­pos­to­ries. The following code was executed to dump a repository:

svnadmin dump repositorypath > repository.dump

All seems to go to plan but this is where a silent corruption of the dump file occurs. Not suspecting that the dump file was malformed, I copied repository.dump over to the Solaris box. I issued the standard commands to create a new repository and load the dump file:

svnadmin create repository/path
svnadmin load repository/path < repository.dump

After executing the second command I got an error from svnadmin com­plain­ing about a malformed header on the dump file:

svnadmin: Malformed dumpfile header

My first instinct was to re-copy the dump file and try again, but I thought I should dump and load the repository on my Windows server. Lo and behold this fell over with the same error. At this point I was thinking something was really wrong with my SVN install and repos­i­to­ries, but then I stumbled on this newsgroup discussion.

It turns out that my problems were the result of how Windows PowerShell handles binary data that is piped on the command line. I really want to look into the details of this, but it would appear that the new found ability to pass .NET objects on the command line can mess with old school ex­pec­ta­tions of how the command line works.

Tagged with powershell, problem, solaris, subversion, svn and windows.