如何获取 SrcSrv 中包含的 svnindex.cmd 脚本来索引其中包含 URI 转义空格的源文件?

发布于 2024-10-27 16:44:13 字数 866 浏览 7 评论 0原文

我最近设置了一个符号服务器并添加了 SrcSrv< /a> 支持我们的构建脚本,以便我们可以轻松地从现场调试故障转储,并让 WinDbg 和/或 Visual Studio 调试器从我们的 Subversion 存储库中获取正确版本的源文件,这些文件用于编译任何特定版本的我们的应用程序崩溃了。

我在构建脚本中添加了一行来调用 Windows 调试工具包附带的库存 svnindex.cmd 脚本,但发现脚本会混淆包含 URI 转义字符(例如空格)的存储库文件路径,因此 WinDbg 无法从存储库下载文件。

请注意,svnindex.cmd(特别是它启动的 svn.pm Perl 脚本)从 svn info 的输出中获取源文件的存储库位置code> 命令和 svn URI 转义存储库路径。当 svnindex.cmd 遇到这种情况时,它会破坏路径。例如,它将路径转换

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

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

​​事实证明,SrcSrv 将“%”之间的任何内容解释为在运行时替换的变量名。

假设重命名存储库中的所有目录以删除空格和其他可能被 URI 转义的“特殊”字符是不可行的,那么我该如何解决这个限制呢?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以酷 2024-11-03 16:44:13

解决此问题的快速方法是编辑 svnindex.cmd 运行的 svn.pm Perl 脚本,将源服务器元数据嵌入到 PDB 文件中。

如果您有 WinDbg 6.11.0001.404,则此文件位于 Windows 调试工具安装目录下的 srcsrv 目录中(例如,在我的计算机上,它位于 C:\Program Files\ Windows 调试工具 (x86)\srcsrv)。在旧版本的 WinDbg 中,此文件位于 sdk\srcsrv 下。就我而言,我在构建服务器上编辑了 svn.pm 的副本,因为构建服务器实际上调用的是 svnindex.cmd

我的解决方案是简单地对 URI 转义的文件路径进行转义,然后再由脚本进一步处理。我将以下行添加到 svn.pm 中的 GatherFileInformation 子例程中,位于以注释 # Loop on 开头的 while 循环之后“路径:”条目。我在该循环的右大括号之后添加了这些行(svn.pm 副本中的第 206 行):

    # 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);

这解决了问题,并允许我提取在我的开发计算机上运行 WinDbg 的完整源代码。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文