Bug #2400
closedstring formating in, e. g. rb_raise, is truncated differently depending on OS/build environment
Description
=begin
I am not sure if this is a problem. A method like this:
static VALUE mFoo_raise(VALUE self, VALUE msg)
{
rb_raise(rb_eRuntimeError, "'%s'", RSTRING_PTR(msg));
}
causes different length in Exception#message on different platforms:
[ RUBY_PLATFORM, RUBY_VERSION, RUBY_PATCHLEVEL ] * ' '
=> "i686-linux 1.8.7 174"¶
Foo.raise "a" * 10_000 rescue $!.message.size
=> 8191¶
[ RUBY_PLATFORM, RUBY_VERSION, RUBY_PATCHLEVEL ] * ' '
=> "i686-darwin9.7.0 1.8.7 174"¶
Foo.raise "a" * 10_000 rescue $!.message.size
=> 1023¶
Under Windows this seems to be 511.
The same happens also in rb_warn and maybe a lot of other ruby functions. Apparently the variable BUFSIZ defined in stdio.h determines the length of this formatting buffer in the source file error.c, but it has a different value on different platforms. Maybe the buffers should all have the same length?
=end
Updated by nobu (Nobuyoshi Nakada) almost 15 years ago
=begin
Hi,
At Wed, 25 Nov 2009 09:22:52 +0900,
Florian Frank wrote in [ruby-core:26899]:
I am not sure if this is a problem. A method like this:
I don't think it is.
The same happens also in rb_warn and maybe a lot of other
ruby functions. Apparently the variable BUFSIZ defined in
stdio.h determines the length of this formatting buffer in
the source file error.c, but it has a different value on
different platforms. Maybe the buffers should all have the
same length?
Rather, you should get rid of such too long messages, IMO.
Who wants to see the flood by a message?
--
Nobu Nakada
=end
Updated by ujihisa (Tatsuhiro Ujihisa) almost 15 years ago
- Status changed from Open to Assigned
- Assignee set to nobu (Nobuyoshi Nakada)
=begin
=end
Updated by nobu (Nobuyoshi Nakada) almost 15 years ago
- Status changed from Assigned to Rejected
=begin
=end