summaryrefslogtreecommitdiff
path: root/test/ruby/test_marshal.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use RTEST and add test for GH-6832Alan Wu2022-11-301-0/+8
| | | | | Technically we shouldn't see Qfalse now, but RTEST also compiles down to just one branch anyways. Pretty contrived issue, but easy to fix.
* Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229)John Hawthorn2022-08-151-1/+21
| | | | | | | | | | | | | | | | | | | | | | | * Optimize Marshal dump of large fixnum Marshal's FIXNUM type only supports 31-bit fixnums, so on 64-bit platforms the 63-bit fixnums need to be represented in Marshal's BIGNUM. Previously this was done by converting to a bugnum and serializing the bignum object. This commit avoids allocating the intermediate bignum object, instead outputting the T_FIXNUM directly to a Marshal bignum. This maintains the same representation as the previous implementation, including not using LINKs for these large fixnums (an artifact of the previous implementation always allocating a new BIGNUM). This commit also avoids unnecessary st_lookups on immediate values, which we know will not be in that table. * Fastpath for loading FIXNUM from Marshal bignum * Run update-deps
* test/ruby/test_marshal.rb: Prevent "assigned but unused variable" warningYusuke Endoh2021-10-251-1/+1
| | | | | | | http://rubyci.s3.amazonaws.com/centos7/ruby-master/log/20211025T093004Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20211025T093004Z/ruby/test/ruby/test_marshal.rb:925: warning: assigned but unused variable - objects ```
* marshal.c Marshal.load accepts a freeze: true option.Jean Boussier2021-10-051-0/+38
| | | | | | | | Fixes [Feature #18148] When set, all the loaded objects are returned as frozen. If a proc is provided, it is called with the objects already frozen.
* Restore Hash#compare_by_identity mode [Bug #18171]Nobuyoshi Nakada2021-10-021-0/+19
|
* marshal.c: don't call the proc with partially initialized objects. (#4866)Jean byroot Boussier2021-09-301-0/+12
| | | | | For cyclic objects, it requires to keep a st_table of the partially initialized objects.
* Revive the test using US-ASCII incompatible symbolNobuyoshi Nakada2021-09-231-0/+4
|
* Prohibit invalid encoding symbols [Bug #18184]Nobuyoshi Nakada2021-09-231-3/+7
|
* Check the encoding of `ruby2_keywords_flag` [Bug #18184]Nobuyoshi Nakada2021-09-231-1/+5
|
* Check the entire name as `ruby2_keywords_flag` [Bug #18184]Nobuyoshi Nakada2021-09-221-1/+7
|
* Marshal.load: do not call the proc until strings have their encodingJean Boussier2021-09-151-0/+17
| | | | Ref: https://bugs.ruby-lang.org/issues/18141
* [WIP] add error_squiggle gemYusuke Endoh2021-06-291-1/+1
| | | | | | | | | | | | | ``` $ ./local/bin/ruby -e '1.time {}' -e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError) 1.time {} ^^^^^ Did you mean? times ``` https://bugs.ruby-lang.org/issues/17930
* Suppress constant redefinition warningsNobuyoshi Nakada2021-01-111-0/+4
|
* test/ruby: Check warning messages at a finer granularityNobuyoshi Nakada2020-12-171-3/+11
| | | | | Instead of suppressing all warnings wholly in each test scripts by setting `$VERBOSE` to `nil` in `setup` methods.
* Make it possible to dump and load an exception objectYusuke Endoh2020-09-061-0/+31
| | | | | | | | | | | | | | | | | | | | | A backtrace object in an exception had never supported marshalling correctly: `Marshal.load(Marshal.dump(exc)).backtrace_locations` dumped core. An Exception object has two hidden instance varibles for backtrace data: one is "bt", which has an Array of Strings, and the other is "bt_locations", which has an Array of Thread::Backtrace::Locations. However, Exception's dump outputs data so that the two variables are the same Array of Strings. Thus, "bt_locations" had a wrong-type object. For the compatibility, it is difficult to change the dump format. This changeset fixes the issue by ignoring data for "bt_locations" at the loading phase if "bt_locations" refers to the same object as "bt". Future work: Exception's dump should output "bt_locations" appropriately. https://bugs.ruby-lang.org/issues/17150
* support multi-run for test/ruby/test_marshal.rbKoichi Sasada2020-01-281-2/+14
| | | | need to remove Constants.
* marshal.c: Support dump and load of a Hash with the ruby2_keywords flagYusuke Endoh2020-01-171-0/+14
| | | | | | | | | | | | It is useful for a program that dumps and load arguments (like drb). In future, they should deal with both positional arguments and keyword ones explicitly, but until ruby2_keywords is deprecated, it is good to support the flag in marshal. The implementation is similar to String's encoding; it is dumped as a hidden instance variable. [Feature #16501]
* Update tests for full keyword argument separationJeremy Evans2020-01-021-3/+4
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-70/+0
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* marshal.c: check instance variable countNobuyoshi Nakada2019-07-011-1/+13
| | | | | * marshal.c (w_ivar_each): ensure that no instance variable was removed while dumping other instance variables. [Bug #15968]
* marshal.c: check instance variable countNobuyoshi Nakada2019-07-011-0/+32
| | | | | * marshal.c (w_obj_each): ensure that no instance variable was added while dumping other instance variables. [Bug #15968]
* marshal.c: allow marshalling keyword_init structk0kubun2018-01-051-0/+7
| | | | | | | | | | | | struct.c: define rb_struct_s_keyword_init to shared with marshal.c internal.h: add the declaration to be used by marshal.c test/ruby/test_marshal.rb: add test for Bug#14314 [Feature #14314] [ruby-core:84629] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61616 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add FrozenError as a subclass of RuntimeErrorshyouhei2017-12-121-1/+1
| | | | | | | | | | | | | | FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Rename RbConfig::Limits as RbConfig::LIMITSnobu2017-04-061-1/+1
| | | | | | | | * template/limits.c.tmpl (Init_limits): rename RbConfig::Limits as RbConfig::LIMITS, constants other than class or module are all uppercase with underscores by convention. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test: use RbConfig::Limitsnobu2017-03-021-1/+1
| | | | | | | | * test/lib/envutil.rb: rbconfig/sizeof may not be available when cross-compiling. use RbConfig::Limits instead of calculating limits of Fixnum with hard-coded CHAR_BIT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: revert r57631 partiallynobu2017-02-151-0/+3
| | | | | | | | | | * marshal.c (rb_marshal_dump_limited): do not free dump_arg, which may be dereferenced in check_dump_arg due to continuation, and get rid of dangling pointers. * marshal.c (rb_marshal_load_with_proc): ditto for load_arg. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: fix infinite recursionnobu2016-11-241-0/+12
| | | | | | | | * marshal.c (check_userdump_arg): marshal_dump should not return an instance of the same class, otherwise it causes infinite recursion. [ruby-core:78289] [Bug #12974] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* No respond_to? as if the default definitionnobu2016-06-241-0/+20
| | | | | | | | * vm_method.c (vm_respond_to): try method_missing if respond_to? is undefined, as if it is the default definition. [ruby-core:75377] [Bug #12353] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* variable.c: consider lengthnobu2016-06-191-4/+6
| | | | | | | * variable.c (rb_path_to_class): consider the string length instead of a terminator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* envutil.rb defines Integer::{FIXNUM_MIN,FIXNUM_MAX}.akr2016-05-011-2/+1
| | | | | | | | | | | | | | | | | | * test/lib/envutil.rb: Define Integer::{FIXNUM_MIN,FIXNUM_MAX}. * test/ruby/test_bignum.rb: Use Integer::{FIXNUM_MIN,FIXNUM_MAX}. * test/ruby/test_bignum.rb: Ditto. * test/ruby/test_integer_comb.rb: Ditto. * test/ruby/test_marshal.rb: Ditto. * test/ruby/test_optimization.rb: Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_marshal.rb: assert bad linknobu2016-03-171-5/+4
| | | | | | | * test/ruby/test_marshal.rb (test_marshal_load_r_prepare_reference_crash): assert an ArgumentError exception at a bad link. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * marshal.c (r_object0): raise ArgumentError when linking to undefineddrbrain2016-03-161-0/+12
| | | | | | | object. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54136 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_marshal.rb: use assert_ruby_statusnobu2016-03-151-5/+1
| | | | | | | | * test/ruby/test_marshal.rb (test_marshal_load_extended_class_crash): use assert_ruby_status to deal with signals, core dump and diagnostic reports. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54108 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * marshal.c (r_object0): Fix Marshal crash for corrupt extended object.drbrain2016-03-141-0/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * marshal.c (r_object0): honor Marshal.load post procnaruse2016-01-211-0/+6
| | | | | | | value for TYPE_LINK. by Hiroshi Nakamura <nahi@ruby-lang.org> https://github.com/ruby/ruby/pull/1204 fix GH-1204 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c: --debug=frozen-string-literal optionnobu2015-11-211-1/+1
| | | | | | | * ruby.c (need_argument): move frozen-string-literal-debug option from --enable to --debug. [Feature #11725] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_marshal.rb: test_no_internal_idsnobu2015-10-271-0/+16
| | | | | | | * test/ruby/test_marshal.rb (test_no_internal_ids): test for r52304, no internal IDs should be exposed by Marshal.dump. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: class name encodingnobu2015-04-161-0/+11
| | | | | | | | * marshal.c (r_object0): preserve the encoding of the class name in an error message, in the case of USRMARSHAL without marshal_load method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: class name encodingnobu2015-04-161-0/+11
| | | | | | | | * marshal.c (r_object0): preserve the encoding of the class name in an error message, in the case of USERDEF without _load singleton method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: class name encodingnobu2015-04-161-0/+12
| | | | | | | * marshal.c (r_object0): preserve the encoding of the class name in an error message, in the case of no _load_data method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: class name encodingnobu2015-04-161-0/+7
| | | | | | | * marshal.c (w_object): preserve the encoding of the class name in an error message, in the case of no _dump_data method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: class name encodingnobu2015-04-161-0/+7
| | | | | | | * marshal.c (w_object): preserve the encoding of the class name in an error message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: register symbol strings firstnobu2015-03-221-0/+11
| | | | | | | | | | * marshal.c (r_symreal): register symbol names as strings first so that r_symlink always returns valid names. [ruby-core:68587] [Bug #10991] * marshal.c (r_ivar, r_object0): now need to intern symbol names. * marshal.c (r_object0): compare with symbol names. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: fix symlink indexnobu2014-07-291-0/+4
| | | | | | | * marshal.c (w_symbol): fix symlink index. register the given symbols, not its name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Join threads before close pipes.akr2014-05-311-10/+8
| | | | | | | | | | closing a FD interrupts threads which uses the FD. rb_thread_io_blocking_region (for write()) checks an interrupt after write() is finished. So, joining the thread after closing() may raise "IOError: stream closed". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Join threads.akr2014-05-311-2/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46285 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: do not recycle wrapper objectsnobu2014-02-171-0/+19
| | | | | | | | * marshal.c (marshal_dump, marshal_load): do not recycle wrapper objects, to prevent from segfault with continuation. [ruby-dev:47970] [Bug #9523] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* marshal.c: Numerics are not taintednobu2014-02-081-0/+10
| | | | | | | | * include/ruby/ruby.h (OBJ_TAINTABLE, OBJ_TAINT, OBJ_INFECT), marshal.c (r_entry0): all Numerics never be tainted now. [ruby-core:57346] [Bug #8945] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_marshal.rb: fix test depending on heap addressnobu2014-02-061-1/+2
| | | | | | | * test/ruby/test_marshal.rb (test_packed_string): explicitly force encoding for the case packed string is 7bit ASCII only. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e