How do I get the svnindex.cmd script included with SrcSrv to index source files with URI-escaped spaces in them?

StackOverflow https://stackoverflow.com/questions/5495254

Frage

I recently set up a symbol server and added SrcSrv support to our build scripts so that we can easily debug crash dumps from the field and have WinDbg and/or the Visual Studio debugger get the correct version of the source files from our Subversion repository that were used to compile whatever particular version of our application crashed.

I added a line to our build script to invoke the stock svnindex.cmd script that comes with the Debugging Tools for Windows package, but found out the script garbles repository filepaths that contain URI-escaped characters such as spaces, so WinDbg can't download the files from the repository.

Note that svnindex.cmd (specifically the svn.pm Perl script that it kicks off) gets repository locations for source files from the output of the svn info command, and svn URI-escapes repository paths. When svnindex.cmd encounters this, it mangles the path. For example, it will turn the path

"http://mysvnrepo/My%20Application/trunk/Database%20Layer/OracleAdapter.cs"

into

"http://mysvnrepo/My20Layer/OracleAdapter.cs"

It turns out that SrcSrv interprets anything between "%" as a variable name that it replaces at runtime.

Assuming that renaming all the directories in our repository to remove spaces and other "special" characters that would be URI-escaped is not feasible, how do I get around this limitation?

War es hilfreich?

Lösung

A quick way to fix this issue is to edit the svn.pm Perl script that svnindex.cmd runs to embed source server metadata into your PDB files.

If you have WinDbg 6.11.0001.404, this file is located in the srcsrv directory under the Debugging Tools for Windows installation directory (for example, on my machine it's located in C:\Program Files\Debugging Tools for Windows (x86)\srcsrv). In older versions of WinDbg, this file is under sdk\srcsrv. In my case, I edited the copy of svn.pm on our build server, since the build server is what actually calls svnindex.cmd.

My solution was to simply unescape the URI-escaped file paths before they are processed further by the script. I added the following lines to the GatherFileInformation subroutine in svn.pm, after the while loop that starts with the comment # Loop on "Path:" entries. I added these lines after the closing brace for that loop (line 206 in my copy of svn.pm):

    # Fix for Subversion URL's. The "%" character is treated specially by SRCSRV, so
    # we need to remove URI escape sequeneces to get rid of them
    # - Mike Spross (3/30/2011)

    use URI::Escape;
    $FileRepository = uri_unescape($FileRepository);
    $FileRelative = uri_unescape($FileRelative);

This solved the problem and allowed me to pull full sources running WinDbg on my development machine.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top