* ruby.c (dladdr_path): dladdr is provided on recent cygwin, but
GetModuleFileNameW is used instead of it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
On DOSish systems, there is a warning message for \r\n line endings on shebang line.
Improve this message from "shebang line ends with \r may cause a problem"
to "shebang line ending with \r may cause problems".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58981 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file): move opened file to an argument, to reduce
open/close calls in the near future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (ruby_cmdline_options_t): reordered members and turned
simple flags into bit fields to reduce the size (136->104 on
LP64).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): encode script name to locale encoding
instead of associate, if UTF-8 path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal): define DATA here instead of ensure
func.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): dump specified informations all, not
only first one.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): retry after GC when the limit for open
file descriptors reached.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): FILE_ALT_SEPARATOR and EXEEXT are
config.status variables, not available in config.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): bind the open fd to an IO instance
before waiting FIFO, not to leak the fd if interrupted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): compare with EXEEXT instead of hard
coded name, and do not match with mere EXEEXT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): open in binary mode if available, as
parser deals with EOLs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* *.c: rename rb_funcall2 to rb_funcallv, except for extensions
which are/will be/may be gems. [Fix GH-1406]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Bug #12628]
This patch introduce many changes.
* Introduce concept of "Block Handler (BH)" to represent
passed blocks.
* move rb_control_frame_t::flag to ep[0] (as a special local
variable). This flags represents not only frame type, but also
env flags such as escaped.
* rename `rb_block_t` to `struct rb_block`.
* Make Proc, Binding and RubyVM::Env objects wb-protected.
Check [Bug #12628] for more details.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): rb_str_conv_enc() never set encoding
of the source string, but returns the string itself if the
conversion failed. then the instance variable does not need to
be set again.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_str_conv_enc() because the function might call rb_enc_associate()
internally. this fixes test failures on Windows introduced at r55260.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): convert -e script to the encoding
given by a command line option on Windows. assume it is the
expected encoding. [ruby-dev:49461] [Bug #11900]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c: cygwin does not use w32_cmdvector, command line can be
other than UTF-8. [ruby-dev:49519] [Bug #12184]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* parse.y (struct parser_params): move parse_in_eval flag from
rb_thread_t.
* parse.y (rb_parser_set_context): set parsing context, not only
mild error flag.
* iseq.c (rb_iseq_compile_with_option): the parser now refers no
thread local states to be restored.
* vm_eval.c (eval_string_with_cref): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c (rb_iseq_compile_with_option): make the parser in mild
error.
* load.c (rb_load_internal0): ditto.
* parse.y (yycompile0): return the error message within the error
to be raised. [Feature #11951]
* parse.y (parser_compile_error): accumulate error messages in the
error_buffer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (ruby_is_fd_loadable): now return -1 if loadable but
may block.
* ruby.c (open_load_file): wait to read by the result of
ruby_is_fd_loadable, without fstat.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
DATA is expected to be text mode, but there is no ways to make a
FD to text mode from binary mode.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): always open in binary mode if provided,
parser deals with CRs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54082 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (feature_option, debug_option, dump_option): remove an
extra comma from option lists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/ruby/test_rubyoptions.rb (test_shebang): adjust only
expected stderr as a warning, assertion has meaning on all
platforms.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal): warn if shebang line ends with a
carriage return.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal): simplify by local variables instead
of repeating RSTRING macros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal): remove a magic number, which means
the length of ruby_engine but the value is unknown in this file
since the variable is in a different file now. instead, strstr
should deal with it well, as far as ruby_engine does not contain
a space and a hyphen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c (rb_io_gets_internal): read one line from an IO without
setting ARGF.lineno.
* parse.y (lex_io_gets): use rb_io_gets_internal not to affect
$. global variable.
* ruby.c (load_file): no longer reset $.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): remove unnecessary context.
rb_parser_append_print and rb_parser_while_loop just append some
nodes and do not depend on the context.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (DEFAULT_FEATURES): debug features are no longer set
since r53791.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (feature_option, debug_option, dump_option): build
available list in warning messages from enum lists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (EACH_DUMPS): define the list of dumping feature names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (EACH_DEBUG_FEATURES): define the list of debug feature
names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (ADD_FEATURE_NAME): rename ADD_FEATURE, as it does not
add a feature, but just append a name to the message string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (feature_option): raise a runtime error if ambiguous
feature name is given, in the future. [Bug #12050]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53772 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (EACH_FEATURES): define the list of feature names.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (feature_option): show possible feature names when
unknown argument is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): parse and skip '-W' option and its
argument even if ignored.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): -W command line option should be able to
override -w in RUBYOPT environment variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal, ruby_process_options): share
ruby_engine instead of literal strings.
* version.c (Init_version): remove internal `ruby_engine_name`,
but set the VM program name in addition to the global constant.
* vm_backtrace.c (location_to_str, oldbt_init): use th eVM program
name always.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.h (rb_compile_option_struct): rename the member
frozen_string_literal_debug as debug_frozen_string_literal.
[Feature #11725]
* ruby.c (proc_options): do not set $DEBUG and $VERBOSE only if no
arguments is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): fix pointer overrun. do not advance argv
until it is valid.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (ruby_prog_init): [DOC] ARGV does not contain the name of
the executable. [ruby-core:71561] [Bug #11711]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): set instruction compilation options at
once, and set disabled options to false explicitly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
If this option is enabled, the modify error will be:
can't modify frozen String (RuntimeError) =>
can't modify frozen String, created at test.rb:3 (RuntimeError)
* iseq.h: add compile option frozen_string_literal_debug.
* compile.c: catch up this fix.
* error.c (rb_error_frozen): ditto.
* iseq.c (set_compile_option_from_hash): ditto.
* test/ruby/test_rubyoptions.rb: add a test for this fix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (open_load_file): disable O_NONBLOCK only when opened in
non-blocking mode, to get rid of LoadError on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Even if S_ISREG() is true, the file may be file on FUSE filesystem
or something. We can't assume O_NONBLOCK is safe.
Moreover, we should wait if the path is point to FIFO. That's
FIFO semantics. GVL should be transparent from ruby script.
Thus, just reopen without O_NONBLOCK for filling the requirements.
[Bug #11060][Bug #11559]
* ruby.c (loadopen_func): new for the above.
* file.c (ruby_is_fd_loadable): new. for checks loadable file type
of not.
* file.c (rb_file_load_ok): use ruby_is_fd_loadble()
* internal.h: add ruby_is_fd_loadble()
* common.mk: now, ruby.o depend on thread.h.
* test/ruby/test_require.rb
(TestRequire#test_loading_fifo_threading_success): new test.
This test successful case that loading from FIFO.
* test/ruby/test_require.rb
(TestRequire#test_loading_fifo_threading_raise): rename from
test_loading_fifo_threading. You souldn't rescue an exception
if you test raise or not.
Moreover, this case should be caught IOError because load(FIFO)
should be blocked until given any input.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file): unify each preparations and clean-ups by
merging load_file_internal and load_file_internal2, and remove
nested rb_protect and rb_ensure.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (load_file_internal): do not use O_NONBLOCK when
conflicting with O_ACCMODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (rb_file_load_ok): open in non-blocking mode withoout
releasing GVL. don't care about others than regular files and
directories. [ruby-dev:49272] [Bug #11559]
* ruby.c (load_file_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (name_match_p): allow option argument names to be
abbreviated for each words.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
option `--disable_did_you_mean`.
* gem_prelude.rb: now requires did_you_mean gem by default if available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h (rb_readlink): move the declaration.
* ruby.c (dladdr_path): rb_readlink now requires the result
encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
All contents of previous rb_iseq_t is in rb_iseq_t::body.
Remove rb_iseq_t::self because rb_iseq_t is an object.
RubyVM::InstructionSequence is wrapper object points T_IMEMO/iseq.
So RubyVM::ISeq.of(something) method returns different wrapper
objects but they point the same T_IMEMO/iseq object.
This patch is big, but most of difference is replacement of
iseq->xxx to iseq->body->xxx.
(previous) rb_iseq_t::compile_data is also located to
rb_iseq_t::compile_data.
It was moved from rb_iseq_body::compile_data.
Now rb_iseq_t has empty two pointers.
I will split rb_iseq_body data into static data and dynamic data.
* compile.c: rename some functions/macros.
Now, we don't need to separate iseq and iseqval (only VALUE).
* eval.c (ruby_exec_internal): `n' is rb_iseq_t (T_IMEMO/iseq).
* ext/objspace/objspace.c (count_imemo_objects): count T_IMEMO/iseq.
* gc.c: check T_IMEMO/iseq.
* internal.h: add imemo_type::imemo_iseq.
* iseq.c: define RubyVM::InstructionSequnce as T_OBJECT.
Methods are implemented by functions named iseqw_....
* load.c (rb_load_internal0): rb_iseq_new_top() returns
rb_iseq_t (T_IMEMO/iesq).
* method.h (rb_add_method_iseq): accept rb_iseq_t (T_IMEMO/iseq).
* vm_core.h (GetISeqPtr): removed because it is not T_DATA now.
* vm_core.h (struct rb_iseq_body): remove padding for
[Bug #10037][ruby-core:63721].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (show_usage_line): extract function to print one usage
line.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (dladdr_path): used only when load-relative is enabled.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (dladdr_path): replace the executable path with symlinked
real path. dladdr(3) on Linux returns the argv[0] as dli_fname
instead of the real path, for a symbol defined in the executable
file itself. [Bug #10776]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (ruby_require_internal): separate from rb_require_safe,
not to raise exceptions.
* ruby.c (process_options): remove unnatural encoding search.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options, ruby_script): transcode script name and
program name to locale encoding as well as argv.
[ruby-dev:48752] [Bug #10555]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (translit_char_bin): should not use code page dependent
CharNext on UTF-8 string. [ruby-dev:48752] [Bug #10555]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (ruby_set_argv): convert argv from UTF-8.
* win32/win32.c (rb_w32_sysinit, cmdglob, w32_cmdvector): convert
wide char command line to UTF-8 argv, and glob in UTF-8 so that
metacharacters would match multibyte characters.
[ruby-dev:48752] [Bug #10555]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options, load_file_internal2): should not
require other files when dump option is given.
[ruby-dev:48712] [Bug #10435]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (XCFLAGS): Add include path for NaCl libraries.
(XLDFLAGS): ditto.
(NACL_LIB_PATH): new stubstitution
* nacl/nacl-config.rb: support NACL_LIB_PATH
* nacl/package.rb: ditto.
* nacl/pepper_main.c: replace old implementations with nacl_io.
* nacl/GNUmakefile.in: link nacl_io to pepper_ruby
* ruby.c (rb_load_file): remove __attribute__((weak)) because the old
override hack was replaced with nacl_io.
* file.c (rb_file_load_ok): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (RUBY_NACL and others): Supports PNaCl.
* dln.c: replace the old hacky dynamic loading over HTTP with nacl_io.
* file.c: tenatively use access(2) instead of eaccess.
(rb_file_load_ok): weaken with attribute but not by postprocess.
* io.c (socket.h): now NaCl has socket.h
(flock): disable here instead of nacl/ioctl.h
* nacl/GNUmakefile.in (CC, LD, NM, AR, AS, RANLIB, OBJDUMP, OBJCOPY):
respect path to them if they are absolute.
This helps naclports to build ruby in their source tree.
(PROGRAM_NMF, .SUFFIXES): support .pnexe for PNaCl.
(ruby.o, file.o): move the hack to attributes in ruby.c and file.c
* nacl/ioctl.h: removed. move the hack to io.c.
* nacl/nacl-config.rb: support arm, pnacl and others.
* nacl/pepper_main.c: support build in a naclports tree.
* ruby.c (rb_load_file): weaken with attribute but not by postprocess.
The patch is by sbc@google.com and the Native Client Authors.
It is available at:
* 873ca4910a/ports/ruby/nacl.patch
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): reduce RARRAY_PTR_USE region, make the
path to be set before entering the region.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47257 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+ (load_file_internal): Invoke load_file_internal2 using rb_protect.
+ Close an opened FD if load_file_internal2 raises an exception.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (push_include_cygwin): drop older cygwin support.
* ruby.c (ruby_init_loadpath_safe): ditto, and always use String as
libpath buffer on Windows.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45614 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (rubylib_mangled_path): remove obsolete code, which has
been disabled since 5 years ago.
* man/ruby.1 (ENVIRONMENT): delete an obsolete variable to mangle
path, RUBYLIB_PREFIX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): check argc before dereference of argv, to get
rid of potential out-of-bound access.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e