bug 1316329 - follow symlinks for srcdir path in symbol dumping on windows. r=gps
authorTed Mielczarek <ted@mielczarek.org>
Tue, 22 Nov 2016 14:41:57 -0500
changeset 323901 e5a62d4ce95aa7d460b3745332e0878974d12714
parent 323900 c1b55d39dd28c6a5b07aba6533f9aae286c4a72f
child 323902 f4c1cb96ec823030444ad4fd5bf69c2eb2967d6b
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersgps
bugs1316329
milestone53.0a1
bug 1316329 - follow symlinks for srcdir path in symbol dumping on windows. r=gps If the srcdir is in a path containing a symlink on Windows, when `FixFilenameCase` calls `GetFinalPathNameByHandleW` to normalize the case of a source file it will get a path to the file with the symlink resolved. This breaks our "is this file in the source repository" check. This patch makes the code call `FixFilenameCase` for any srcdir arguments that are passed to the script, so any symlinks will be resolved there and the prefix matching will work. MozReview-Commit-ID: 2UibW9XYWoK
toolkit/crashreporter/tools/symbolstore.py
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -420,17 +420,17 @@ class Dumper:
         # popen likes absolute paths, at least on windows
         self.dump_syms = os.path.abspath(dump_syms)
         self.symbol_path = symbol_path
         if archs is None:
             # makes the loop logic simpler
             self.archs = ['']
         else:
             self.archs = ['-a %s' % a for a in archs.split()]
-        self.srcdirs = [os.path.normpath(a) for a in srcdirs]
+        self.srcdirs = [os.path.normpath(self.FixFilenameCase(a)) for a in srcdirs]
         self.copy_debug = copy_debug
         self.vcsinfo = vcsinfo
         self.srcsrv = srcsrv
         self.exclude = exclude[:]
         if repo_manifest:
             self.parse_repo_manifest(repo_manifest)
         self.file_mapping = file_mapping or {}
 
@@ -758,17 +758,20 @@ class Dumper_Win32(Dumper):
         handle = ctypes.windll.kernel32.CreateFileW(file,
                                                     # GENERIC_READ
                                                     0x80000000,
                                                     # FILE_SHARE_READ
                                                     1,
                                                     None,
                                                     # OPEN_EXISTING
                                                     3,
-                                                    0,
+                                                    # FILE_FLAG_BACKUP_SEMANTICS
+                                                    # This is necessary to open
+                                                    # directory handles.
+                                                    0x02000000,
                                                     None)
         if handle != -1:
             size = ctypes.windll.kernel32.GetFinalPathNameByHandleW(handle,
                                                                     None,
                                                                     0,
                                                                     0)
             buf = ctypes.create_unicode_buffer(size)
             if ctypes.windll.kernel32.GetFinalPathNameByHandleW(handle,