-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix vsnprintf in src/support/asprintf.c for Windows (julia -h doesn't work) #9624
Comments
In srs/support/asprintf.c the buffer realloc() logic does not work on win32 for long input strings. If #define INIT_SZ in asprintf.c is set larger then ./julia.exe -h works. On Unix (man vsnprintf) On win32 http://msdn.microsoft.com/en-us/library/1kt27hek.aspx See: https://github.com/JuliaLang/julia/blob/master/src/support/asprintf.c#L62 |
Wow, thanks @samoconnor. How much larger did you need to make it to get things to work? I'm building now with 256, will see if that's enough. (Also useful trick for referencing specific lines of code, hit y and github will replace the url with one that references the specific sha, like so) |
I made it 12800, just to see if it worked. Sent from my iPhone
|
Yeah, that message is longer than I thought it was. 2048 works at the moment, 1024 doesn't, but that message is also likely to get longer over time. |
OK, but while tweaking INIT_SZ serves to demonstrate the bug, it doesn't fix the underlying problem, which is that win32 vsnprintf is not POSIX compliant. It looks like asprintf.c needs an #ifdef WINDOWS with an algorithm that doubles the buffer size until it is big enough (or similar). |
or use |
Make uv_write() a function (was a macro) and do c_free in "finally" clause. Explicit null-termination in jl_safe_printf() to allow for win32's non-posix vsnprintf behaviour. See also JuliaLang#9624. Use jl_safe_printf() in profile thread. Send help message to jl_printf(JL_STDOUT,) was stderr.
Make uv_write() a function (was a macro) and do c_free in "finally" clause. Explicit null-termination in jl_safe_printf() to allow for win32's non-posix vsnprintf behaviour. See also JuliaLang#9624. Use jl_safe_printf() in profile thread. Send help message to jl_printf(JL_STDOUT,) was stderr.
Make uv_write() a function (was a macro) and do c_free in "finally" clause. Explicit null-termination in jl_safe_printf() to allow for win32's non-posix vsnprintf behaviour. See also JuliaLang#9624. Use jl_safe_printf() in profile thread. Send help message to jl_printf(JL_STDOUT,) was stderr.
Make uv_write() a function (was a macro) and do c_free in "finally" clause. Explicit null-termination in jl_safe_printf() to allow for win32's non-posix vsnprintf behaviour. See also JuliaLang#9624. Use jl_safe_printf() in profile thread. Send help message to jl_printf(JL_STDOUT,) was stderr.
No description provided.
The text was updated successfully, but these errors were encountered: