path: root/ruby.c
AgeCommit message (Collapse)Author
16 hoursKeep libpath length non-negative [Bug #16784]HEADmasterYusuke Endoh
When runtime_libruby_path does not include '/', it attempts to call rb_str_resize with negative length. This change makes sure that the length non-negative. Co-Authored-By: xtkoba (Tee KOBAYASHI) <>
2021-02-20Fixed fallback ENABLE_VIRTUAL_TERMINAL_PROCESSING value [Bug #17639]YO4 (Yoshinao Muramatsu)
2021-01-24Moved --verbose, --verbose and --help options to last [ci skip]Nobuyoshi Nakada
2021-01-13Make warning values consistent [Bug #17523]Nobuyoshi Nakada
They should be affected, as well as `$VERBOSE`, by `-w`/`-W` options, not only in the main script but in scripts loaded by `-r` option too. Notes: Merged:
2020-12-26Ignore failure on unsupported fcntl to drop non-blocking modeNobuyoshi Nakada
Fixes Notes: Merged:
2020-12-21Enable escape sequence on Windows10 console via pager tooNobuyoshi Nakada
2020-12-18Use category: :deprecated in warnings that are related to deprecationJeremy Evans
Also document that both :deprecated and :experimental are supported :category option values. The locations where warnings were marked as deprecation warnings was previously reviewed by shyouhei. Comment a couple locations where deprecation warnings should probably be used but are not currently used because deprecation warning enablement has not occurred at the time they are called (RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K). Add assert_deprecated_warn to test assertions. Use this to simplify some tests, and fix failing tests after marking some warnings with deprecated category. Notes: Merged:
2020-12-16Ignore failure on unsupported fcntl to drop non-blocking modeNobuyoshi Nakada
Notes: Merged:
2020-12-10Make ruby -We the same as ruby -W -eJeremy Evans
This changes the behavior, which I'm not sure is acceptable. However, it's odd to allow an option to be combined, but change the behavior of the option when combined. Notes: Merged:
2020-12-08ruby.c: remove needless substitution of uencKenta Murata
uenc has already been initialized the top of the function.
2020-12-08Set default for Encoding.default_external to UTF-8 on Windows (#2877)Lars Kanis
* Use UTF-8 as default for Encoding.default_external on Windows * Document UTF-8 change on Windows to Encoding.default_external fix Notes: Merged-By: nurse <>
2020-11-23Initialize UTF-8 encoding first as it is used always nowNobuyoshi Nakada
2020-10-20Some global variables can be accessed from ractorsKoichi Sasada
Some global variables should be used from non-main Ractors. [Bug #17268] ```ruby # ractor-local (derived from created ractor): debug '$DEBUG' => $DEBUG, '$-d' => $-d, # ractor-local (derived from created ractor): verbose '$VERBOSE' => $VERBOSE, '$-w' => $-w, '$-W' => $-W, '$-v' => $-v, # process-local (readonly): other commandline parameters '$-p' => $-p, '$-l' => $-l, '$-a' => $-a, # process-local (readonly): getpid '$$' => $$, # thread local: process result '$?' => $?, # scope local: match '$~' => $~.inspect, '$&' => $&, '$`' => $`, '$\'' => $', '$+' => $+, '$1' => $1, # scope local: last line '$_' => $_, # scope local: last backtrace '$@' => $@, '$!' => $!, # ractor local: stdin, out, err '$stdin' => $stdin.inspect, '$stdout' => $stdout.inspect, '$stderr' => $stderr.inspect, ``` Notes: Merged:
2020-09-25Disable deprecation warning by the default [Feature #16345]Nobuyoshi Nakada
And `-w` option turns it on. Notes: Merged:
2020-09-07[Feature #17157] removed -T command line optionNobuyoshi Nakada
2020-06-29feature_option: do not goto into a branch卜部昌平
I'm not necessarily against every goto in general, but jumping into a branch is definitely a bad idea. Better refactor. Notes: Merged:
2020-06-23Improved error messages for mjit optionNobuyoshi Nakada
and default jit-verbose to 1 if no argument.
2020-05-16Defer initializationNobuyoshi Nakada
Defer initialization of extension libraries, loading prelude files and requiring files, and skip if dump options are given.
2020-05-15Merge pull request #3047 from mame/suppress-backtraceYusuke Endoh
Add `--suppress-backtrace=num` option to limit the backtrace length Notes: Merged-By: mame <>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged:
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged:
2020-05-02internal/process.h: add a no-warning simple wrapper for fork(2)Yusuke Endoh
As fork(2) is deprecated, its calls must be guarded by `COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)`. All usages of fork(2) in process have been alread guarded. A new call to fork(2) was added in ruby.c with f22c4ff359498ab342e4b6d6feb21af6004ee270. This caused a build failure on Solaris 11. It may hide a bug to guard big code unnecessarily, so this change introduces a simple wrapper "rb_fork" whose definition is guarded, and replaces all calls to fork(2) with the wrapper function.
2020-04-12Honor COLUMNS [Feature #16754]Nobuyoshi Nakada
Notes: Merged:
2020-04-12Hightlight usage [Feature #16754]Nobuyoshi Nakada
Notes: Merged:
2020-04-12Set up environment variable for pager [Feature #16754]Nobuyoshi Nakada
Notes: Merged:
2020-04-12PAGER without fork&exec too [Feature #16754]Nobuyoshi Nakada
Notes: Merged:
2020-04-12View the help message with PAGER [Feature #16754]Nobuyoshi Nakada
View the help message wth pager designed by RUBY_PAGER or PAGER environment variable, unless that value is empty. Notes: Merged:
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <>
2020-01-09io.c, ruby.c: include internal/variable.h for rb_gvar_readonly_setterYusuke Endoh
Same as 053f78e13988e9253d1f207bf5e23d9505112b32. emscripten requires a prototype declaration of rb_gvar_readonly_setter if it is refered as a function pointer.
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged:
2019-12-24Added `-W:experimental` to `--help` [Feature #16420]Nobuyoshi Nakada
2019-12-22Re-apply f85e8d2a8b keeping characters < 80Takashi Kokubun
2019-12-23Revert "Fixed misspellings"Yusuke Endoh
This reverts commit f85e8d2a8b2a37740334db4fd92ef820f05ddbc5. It violated the limit of width (> 80) and caused the test failure
2019-12-23Fixed misspellingsNobuyoshi Nakada
Fixed misspellings reported at [Bug #16437]
2019-12-20Added `-W:experimental` command line optionNobuyoshi Nakada
[Feature #16420]
2019-12-20Added -W: command line optionNobuyoshi Nakada
To manage `Warning[category]` flags. Only `-W:deprecated` and `-W:no-deprecated` are available now. [Feature #16345]
2019-12-20Added `FEATURE_SET_RESTORE` macroNobuyoshi Nakada
2019-12-11use compiled binary for gem_prelude.rb.Koichi Sasada
`gem_prelude.rb` is not compiled yet. This patch compile it to compiled binary. Notes: Merged:
2019-12-01Allow specifying arbitrary MJIT flags by --jit-debugTakashi Kokubun
This is a secret feature for me. It's only for testing and any behavior with this flag override is unsupported. I needed this because I sometimes want to add debug options but do not want to disable optimizations, for using Linux perf.
2019-11-18delete unused codes卜部昌平
Suppress compiler warnings.
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
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. Notes: Merged:
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged:
2019-10-04Refactor parser_params by removing "in_main" flagYusuke Endoh
The relation between parser_param#base_block and #in_main were very subtle. A main script (that is passed via a command line) was parsed under base_block = TOPLEVEL_BINDING and in_main = 1. A script loaded by Kernel#require was parsed under base_block = NULL and in_main = 0. If base_block is non-NULL and in_main == 0, it is parsed by Kernel#eval or family. However, we know that TOPLEVEL_BINDING has no local variables when a main script is parsed. So, we don't have to parse a main script under base_block = TOPLEVEL_BINDING. Instead, this change parses a main script under base_block = 0. If base_block is non-NULL, it is parsed by Kernel#eval or family. By this simplication, "in_main" is no longer needed. Notes: Merged:
2019-08-29drop-in type check for rb_define_global_function卜部昌平
We can check the function pointer passed to rb_define_global_function like we do so in rb_define_method. It turns out that almost anybody is misunderstanding the API.
2019-08-27rb_define_hooked_variable now free from ANYARGS卜部昌平
After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit uses rb_gvar_getter_t / rb_gvar_setter_t for rb_define_hooked_variable / rb_define_virtual_variable which revealed lots of function prototype inconsistencies. Some of them were literally decades old, going back to dda5dc00cff334cac373096d444a0fd59e716124.
2019-07-14ruby.c (name_match_p): remove unnecessary conditionYusuke Endoh
It always returns immediately when len was decremented to zero. So len is always positive. This change will suppress Coverity Scan warning.
2019-06-04* expand tabs.git
2019-06-04EOF by 2 ^D on a TTYNobuyoshi Nakada
Terminate the input from a TTY by 2 ^D at the middle of line, like as many programs, `cat`, `perl` and so on, do. By the first ^D, the line will be sent without a newline, and then EOF will be send by the next ^D.
2019-05-21Do not modify shared arrayNobuyoshi Nakada
[Bug #15821]
2019-03-30ruby.c: respect features by command linenobu
* ruby.c (process_options): feature options in command line arguments take precedence over options in RUBYOPT environment variable. [ruby-core:92052] [Bug #15738] git-svn-id: svn+ssh:// b2dd03c8-39d4-4d8f-98ff-823fe69b080e