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
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
settings can be applied before rb_safe_level() is available.
* internal.h (rb_gc_set_params): ditto.
* ruby.c (process_options): Apply GC tuning early during boot process
so boot-time allocations can benefit. This also benefits any code
loaded in via `ruby -r`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_gc_set_params because it's only used in ruby internal.
* internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
alias function.
* gc.c: ditto.
* ruby.c: use ruby_gc_set_params.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): load statically linked extensions before
rubygems, because of ext/thread.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): use gem_prelude instead of requiring
rubygems directly when --enable=gems is given.
* Makefile.in (DEFAULT_PRELUDES): always use gem_prelude regardless of
--disable-rubygems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (Process.argv0): New method to return the original value
of $0. [Feature #8696]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (Process.setproctitle): New method to change the title of
the running process that is shown in ps(1). [Feature #8696]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (rb_load_internal): use rb_load_file_str() to keep path
encoding.
* load.c (rb_require_safe): search in OS path encoding for Windows.
* ruby.c (rb_load_file_str): load file with keeping path encoding.
* win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
path is encoded in UTF-8. [ruby-core:56136] [Bug #8676]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
RBASIC_CLASS(obj) macro which returns a class of `obj'.
This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
This function reveal interal (hidden) object by rb_obj_hide().
Note that do not change class before and after hiding.
Only permitted example is:
klass = RBASIC_CLASS(obj);
rb_obj_hide(obj);
....
rb_obj_reveal(obj, klass);
TODO: API design. rb_obj_reveal() should be replaced with others.
TODO: modify constified variables using cast may be harmful for
compiler's analysis and optimizaton.
Any idea to prohibt inserting RBasic::klass directly?
If rename RBasic::klass and force to use RBASIC_CLASS(obj),
then all codes such as `RBASIC(obj)->klass' will be
compilation error. Is it acceptable? (We have similar
experience at Ruby 1.9,
for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
each time.
`bind->env' may update after `eval()'.
[Bug #7536]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for parser.
reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
[Bug #7562]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options, process_options, ruby_process_options): take
care of the case argc is 0, and check if argv has NULL.
[ruby-core:49889] [Bug #7423]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (usage): wrap description lines if options are too long.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (rb_get_expanded_load_path): cache the expanded load
path. This saves 4KB of allocation and some stats for every
element of the load path (so nearly a MB in my Rails app)
on every require.
* load.c (rb_construct_expanded_load_path): ensure that $LOAD_PATH
entries are frozen strings. The user must mutate $LOAD_PATH
itself rather than its individual entries.
* vm_core.h (rb_vm_struct): add fields.
* vm.c (rb_vm_mark): mark new fields.
* ruby.c (process_options): modify $LOAD_PATH directly rather than
its elements.
Patch by Greg Price.
[ruby-core:47970] [Bug #7158]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (usage, process_options): show more info in --help.
[EXPREIMENTAL] [ruby-core:48072] [Bug #7184]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in (LIBDIR_BASENAME): use configured libdir value to fix
--enable-load-relative on systems where libdir is not default value,
overridden in config.site files. [ruby-core:47267] [Bug #6903]
* ruby.c (ruby_init_loadpath_safe): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
US-ASCII for encdb and transdb.
* load.c (search_required): keep encoding of feature name. set
loading path to filesystem encoding. [Bug #6377][ruby-core:44750]
* ruby.c (add_modules, require_libraries): assume default external
encoding as well as ARGV.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (proc_options): show version only once even if -v and
--verbose are given together.
http://twitter.com/d6rkaiz/status/233491797085671424
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
we do not need to disclose intermediate representation of program.
The program embedding CRuby should use rb_eval_string family.
* include/ruby/ruby.h (ruby_opaque_t): removed.
(ruby_compile_main_from_file, ruby_compile_main_from_string,
ruby_eval_main): removed.
* eval.c (ruby_eval_main_internal): became ruby_exec_internal() again.
(ruby_eval_main): removed.
* ruby.c (PREPARE_PARSE_MAIN) reverted.
(parse_and_compile_main, ruby_compile_main_from_file,
ruby_compile_main_from_string): removed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
th->base_block is information for (a) parsing, (b) compiling
and (c) setting up the frame to execute the program passed by
`eval' method. For example, (1) parser need to know up-level
variables to detect it is variable or method without paren.
Befor (a), (b) and (c), VM set th->base_block by passed bindng
(or previous frame information). After execute (a), (b) and (c),
VM should clear th->base_block. However, if (a), (b) or (c)
raises an exception, then th->base_block is not cleared.
Problem is that the uncleared value th->balo_block is used for
irrelevant iseq compilation. It causes SEGV or critical error.
I tried to solve this problem: to clear them before exception,
but finally I found out that it is difficult to do it (Ruby
program can be run in many places).
Because of this background, I set th->base_block before
compiling iseq and restore it after compiling.
Basically, th->base_block is dirty hack (similar to global
variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
set th->base_block before compation and restore it after
compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h: public symbols must have default visibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for few years because:
* NODE is no longer accessible.
* rb_iseq_eval_main crashes without preparing with rb_thread_t.
* some existing APIs calls exit(3) without giving the opportunity to
finalize or handle errors to the client.
* No general-purpose function to compile a source to an iseq are
published in the public headers.
This commit solves the problems.
* include/ruby/ruby.h: Grouped APIs for embedding CRuby interpreter.
(ruby_setup, ruby_compile_main_from_file,
ruby_compile_main_from_string, ruby_eval_main,
ruby_set_script_name): new APIs to embed CRuby.
(ruby_opaque_t) Opaque pointer to an internal data, to NODE or iseq
in particular.
* eval.c (ruby_setup): Similar to ruby_init but returns an error code
instead of exit(3) on error.
(ruby_eval_main): Similar to ruby_exec_node but returns the
evaluation result.
(ruby_eval_main_internal): renamed from ruby_exec_internal.
* ruby.c (toplevel_context): new helper function.
(PREPARE_EVAL_MAIN): moved.
(process_options): refactored with new functions.
(parse_and_compile_main) new helper funciton.
(ruby_compile_main_from_file, ruby_compile_main_from_string) new API
(ruby_set_script_name): new API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Fixes --with-static-linked-ext.
Patch by Google Inc. [ruby-core:45073].
* Makefile.in (ENCOBJS, EXTOBJS): New variables to specify static
linked libraries. Also reintroduces extinit.o, introduces encinit.o
introduces encinit.o
* common.mk: Builds static libraries rather than shared objects if
specified.
* configure.in (LD): new substitution.
Avoids PIE if s
* enc/depend: Supports static linked libraries
(libencs, libenc, libtrans): New target.
* enc/encinit.c.erb: new template to generate the initialization of
statically linked encodings.
* enc/make_encmake.rb (--module): new flag to specify whether static
or dynamic.
* transcode_data.h (TRANS_INIT): New macro to get rid of the name
collision of encoding initializers and transcoder initializers.
* ext/extmk.rb: Fixes the behavior on $extstatic is true.
* lib/mkmf.rb (clean-static): new target to clean up static linked
libraries.
* ruby.c (process_options): New initializes statically linked
encodings here.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
not to use S_ISDIR(). [Feature #2408][ruby-core:26925]
* ruby.c (load_file_internal): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_load_fail): use path as a string, not char*.
* internal.h: (rb_load_fail): moved from ruby/intern.h.
* ruby.c (load_file_internal): fname cannot be NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instance variable to the LoadError exception.
* load.c: call rb_loaderror_with_path so that the missing path is
added to the exception.
* ruby.c: call rb_loaderror rather than raising our own LoadError
exception.
* include/ruby/intern.h: add declaration for rb_loaderror_with_path.
* test/ruby/test_require.rb: add supporting test for LoadError#path
method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
needed by platform. calling open() was replaced by rb_cloexec_open()
at r33549, but the function expected UTF-8 pathname on Windows.
(open() expected "locale" pathname.)
reported by taco via IRC.
* ruby.c (load_file): change the type of the 2nd parameter to pass its
encoding to load_file_internal().
* ruby.c (process_options, rb_load_file): follow above change.
NOTE: we should pass encoding information to rb_load_file().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for MinGW. reported by Luis Lavena. [ruby-core:40526] [Bug #5516]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
before RUBYLIB, even if MANGLED_PATH is enabled. fixed#1679.
MANGLED_PATH is disabled by the default and will be removed
completely in the future.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
environment variables. based on a patch from funny-falcon at
https://gist.github.com/856296, but honors safe level.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (process_options): load rubygems if it is disabled but
--gem option is given.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
--enable=gems and --gem=disabled as an alias of --disable=gems.
Gem named "enabled" or "disabled" has already been reserved
legitimately for this purpose.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
scripts with stub.
* ruby.c (load_file_internal): assume xflag for exe file as well
as no-shebang file.
* tool/rbinstall.rb: install script programs.
* win32/mkexports.rb (Exports#initialize): alias ruby_sysinit for
stub.
* win32/stub.c: stub for scripts. [EXPERIMENTAL]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
required libraries by -r option should be the main script.
[ruby-core:23717]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
checking environ.
* ruby.c (get_arglen): duplicate environ area if setenv and unsetenv
are provided.
* ruby.c (set_arg0): keep empty strings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (ruby_init_loadpath_safe): TMP_RUBY_PREFIX should be
exec_prefix, not rubylibprefix. [ruby-core:28718]
* version.c (RUBY_LIB_PREFIX): fallback to RUBY_EXEC_PREFIX.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
path field into rb_iseq_t. The field contains a string representing
a path to corresponding source file. or nil when the iseq is created
from -e, stdin, eval, etc. This field is used for require_relative.
[ruby-dev:40004]
* load.c (rb_f_require_relative): add C implementation of
require_relative.
* prelude.rb (require_relative): get rid of Ruby implementation of
require_relative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
implemented. [ruby-dev:39853]
* ruby.c: --dump=parsetree and --dump=parsetree_with_comment options
added. This is just for debug or research purpose. Note that the
compatibility of these options are not supported at all.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
encoding because on resetting default_external because
Unix's filesystem encoding depends on default_external.
* encoding.c (enc_set_filesystem_encoding): added.
* ruby.c (process_options): don't call rb_filesystem_encoding
because filesystem encoding is reset when default_external
is reset.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ruby.c (add_modules, require_libraries, process_sflag):
* ruby.c (process_sflag): not process twice.
* ruby.c (moreswitches): get rid of possible overflow.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[ruby-core:23241].
gets rid of possible buffer overflow with realpath().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
instead of strcpy, strncpy and sprintf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
relative to libruby_so.
* ruby.c (ruby_init_loadpath_safe): added the case using dladdr().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* ext/dl/handle.c (rb_dlhandle_initialize): returns handle to
libruby if nil is given on Windows as dlopen.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
split from core version. [ruby-dev:37748]
* configure.in (RUBY_LIB_PATH, etc): moved actual version
dependent stuff to version.c.
* ruby.c (ruby_init_loadpath_safe): ditto.
* version.c (ruby_initial_load_paths): moved initial load path
version depending on version from ruby.c.
* version.h (RUBY_VERSION_{MAJOR,MINOR,TEENY}): now mean library
and API version, and reverted to 1.9.1. [ruby-dev:37889]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
flag with ungetting nothing.
* ruby.c (load_file_internal): rests EOF flag to make possible to
load from stdin after reading data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
parsing main or normal eval script.
* compile.c (rb_parse_in_main): return 1 if parsing main script.
(if parse_in_eval is negative value, it means main script)
* parse.y (yycompile0): check rb_parse_in_main() to accumulate
script text. Bug #848 [ruby-core:20450]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
it is needed.
* ruby.c (require_libraries): clear th->base_block before
require libraries.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm.c (vm_set_main_stack, rb_iseq_eval_main): added.
* parse.y (rb_parser_compile_file): fix to check parse_in_eval flag.
* eval.c (ruby_exec_node): use rb_iseq_eval_main()
instead of rb_iseq_eval().
* iseq.c (rb_iseq_new_main), vm_core.h: added.
main script (specified by -e or script name) should be run
under TOPLEVEL_BINDING using Kernel#eval. Above changes
simulate Kernel#eval behaviour. [ruby-dev:37240]
* compile.c (make_name_for_block): skip iseq except block type.
this fix is needed for [ruby-dev:37240], and also fixes
[ruby-dev:35392].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
only when auto looping options (-p/-n) is specified.
[ruby-core:20570]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e