Closed Bug 1156300 Opened 5 years ago Closed 4 years ago

FixFilenameCase doesn't fix up directory names

Categories

(Toolkit :: Crash Reporting, defect)

x86_64
Windows 8.1
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: dmajor, Assigned: ted)

References

Details

Attachments

(1 file)

The file links on this crash report point to 'libglesv2' when it should be 'libGLESv2': https://crash-stats.mozilla.com/report/index/0f483195-ad7b-4096-a594-47b212150404
I think nowadays we could use GetFinalPathNameByHandle:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364962.aspx
Duplicate of this bug: 1241998
This bug is lacking context, but:
https://dxr.mozilla.org/mozilla-central/rev/aa90f482e16db77cdb7dea84564ea1cbd8f7f6b3/toolkit/crashreporter/tools/symbolstore.py#733

When we dump symbols from PDB files we attempt to normalize the case of source filenames to match what's on the filesystem. Visual C++ tries its hardest to make life difficult for us by using arbitrary case. Unfortunately until recently there weren't actually any APIs for getting the canonical filename case, so this is a PITA.
Duplicate of this bug: 1245750
Duplicate of this bug: 1252514
Who do I need to bribe to get this fixed?
Flags: needinfo?(ted)
I will fix this when I'm back home with my Windows machine on Friday.
Assignee: nobody → ted
Flags: needinfo?(ted)
I did `mach buildsymbols` with this patch locally, and grepping xul.sym file it produced shows lines like:
```
FILE 40997 hg:192.168.1.10//build/mozilla-central:dom/indexedDB/ActorsChild.h:d9b1a9829c8e
```

So this seems to do the trick. (Also I wrote tests for it, and they pass, so that's nice.) Try push just to sanity check I didn't break anything in weird ways.
Apparently Python 3 has os._getfinalpathname on Windows that calls this under the hood:
https://hg.python.org/cpython/file/v3.5.1/Modules/posixmodule.c#l3801

That would have made this patch easier!
Attachment #8739945 - Flags: review?(gps) → review+
Comment on attachment 8739945 [details]
MozReview Request: bug 1156300 - symbolstore.py FixFilenameCase doesn't fix up directory names. r?gps

https://reviewboard.mozilla.org/r/45451/#review42025

::: toolkit/crashreporter/tools/symbolstore.py:765
(Diff revision 1)
> +            size = ctypes.windll.kernel32.GetFinalPathNameByHandleW(handle,
> +                                                                    None,
> +                                                                    0,
> +                                                                    0)
> +            buf = ctypes.create_unicode_buffer(size)
> +            if ctypes.windll.kernel32.GetFinalPathNameByHandleW(handle,
> +                                                                buf,
> +                                                                size,
> +                                                                0) > 0:

I would have allocated a fixed length buffer and called GetFinalPathNameByHandleW once then sliced. But meh.
https://reviewboard.mozilla.org/r/45451/#review42025

> I would have allocated a fixed length buffer and called GetFinalPathNameByHandleW once then sliced. But meh.

Unfortunately this is the only sensible way to handle arbitrary path sizes. I, too, hate the Win32 API for this, but it's the best you can do with C.
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #9)
> https://treeherder.mozilla.org/#/jobs?repo=try&revision=dd359dac5063

I downloaded the symbols from this build to further sanity check and they look sensible:
```
FILE 174525 hg:hg.mozilla.org/try:dom/indexedDB/IndexedDatabase.h:c92a58752328
```
https://hg.mozilla.org/mozilla-central/rev/7fb9838b488a
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Duplicate of this bug: 475726
You need to log in before you can comment on or make changes to this bug.