summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2021-04-24Skip tests that use `Float` inside; ref #5421Yukihiro "Matz" Matsumoto
2021-04-24numeric.c: remove duplicated definitions; #5421Yukihiro "Matz" Matsumoto
Following functions are defined in `mrblib/numeric.c`: - `Integer#ceil` - `Integer#floor` - `Integer#round` - `Integer#truncate`
2021-04-24time.c: `fixable_time_t_p` is not used with `MRB_NO_FLOAT`; #5421Yukihiro "Matz" Matsumoto
2021-04-24random.c: refactoring; #5421Yukihiro "Matz" Matsumoto
- `Random.rand` with `MRB_NO_FLOAT` behaves as `Random.rand(100)` - `Random.rand(i)` where `i<0` raises `ArgumentError`
2021-04-24build_config/nofloat.rb: build configuration with `MRB_NO_FLOAT`; #5421Yukihiro "Matz" Matsumoto
2021-04-24numeric.c: fix errors from `MRB_NO_FLOAT`; close #5421Yukihiro "Matz" Matsumoto
2021-04-23vm.c: fix errors with `MRB_NO_FLOAT`; fix #5421Yukihiro "Matz" Matsumoto
2021-04-23time.c: `time_t` may be unsigned on some platforms.Yukihiro "Matz" Matsumoto
2021-04-22error.h: rename `mrb_protect_raw` to `mrb_protect_error`; #5415Yukihiro "Matz" Matsumoto
- `_raw` does not describe the nature of the function - the function protect errors during C function execution
2021-04-21numeric.c: update error messages in `int_pow`; ref #5420Yukihiro "Matz" Matsumoto
2021-04-21numeric.c: fix `int_pow` to detect integer overflow; fix #5420Yukihiro "Matz" Matsumoto
2021-04-21test/math.rb: `10**30` could cause integer overflow; ref #5420Yukihiro "Matz" Matsumoto
2021-04-20Merge pull request #5419 from ↵Yukihiro "Matz" Matsumoto
shuujii/remove-unused-struct-in-include-mruby-variable.h Remove unused struct in `include/mruby/variable.h`
2021-04-20Merge pull request #5418 from ↵Yukihiro "Matz" Matsumoto
shuujii/remove-unused--include-in-complex.c-and-rational.c Remove unused `#include` in `complex.c` and `rational.c`
2021-04-20Merge pull request #5417 from ↵Yukihiro "Matz" Matsumoto
shuujii/remove-MRB_API-from-mrb_get_backtrace-definition Remove `MRB_API` from `mrb_get_backtrace` definition
2021-04-20Remove unused struct in `include/mruby/variable.h`KOBAYASHI Shuji
2021-04-20Remove unused `#include` in `complex.c` and `rational.c`KOBAYASHI Shuji
2021-04-20Remove `MRB_API` from `mrb_get_backtrace` definitionKOBAYASHI Shuji
2021-04-19Merge pull request #5415 from dearblue/unwind-mrb_protectYukihiro "Matz" Matsumoto
Introducing the `mrb_protect_raw()` API function
2021-04-19Introducing the `mrb_protect_raw()` API functiondearblue
The purpose is two-fold: 1. to be able to specify a pointer directly when user data is used When using `mrb_protect()`, it is necessary to allocate objects by `mrb_obj_cptr()` function when using user data. Adding `mrb_protect_raw()` will make it simpler to reimplement `mrbgems/mruby-error`. 2. to correctly unwind callinfo when an exception is raised from a C function defined as a method (the main topic) If a method call is made directly under `mrb_protect()` and a C function is called, control is returned from `mrb_protect()` if an exception occurs there. In this case, callinfo is not restored, so it is out of sync. Moreover, returning to mruby VM (`mrb_vm_exec()` function) in this state will indicate `ci->pc` of C function which is equal to `NULL`, and subsequent `JUMP` will cause `SIGSEGV`. Following is an example that actually causes `SIGSEGV`: - `crash.c` ```c #include <mruby.h> #include <mruby/compile.h> #include <mruby/error.h> static mrb_value level1_body(mrb_state *mrb, mrb_value self) { return mrb_funcall(mrb, self, "level2", 0); } static mrb_value level1(mrb_state *mrb, mrb_value self) { return mrb_protect(mrb, level1_body, self, NULL); } static mrb_value level2(mrb_state *mrb, mrb_value self) { mrb_raise(mrb, E_RUNTIME_ERROR, "error!"); return mrb_nil_value(); } int main(int argc, char *argv[]) { mrb_state *mrb = mrb_open(); mrb_define_method(mrb, mrb->object_class, "level1", level1, MRB_ARGS_NONE()); mrb_define_method(mrb, mrb->object_class, "level2", level2, MRB_ARGS_NONE()); mrb_p(mrb, mrb_load_string(mrb, "p level1")); mrb_close(mrb); return 0; } ``` - compile & run ```console % `bin/mruby-config --cc --cflags --ldflags` crash.c `bin/mruby-config --libs` % ./a.out zsh: segmentation fault (core dumped) ./a.out ``` After applying this patch, it will print exception object and exit normally. The `mrb_protect()`, `mrb_ensure()` and `mrb_rescue_exceptions()` in `mrbgems/mruby-error` have been rewritten using `mrb_protect_raw()`.
2021-04-19backtrace.c: remove `MRB_API` from internal functions.Yukihiro "Matz" Matsumoto
- `mrb_exc_backtrace` to implement `Exception#backtrace` - `mrb_get_backtrace` to implement `#caller`
2021-04-19backtrace.c: small refactoring in `mrb_exc_backtrace()`; ref #5394Yukihiro "Matz" Matsumoto
- add comment for unpacking - avoid saving the symbol in a local variable
2021-04-19backtrace.c: pedantic check for empty backtrace; ref #5394Yukihiro "Matz" Matsumoto
2021-04-19backtrace.c: should skip first (innermost) frame w/out position; #5394Yukihiro "Matz" Matsumoto
Otherwise we suffer `(unknown):0:` errors.
2021-04-19time.c: add integer boundary check for year.Yukihiro "Matz" Matsumoto
On configurations where `sizeof(mrb_int) > sizeof(int)`.
2021-04-18Merge pull request #5414 from shuujii/mRubyPresym-no-longer-needs-RakeDSLYukihiro "Matz" Matsumoto
`MRuby::Presym` no longer needs `Rake::DSL`
2021-04-17array.rb: add `Array#intersect?` from Ruby3.0.1.Yukihiro "Matz" Matsumoto
2021-04-17`MRuby::Presym` no longer needs `Rake::DSL`KOBAYASHI Shuji
2021-04-16feat(CI): add the GitHub Super LinterJohn Bampton
The GitHub Super Linter is a more robust and better supported tool than the current GitHub Actions we are using. Running these checks: ERROR_ON_MISSING_EXEC_BIT: true VALIDATE_BASH: true VALIDATE_BASH_EXEC: true VALIDATE_EDITORCONFIG: true VALIDATE_MARKDOWN: true VALIDATE_SHELL_SHFMT: true VALIDATE_YAML: true https://github.com/marketplace/actions/super-linter https://github.com/github/super-linter Added the GitHub Super Linter badge to the README. Also updated the pre-commit framework and added more documentation on pre-commit. Added one more pre-commit check: check-executables-have-shebangs Added one extra check for merge conflicts to our GitHub Actions. EditorConfig and Markdown linting. Minor grammar and spelling fixes. Update linter.yml
2021-04-15Merge pull request #5413 from ↵Yukihiro "Matz" Matsumoto
shuujii/fix-enable_debug_info-in-mrbgems-mruby-proc-ext-test-proc.rb Fix `enable_debug_info?` in `mrbgems/mruby-proc-ext/test/proc.rb`
2021-04-15Fix `enable_debug_info?` in `mrbgems/mruby-proc-ext/test/proc.rb`KOBAYASHI Shuji
2021-04-14Merge pull request #5411 from artichoke/mrb_protect_atexit_prototype_mismatchYukihiro "Matz" Matsumoto
Fix incorrect prototype on declaration of mrb_protect_atexit
2021-04-14Merge pull request #5410 from ↵Yukihiro "Matz" Matsumoto
mruby/dependabot/github_actions/actions/cache-v2.1.5 build(deps): bump actions/cache from v2.1.4 to v2.1.5
2021-04-13Fix incorrect prototype on declaration of mrb_protect_atexitRyan Lopopolo
`state.c` makes a prototype declaration for the private `mrb_protect_atexit` which is defined in `error.c`. `error.c` defines this function with a void return type, but `state.c` defines the prototype with an `int` return type. This mismatch prevents mruby from compiling on stricter compilers like emscripten.
2021-04-13build(deps): bump actions/cache from v2.1.4 to v2.1.5dependabot[bot]
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8) Signed-off-by: dependabot[bot] <[email protected]>
2021-04-13mrbgem.rake: avoid implicit receivers in `mrbgem.rake`.Yukihiro "Matz" Matsumoto
2021-04-13mruby-io: fix `IO#ungetbyte`; ref #5389Yukihiro "Matz" Matsumoto
- remove `Integer#chr` (thus `mruby-sting-ext`) dependency - fix the behavior when `c.is_a? String` - fix the behavior when `c > 255`
2021-04-13Rakefile: remove GitLab configuration; close #5409Yukihiro "Matz" Matsumoto
This CI could consume too much CPU time on GitLab. Maybe we should add resource concious CI configuration on GitLab.
2021-04-12AUTHORS: update authors information as of 2021-04-12.Yukihiro "Matz" Matsumoto
2021-04-12proc.h: add type cast to silence warning; ref #5402Yukihiro "Matz" Matsumoto
2021-04-10Merge branch 'io_getbyte' close #5389Yukihiro "Matz" Matsumoto
2021-04-10io.rb: fix `IO#getbyte` to work with UTF-8 characters; ref #5389Yukihiro "Matz" Matsumoto
2021-04-10io.rb: add `IO#readbyte`; ref #5389Yukihiro "Matz" Matsumoto
2021-04-10io.c: add assertions to `mrb_io_bufread()`; ref #5389Yukihiro "Matz" Matsumoto
2021-04-10io.rb: `@buf` should be empty on `EOF`; #4983, #5389Yukihiro "Matz" Matsumoto
2021-04-10Add IO#getbytetake-cheeze
2021-04-10Rename some internal functions; ref #5401Yukihiro "Matz" Matsumoto
2021-04-09Merge pull request #5400 from jbampton/fix-spellingYukihiro "Matz" Matsumoto
chore: fix spelling
2021-04-09Merge pull request #5401 from dearblue/mcallYukihiro "Matz" Matsumoto
Reorganize `mcall()` in `mruby-method`
2021-04-08mruby-config.bat: update as the shell version. [ci skip]Yukihiro "Matz" Matsumoto