windows - 如何在 win32 上调试文件系统 "access denied"错误?

标签 windows debugging filesystems waf

我现在在构建脚本上玩得很开心:我正在使用 Waf来插入我们的构建过程,一切都很好,除了在 Windows 上,我在构建过程中遇到间歇性错误。

错误基本上总是一种或另一种形式的“访问被拒绝”错误,与我在构建过程中创建的临时文件有关,以使某些工具能够运行并完成它的工作。例如,在运行 NSIS 之前要生成可执行安装程序,我必须将所有必需的文件“暂存”到构建目录并从那里运行命令。有时事情会按预期工作,但有时我会收到有关我复制的其中一个文件的错误报告,例如:

文件:打开文件“Platform\\Win32\\lxml-2.2.1-py2.6-win32.egg”失败

我花了很长时间试图找出问题所在,但这真的很难,因为问题是间歇性的。我尝试的最后一件事是使用 procmon监视文件系统访问以尝试跟踪导致访问错误的原因:我知道该文件在那里,所以一定是某些东西打开了该文件。我在下面包含了相关的输出,因为我看不出有什么问题:Python 似乎在 NSIS 想要打开它之前关闭了文件,但随后 NSIS 失败了。任何人都可以阐明这一点吗?这个问题不仅与这种情况有关,而且与我生成子进程以处理我已复制到构建目录的文件的其他情况有关...

7:35:15.9704427 PM  python.exe  4968    QueryOpen   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED  
7:35:15.9707497 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9708634 PM  python.exe  4968    QueryBasicInformationFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:11 PM, FileAttributes: A
7:35:15.9709271 PM  python.exe  4968    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 
7:35:15.9785180 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9786119 PM  python.exe  4968    SetBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 1/1/1601 1:00:00 AM, LastAccessTime: 1/1/1601 1:00:00 AM, LastWriteTime: 1/1/1601 1:00:00 AM, ChangeTime: 1/1/1601 1:00:00 AM, FileAttributes: AN
7:35:15.9787155 PM  python.exe  4968    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 
7:35:15.9789401 PM  python.exe  4968    QueryOpen   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED  
7:35:15.9790309 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9790700 PM  python.exe  4968    QueryBasicInformationFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:12 PM, FileAttributes: A
7:35:15.9790952 PM  python.exe  4968    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 
7:35:15.9792809 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Write Attributes, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:15.9793270 PM  python.exe  4968    SetBasicInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 1/1/1601 1:00:00 AM, LastAccessTime: 1/1/1601 1:00:00 AM, LastWriteTime: 1/1/1601 1:00:00 AM, ChangeTime: 1/1/1601 1:00:00 AM, FileAttributes: AN
7:35:15.9794041 PM  python.exe  4968    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 
7:35:16.3508170 PM  makensis.exe    3296    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SHARING VIOLATION   Desired Access: Generic Read, Disposition: Open, Options: Sequential Access, Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, AllocationSize: n/a
7:35:16.3557763 PM  python.exe  4968    QueryOpen   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg FAST IO DISALLOWED  
7:35:16.3558928 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS Desired Access: Read Attributes, Disposition: Open, Options: Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a, OpenResult: Opened
7:35:16.3559461 PM  python.exe  4968    QueryNetworkOpenInformationFile ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS CreationTime: 7/25/2009 7:35:11 PM, LastAccessTime: 7/25/2009 7:35:11 PM, LastWriteTime: 7/25/2009 7:35:11 PM, ChangeTime: 7/25/2009 7:35:12 PM, AllocationSize: 1/1/1601 1:00:00 AM, EndOfFile: 1/1/1601 1:00:00 AM, FileAttributes: A
7:35:16.3560121 PM  python.exe  4968    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 
7:35:16.3562048 PM  python.exe  4968    CreateFile  ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SHARING VIOLATION   Desired Access: Read Attributes, Delete, Disposition: Open, Options: Non-Directory File, Open Reparse Point, Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: n/a
7:35:21.9320579 PM  python.exe  3160    CloseFile   ..\Path\To\Build\lxml-2.2.1-py2.6-win32.egg SUCCESS 

最佳答案

在该跟踪中,文件在跟踪开始时已经存在。所以其他东西可能使它保持打开状态(例如病毒扫描程序或索引服务)。

关于windows - 如何在 win32 上调试文件系统 "access denied"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1182909/

相关文章:

java - 为什么这个 boolean 比较不能正常工作?

c# - 调试时有效,运行时失败?

linux - 如何初始化文件系统?

java - 显示文件夹中所有文件相对于该文件夹中遇到的第一个文件的路径

linux - 默认端口号始终为 4 位数字

windows - 如何知道一个程序在做什么?

php - 奇怪的 MySQL/PHP 问题 : mysql query does not execute and there is no error

linux - 如何挂载文件系统类型为 "devtmpfs"的硬盘

windows - 参见 .exe 的 std::cout

windows - 如何让 cURL 从 Windows 命令行运行?