Closed Bug 1729711 Opened 4 years ago Closed 13 hours ago

Incorrect relative header path debug information when object directory is under source directory

Categories

(Core :: Storage: Quota Manager, task, P3)

Firefox 94
x86_64
Windows 10
task

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox94 --- affected
firefox155 --- fixed

People

(Reporter: jari, Assigned: jari, NeedInfo)

Details

(Whiteboard: dom-lws-bugdash-triage)

Attachments

(1 file)

In function mozilla::dom::quota::MakeSourceFileRelativePath, in file dom/quota/QuotaCommon.cpp, header file path from macro __FILE__ is compared to top of the source directory, and if the beginnings of the paths match, the rest of the header file path is returned as the relative path.

When the object directory is under the top of the source directory, for example when using the macro @TOPSRCDIR@ in the mozconfig file, this leads to an incorrect relative file path.

The issue was found by tests TEST(QuotaCommon_MakeSourceFileRelativePath, DomQuotaSourceFile_Exported) and TEST(QuotaCommon_MakeSourceFileRelativePath, DomLocalstorageSourceFile_Exported_Mapped).

Because it is less common to have the source under the object directory, one way out might be to check for this possibility first, as is later done in the code.

The issue impacts only debug message information.

Severity: -- → S3
Priority: -- → P3
Whiteboard: dom-lws-bugdash-triage
Severity: S3 → S4
Type: defect → task

On Windows, FILE can produce paths with backslashes, but the
quota manager's error logging compares against hardcoded forward-slash
suffixes. This causes an assertion failure in GetTreeBase.

Additionally, when the objdir is under the source tree, the source
tree base is a prefix of the objdir base, so exported headers
incorrectly match the source tree check first.

Fix both by adding a constexpr NormalizedSourcePath template that
normalizes backslashes to forward slashes at compile time, used in the
QM_HANDLE_ERROR macros and in GetSourceTreeBase/GetObjdirDistInclude-
TreeBase. Also reorder the objdir check before the source tree check
in MakeSourceFileRelativePath.

Assignee: nobody → jjalkanen
Attachment #9593032 - Attachment description: WIP: Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows → Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=#dom-storage
Status: NEW → ASSIGNED
Pushed by jjalkanen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/0bb5c0d49506 https://hg.mozilla.org/integration/autoland/rev/e455ef7d3ba3 Fix __FILE__ path separator handling in QuotaCommon on Windows. r=dom-storage-reviewers,asuth
Pushed by asilaghi@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/5d40e2a1d701 https://hg.mozilla.org/integration/autoland/rev/e3f24a336334 Revert "Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=dom-storage-reviewers,asuth" for causing build bustages at /QuotaCommon.h

Backed out for causing build bustages as QuotaCommon.h
Backout Link
Push with failures
Failure Log
Failure line /builds/worker/checkouts/gecko/dom/quota/QuotaCommon.h:1379:13: error: bad implicit conversion constructor for 'NormalizedSourcePath'

Flags: needinfo?(jjalkanen)
Pushed by jjalkanen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4fd92e7ad15a https://hg.mozilla.org/integration/autoland/rev/36e6977d0f89 Fix __FILE__ path separator handling in QuotaCommon on Windows. r=dom-storage-reviewers,asuth
Pushed by amarc@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/71329aca5b15 https://hg.mozilla.org/integration/autoland/rev/a12ec7fc8b37 Revert "Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=dom-storage-reviewers,asuth" for causing test failure
Attachment #9593032 - Attachment description: Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=#dom-storage → WIP: Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=#dom-storage
Attachment #9593032 - Attachment description: WIP: Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=#dom-storage → Bug 1729711 - Fix __FILE__ path separator handling in QuotaCommon on Windows. r=#dom-storage
Pushed by jjalkanen@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/9f2e8c25f0b4 https://hg.mozilla.org/integration/autoland/rev/6d21b1fa30fe Fix __FILE__ path separator handling in QuotaCommon on Windows. r=dom-storage-reviewers,asuth
Status: ASSIGNED → RESOLVED
Closed: 13 hours ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: