-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: fix exception message encoding #3288
Conversation
Is it not necessary to add on https://github.com/nodejs/node/blob/master/src/node.cc#L3210? |
@@ -156,6 +156,42 @@ static Isolate* node_isolate = nullptr; | |||
static v8::Platform* default_platform; | |||
|
|||
|
|||
static void PrintErrorString(const char *format, ...) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style issue: const char*
.
This isn't complete yet, I think? There are a lot of (f)printf statements strewn throughout the code base. |
@evanlucas That has to do with program arguments, but the string values are not from user input such that they could contain utf8. @bnoordhuis Well, of the other |
3bdc6b3
to
5d7e67a
Compare
CI is fine except the random ARM failures. I can confirm it fixes #3284. |
} | ||
|
||
// Fill in any placeholders | ||
size_t n = vsnprintf(nullptr, 0, format, ap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kind of surprised this works, I thought vsnprintf() on Windows returned -1 when the output buffer is too small.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it on Windows 7 with VS2013 at least. I suppose _vscprintf()
could be used instead...
I'm going to defer to @nodejs/platform-windows. |
Lgtm |
The printf family of functions do not properly display UTF8 strings well on Windows. Use the appropriate wide character API instead if stderr is a tty. Fixes: nodejs#3284
5d7e67a
to
238d1ae
Compare
Final CI run after changing Only failures are an unrelated failure on Win10 and a recurring unrelated failure on FreeBSD 10.1 64-bit. |
Landed in 2d35607. |
Thanks for the quick fix! |
@jasnell should this be LTS? |
hmmm... we may need an LTS WG discussion on this one. |
@nodejs/lts ... should we land this one in v4.x? |
after looking at #3284 I would vote yes for this one, if this were just a "make it proper" fix then I'd be borderline but given this is fixing an actual user-reported bug it's much easier to justify because it's not academic |
Landed in v4.x-staging in 9bffceb |
The printf family of functions do not properly display UTF8 strings well on Windows. Use the appropriate wide character API instead if stderr is a tty.
Fixes: #3284