Closed Bug 824210 Opened 12 years ago Closed 12 years ago

B2G Desktop causes assertion ABORT: CRT ASSERT [...] strftime.c(798) : Assertion failed: ( "Invalid format directive" , 0 )

Categories

(Firefox OS Graveyard :: Gaia, defect, P4)

defect

Tracking

(blocking-basecamp:-, b2g18+ fixed)

VERIFIED FIXED
blocking-basecamp -
Tracking Status
b2g18 + fixed

People

(Reporter: briansmith, Assigned: kaze)

References

Details

(Keywords: regression)

Attachments

(1 file)

This is caused by Gaia's use of the "%e" format directive for formatting dates, which Windows' strftime does not support. Apparently the workaround is to use "%#d" instead but there are parts of Gaia that parse format strings and they fail to handle "%#d" correctly.
NOTE: This makes it impossible (AFAICT) to use Windowes debug builds of B2G desktop. Even if you set XPCOM_DEBUG_BREAK=warn, this assertion still kills your process because it is a assertion from the CRT, not a Gecko or NSPR assertion.
https://github.com/mozilla-b2g/gaia/pull/7154

I am gone for 10 days and I'm not sure how pull requests and code reviews work together so please land this patch if it makes sense at all. I verified that it seems to make B2G desktop on Windows work.
Flags: needinfo?(myk)
That would be an acceptable workaround but %d and %e are not strictly equivalent.
Lemme try to find a better fix.
Assignee: nobody → kaze
Note that %e is just not part of the JS language. It happens to work in Firefox because we currently forward to strftime, but I'm pretty sure no other browser supports it and we should stop using it long-term for that reason.

I don't know whether that's acceptable short-term, though ;-)
(In reply to Benjamin Smedberg  [:bsmedberg] from comment #5)
> Note that %e is just not part of the JS language. It happens to work in
> Firefox because we currently forward to strftime, but I'm pretty sure no
> other browser supports it and we should stop using it long-term for that
> reason.

I still prefer to rely on strftime-like mnemonics in shared/js/l10n_date.js because it’s an easy way to format a date. At the moment we rely on the Gecko-specific `.toLocaleFormat()' method, but we could implement the whole strftime parser in JS if we really wanted to be cross-browser.

In the long term, it’d be nice to have a similar way to format dates in vanilla JavaScript. If I understood correctly, ES6 will bring us most of the solution.
blocking-basecamp: --- → ?
Attached patch patch proposalSplinter Review
Attachment #695237 - Flags: review?(etienne)
Attachment #695237 - Flags: review?(etienne) → review+
Triage: base on comment 1, it seems to be only a problem for B2G desktop. BB-, tracking-b2g18+. Please renom if this is really blocking developers
blocking-basecamp: ? → -
tracking-b2g18: --- → +
Priority: -- → P4
Comment on attachment 695237 [details] [diff] [review]
patch proposal

NOTE: If blocking-basecamp+ is set, just land it for now.

[Approval Request Comment]
Bug caused by (feature/regressing bug #): ?
User impact if declined: can't build b2g-desktop on windows
Testing completed: manual
Risk to taking this patch (and alternatives if risky): very low
Attachment #695237 - Flags: approval-gaia-master?(21)
Attachment #695237 - Flags: approval-gaia-master?(21) → approval-gaia-master+
https://github.com/mozilla-b2g/gaia/commit/9ad3ad808df71abf70976b57447d8148ce3b38ba
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Flags: needinfo?(myk)
verified it on Unagi build 201301140703222
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: