Граф коммитов

361 Коммитов

Автор SHA1 Сообщение Дата
akr 59ba2bf0b6 * include/ruby/intern.h (rb_exec_arg_init): declared.
(rb_exec_arg_addopt): delared.
  (rb_exec_arg_fix): declared.
  (rb_exec_initarg): removed.
  (rb_exec_getargs): removed.
  (rb_exec_initarg2): removed.

* io.c (struct popen_arg): make execarg as a pointer.
  (popen_exec): follow popen_arg change.
  (pipe_open): add eargp argument.  extract argc and argv from eargp.
  use rb_exec_arg_addopt to add redirect options.
  (pipe_open_v): set up struct rb_exec_arg.
  (pipe_open_s): set up struct rb_exec_arg.

* process.c (rb_exec_arg_addopt): new function extracted from
  check_exec_options_i.
  (check_exec_options_i): use rb_exec_arg_addopt.
  (rb_check_exec_options): opthash is always a hash now.
  (rb_exec_getargs): make it static.
  (rb_exec_fillarg): renamed from rb_exec_initarg2.  don't set up
  redirect_fds.
  (rb_exec_arg_init): new function.
  (rb_exec_arg_fix): new function.
  (rb_f_exec): use rb_exec_arg_init and rb_exec_arg_fix.  use
  rb_exec_arg_addopt to set close_others option.
  (run_exec_options): make close_others by default.
  (rb_spawn_internal): use rb_exec_arg_init and rb_exec_arg_fix.  use
  rb_exec_arg_addopt to set close_others option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16222 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-28 00:11:46 +00:00
akr 514715250a * include/ruby/intern.h (rb_hash_dup): declared.
* hash.c (rb_hash_dup): new function.

* process.c (rb_spawn_internal): don't modify option hash.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 12:52:25 +00:00
nobu c59277cf39 * process.c (rb_cProcessTms, rb_cProcessStatus): renamed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16200 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 08:31:13 +00:00
akr 8e8095dd88 update spawn rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16197 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 17:01:57 +00:00
akr fe9b92f149 * process.c (rb_spawn_internal): new function to specify
default_close_others.
  (rb_spawn): specify default_close_others true.
  (rb_f_system): call rb_spawn_internal with default_close_others as
  false.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 15:50:24 +00:00
nobu 0023e16865 * process.c (rb_spawn): rb_exec_initarg() returns new argc and argv in
earg.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 06:35:48 +00:00
nobu d90fe02fb6 * process.c: suppress warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 05:45:28 +00:00
usa 62da750abe * include/ruby/win32.h: define mode_t for umask.
* process.c (check_exec_options_i, check_exec_fds, run_exec_options):
	  support "close_others" only when fork(2) is available.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-25 01:55:22 +00:00
akr 70c177c5f7 fix argument type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 15:34:15 +00:00
akr 34bb79c031 * process.c: include sys/stat.h for umask.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 15:16:38 +00:00
akr 278b63a3e4 * include/ruby/intern.h (rb_env_clear): declared.
(rb_io_mode_modenum): declared.
  (rb_close_before_exec): declared.
  (struct rb_exec_arg): add options and redirect_fds field.
  (rb_check_argv): removed.
  (rb_exec_initarg): declared.
  (rb_exec_getargs): declared.
  (rb_exec_initarg2): declared.
  (rb_fork): add third argument: fds.

* io.c (max_file_descriptor): new static variable to record maximum
  file descriptor ruby used.
  (UPDATE_MAXFD): new macro.
  (UPDATE_MAXFD_PIPE): new macro.
  (rb_io_mode_modenum): externed.
  (rb_sysopen): update max_file_descriptor.
  (rb_close_before_exec): new function.
  (popen_exec): redirection removed because it is done by extended
  spawn mechanism.
  (pipe_open): generate a hash for spawn options to specify
  redirections.
  (pipe_open_v): use rb_exec_getargs.
  (pipe_open_s): use rb_exec_getargs.
  (rb_io_initialize): update max_file_descriptor..

* process.c (hide_obj): new function.
  (check_exec_redirect_fd): new function.
  (check_exec_redirect): new function.
  (check_exec_options_i): new function.
  (check_exec_fds): new function.
  (rb_check_exec_options): new function.
  (check_exec_env_i): new function.
  (rb_check_exec_env): new function.
  (rb_exec_getargs): new function.
  (rb_exec_initarg2): new function.
  (rb_exec_initarg): new function.
  (rb_f_exec): use rb_exec_initarg.
  (intcmp): new function.
  (run_exec_dup2): new function.
  (run_exec_close): new function.
  (run_exec_open): new function.
  (run_exec_pgroup): new function.
  (run_exec_rlimit): new function.
  (run_exec_options): new function.
  (rb_exec): call run_exec_options.
  (move_fds_to_avoid_crash): new function.
  (pipe_nocrash): new function.
  (rb_fork): use pipe_nocrash to avoid file descriptor conflicts.
  (rb_spawn): use rb_exec_initarg.
  (rlimit_resource_name2int): extracted from rlimit_resource_type.
  (rlimit_type_by_hname): new function.
  (rlimit_type_by_lname): new function.
  (rlimit_resource_type): use rlimit_type_by_hname.
  (proc_daemon): add fds argument for rb_fork.

* hash.c (rb_env_clear): renamed from env_clear and externed.

[ruby-dev:34086]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 14:46:39 +00:00
nobu 89c408704b * enumerator.c (enumerator_each, enumerator_with_index): suppress
warnings.

* pack.c (pack_unpack): ditto.

* process.c (rb_syswait): ditto.

* re.c (rb_reg_prepare_enc, rb_reg_prepare_re,
  rb_reg_adjust_startpos): ditto.

* regparse.c (onig_name_to_group_numbers): ditto.

* missing/vsnprintf.c (BSD_vfprintf): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-22 13:49:43 +00:00
akr 30d2565b4e * process.c (rlimit_resource_value): use NUM2RLIM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-22 17:53:07 +00:00
akr 861219ce4a fix doc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-09 01:04:46 +00:00
matz 39787ea14d * numeric.c (fix_to_s): avoid rb_scan_args() when no argument
given. 
* bignum.c (rb_big_to_s): ditto.
* enum.c (enum_first): ditto.
* eval_jump.c (rb_f_catch): ditto.
* io.c (rb_obj_display): ditto.
* class.c (rb_obj_singleton_methods): ditto.
* object.c (rb_class_initialize): ditto.
* random.c (rb_f_srand): ditto.
* range.c (range_step): ditto.
* re.c (rb_reg_s_last_match): ditto.
* string.c (rb_str_to_i): ditto.
* string.c (rb_str_each_line): ditto.
* string.c (rb_str_chomp_bang): ditto.
* string.c (rb_str_sum): ditto.

* string.c (str_modifiable): declare inline.
* string.c (str_independent): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-05 05:22:17 +00:00
akr 84c9041f9b * process.c (Init_process): share bignum objects for RLIM_INFINITY,
RLIM_SAVED_MAX and RLIM_SAVED_CUR if they are equal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-25 04:58:47 +00:00
akr 310735aa4a * process.c (rlimit_resource_type): new function.
(rlimit_resource_value): new function.
  (proc_getrlimit): use rlimit_resource_type to accept
  symbol and string as resource type.
  (proc_setrlimit): use rlimit_resource_type and rlimit_resource_value
  to accept symbol and string as resource type and values.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-22 16:12:32 +00:00
nobu 1af31107c9 * configure.in: moved broken syscall checks from process.c etc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 03:27:46 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
akr 041e829127 * include/ruby/encoding.h (rb_isascii): defined.
(rb_isalnum): ditto.
  (rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.

* include/ruby/st.h (st_strcasecmp): declared.
  (st_strncasecmp): ditto.

* st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp.
  (st_strcasecmp): defined.
  (st_strncasecmp): ditto.

* include/ruby/ruby.h: include include/ruby/encoding.h.
  (ISASCII): use rb_isascii.
  (ISPRINT): use rb_isprint.
  (ISSPACE): use rb_isspace.
  (ISUPPER): use rb_isupper.
  (ISLOWER): use rb_islower.
  (ISALNUM): use rb_isalnum.
  (ISALPHA): use rb_isalpha.
  (ISDIGIT): use rb_isdigit.
  (ISXDIGIT): use rb_isxdigit.
  (TOUPPER): defined.
  (TOLOWER): ditto.
  (STRCASECMP): ditto.
  (STRNCASECMP): ditto.

* dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c,
  transcode.c, ext/readline/readline.c: use locale insensitive
  functions.  [ruby-core:14662]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 12:24:04 +00:00
akr 58d8e1450f fix typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 12:55:50 +00:00
akr cd047935e4 enable document of Kernel#system.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-23 15:39:09 +00:00
ko1 de1dbf4829 * process.c (rb_f_fork): Unsupport Kernel.fork() on NetBSD.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 10:16:39 +00:00
matz da42035b09 * signal.c (ruby_signal): use SA_SIGINFO if available.
[ ruby-Patches-6418 ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-30 14:49:45 +00:00
matz d154b1c346 * process.c (rb_f_system): returns nil on execution failure.
[ruby-core:13715]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 18:21:39 +00:00
ko1 3453b2bd0e * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
should be at vm_core.h.
* include/ruby/ruby.h, intern.h: remove type rb_thread_t.
* include/ruby/intern.h: change rb_unblock_function_t,
  rb_unblock_function_t.
* file.c, process.c: apply above changes.
* thread.c, thread_pthread.ci, thread_win32.ci: ditto.
* io.c: support blocking open (2). [ruby-core:13614]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 10:47:53 +00:00
ko1 25c0cb981a * include/ruby/ruby.h: introduce 2 macros:
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
  Rename RFloat#value -> RFloat#double_value.
  Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
  pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
  time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 16:00:53 +00:00
akr 8c3658fd1b * process.c (pst_to_s): returns a string such as "pid 10220 exit 1"
instead of "256".  [ruby-dev:32053]
  (pst_inspect): change format
  "#<Process::Status: pid=10220,exited(1)>" to
  "#<Process::Status: pid 10220 exit 1>".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-15 01:31:11 +00:00
usa 57831cebe1 * process.c (Init_process): win32 has our own WNOHANG definition, so
remove unnecessary #ifdef guard.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13626 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-04 11:47:18 +00:00
nobu 4d1450fc96 * process.c (rb_waitpid): no needs to poll. [ruby-dev:31871]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-26 18:17:43 +00:00
nobu bf6575ef62 * io.c (popen_exec), process.c (rb_spawn): stop other threads before
exec.  [ruby-core:08262]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-20 08:28:03 +00:00
ko1 6244e502cc * thread.c: fix Mutex to be interruptable lock.
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
  prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
  (to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
  with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-27 16:48:14 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
nobu 42850db14b * configure.in (group_member): check if presents.
* configure.in (XCFLAGS): add _GNU_SOURCE on linux.

* file.c (group_member): use system routine if available.

* process.c: moved _GNU_SOURCE macro to Makefile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-23 08:25:12 +00:00
nobu 115a3d21e4 * eval_error.ci (ruby_error_print): call error_print.
* eval_jump.ci, process.c (rb_exit, rb_f_exit, rb_f_abort): moved.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-18 07:44:51 +00:00
nobu 6e0c6ac3be * process.c (detach_process_watcher): should not pass the pointer
to an auto variable to the thread to be created.  pointed and
  fix by KUBO Takehiro <kubo at jiubao.org>  [ruby-dev:30618]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-18 06:59:54 +00:00
ko1 686535d403 * process.c (proc_geteuid): fix strange cast. [ruby-dev:31417]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-15 04:42:19 +00:00
ko1 6b6bf4dd48 * blockinlining.c: remove "yarv" prefix.
* array.c, numeric.c: ditto.
* insnhelper.ci, insns.def, vm_evalbody.ci: ditto.
* yarvcore.c: removed.
* yarvcore.h: renamed to core.h.
* cont.c, debug.c, error.c, process.c, signal.c : ditto.
* ext/probeprofiler/probeprofiler.c: ditto.
* id.c, id.h: added.
* inits.c: ditto.
* compile.c: rename internal functions.
* compile.h: fix debug flag.
* eval.c, object.c, vm.c: remove ruby_top_self.
  use rb_vm_top_self() instead.
* eval_intern.h, eval_load: ditto.
* gc.c: rename yarv_machine_stack_mark() to
  rb_gc_mark_machine_stack().
* insnhelper.h: remove unused macros.
* iseq.c: add iseq_compile() to create iseq object
  from source string.
* proc.c: rename a internal function.
* template/insns.inc.tmpl: remove YARV prefix.
* thread.c:
* vm.c (rb_iseq_eval): added.
* vm.c: move some functions from yarvcore.c.
* vm_dump.c: fix to remove compiler warning.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-12 04:25:46 +00:00
nobu 883fadf9af * process.c (proc_getgroups): use GIDT2NUM for rb_gid_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-26 07:39:04 +00:00
ko1 f58eb1e276 * eval.c: remove ruby_current_node and change eval() prototype.
fix to use rb_sourcefile/line() instead of ruby_sourcefile/line.
* error.c, eval_error.ci, eval_load.c, eval_safe.ci, gc.c,
  include/ruby/intern.h, parse.y, process.c, ruby.c: ditto.
* vm.c: fix spaces.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12608 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 20:33:04 +00:00
ko1 97ba019c94 * vm.c: some refactoring.
* rename th_* to vm_*.
  * remove unused variables functions.
  * add prototypes.
* blockinlining.c, compile.c, cont.c, eval.c, eval_intern.h,
  eval_jump.h, eval_load.c, inits.c, insns.def, iseq.c, parse.y,
  proc.c, process.c, signal.c, thread.c, vm.c, vm_dump.c,
  vm_evalbody.ci, yarvcore.c, yarvcore.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-24 15:42:41 +00:00
ryan 8964a01bae Fixed [UG]ID::eid=. Fixes bug # 10370
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-12 02:32:28 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
nobu e1aec4aed8 * process.c (rb_fork): flush stdouts always before fork(2).
fixed: [ruby-dev:30612]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-20 00:12:51 +00:00
nobu c034fce5ce * process.c (rb_waitpid_blocking, rb_waitpid): use UBF feature.
* thread_win32.ci (rb_w32_wait_events_blocking): blocking version.

* win32/win32.c (waitpid): use rb_w32_wait_events_blocking().




git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 09:43:40 +00:00
nobu bf6efa76c0 * configure.in (pid_t, uid_t, gid_t): check if defined.
* intern.h, process.c, rubyio.h, ext/etc/etc.c, ext/pty/pty.c: use
  rb_{pid,uid,gid}_t instead of plain int.  [ruby-dev:30376]

* ext/etc/extconf.rb (PIDT2NUM, NUM2PIDT, UIDT2NUM, NUM2UIDT, GIDT2NUM,
  NUM2GIDT): moved to configure.in.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-18 04:11:57 +00:00
ko1 ea2dd2e805 * process.c: fix to use rb_status_line_set/get/clear().
* eval_intern.h: fix line break.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-08 06:48:34 +00:00
ko1 44aef0b53f * this commit is a result of refactoring. only renaming functions,
moving definitions place, add/remove prototypes, deleting
  unused variables and removing yarv.h.
  This commit doesn't change any behavior of ruby/vm.
* yarv.h, common.mk: remove yarv.h (contents are moved to yarvcore.h).
* error.c, eval_intern.h: include yarvcore.h instead yarv.h
* rename some functions:
  * debug.[ch]: debug_*() -> ruby_debug_*()
  * iseq.c: iseq_*() -> rb_iseq_*(), ruby_iseq_disasm()
  * iseq.c: node_name() -> ruby_node_name()
  * vm.c: yarv_check_redefinition_opt_method() ->
    rb_vm_check_redefinition_opt_method()
* some refactoring with checking -Wall.
* array.c: remove rb_ary_ptr() (unused) and remove unused
  local variables.
* object.c: add a prototype of rb_mod_module_exec().
* eval_intern.h (ruby_cref): set it inline.
* eval_load.c (rb_load), yarvcore.c: yarv_load() -> rb_load_internal().
* parse.y: add a prototype of rb_parse_in_eval() (in eval.c).
* process.c: add a prototype of rb_thread_stop_timer_thread() (in thread.c).
* thread.c: remove raw_gets() function (unused) and fix some format
  mismatch (format mismatchs have remained yet. this is todo).
* thread.c (rb_thread_wait_fd_rw): fix typo on label name.
* thread_pthread.ci: comment out codes with USE_THREAD_CACHE.
* vm.c (rb_svar, rb_backref_get, rb_backref_get,
  rb_lastline_get, rb_lastline_set) : moved from yarvcore.c.
* vm.c (yarv_init_redefined_flag): add a prototype and rename
  yarv_opt_method_table to vm_opt_method_table.
* vm.c (rb_thread_eval): moved from yarvcore.c.
* yarvcore.c: remove unused global variables and fix to use nsdr().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11652 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-07 01:25:05 +00:00
ko1 8ee7d0767f * blockinlining.c, compile.c, compile.h, error.c, eval.c,
eval_intern.h, eval_jump.h, eval_load.c, eval_method.h,
  eval_safe.h, gc.c, insnhelper.h, insns.def, iseq.c, proc.c,
  process.c, signal.c, thread.c, thread_pthread.ci, thread_win32.ci,
  vm.c, vm.h, vm_dump.c, vm_evalbody.ci, vm_macro.def,
  yarv.h, yarvcore.h, yarvcore.c: change type and macro names:
  * yarv_*_t -> rb_*_t
  * yarv_*_struct -> rb_*_struct
  * yarv_tag -> rb_vm_tag
  * YARV_* -> RUBY_VM_*
* proc.c, vm.c: move functions about env object creation
  from proc.c to vm.c.
* proc.c, yarvcore.c: fix rb_cVM initialization place.
* inits.c: change Init_ISeq() order (after Init_VM).
* ruby.h, proc.c: change declaration place of rb_cEnv
  from proc.c to ruby.c.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-06 19:00:03 +00:00
ko1 27172b8e6f * intern.h: prepare rb_last_status_get() and rb_last_status_set().
Use these functions instead of rb_last_status ([ruby-dev:30264]).
* process.c: define above functions.
* ext/pty/pty.c: use above functins.
* io.c (pipe_finalize): ditto.
* process.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-05 16:22:38 +00:00
ko1 025cfde57d * eval_thread.c, common.mk: remove eval_thread.c.
* yarvcore.c: rename cYarvThread to rb_cThread.
* gc.c: remove YARV_* prefix.
* gc.h: add an include guard and prototype of rb_gc_set_stack_end().
* inits.c: fix to ANSI prototype style and reorder Init_*().
* io.c (pipe_finalize): TODO: comment out last_status.
* process.c, yarvcore.h: fix to use yarv_vm_t#last_status instead of
  rb_last_status and make last_status_get() to access $?.
* yarvcore.c (vm_mark): mark yarv_vm_t#last_status.
* ruby.h: add declarations of rb_cISeq and rb_cVM.
* thread.c: move eval_thread.c codes to thread.c and remove yarv_*
  function prefix.
* thread.c (thread_start_func_2): use yarv_thread_t#first_func if
  it is not null.
* vm.c: fix copyright year.
* yarvcore.c (Init_vm): rename to Init_VM().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-05 12:21:01 +00:00
ko1 84f8da1157 * thread.c (rb_thread_stop_timer_thread(), rb_thread_reset_timer_thread(),
rb_thread_start_timer_thread()): added.
* thread_pthread.ci: add a native_thread_join() and move
  rb_thread_reset_timer_thread() definition to thread.c.
* thread_win32.ci: ditto
* process.c: fix before_exec(), after_exec() to stop timer thread
  (and restart timer thread if exec failed).  and fix to reset
  timer thread information when forked child process starts
  (to fix [ruby-core:09822]).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11509 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-07 09:47:52 +00:00
ko1 a3e1b1ce7e * Merge YARV
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 15:02:22 +00:00
matz 52817c3654 * lib/cgi.rb (CGI::out): specify -x option for nkf.
* lib/cgi.rb (CGI::out): should not convert utf-8 implicitly using
  NKF.  it is too Japanese centric.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 07:40:46 +00:00
matz 2156870525 * ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
  (RARRAY_PTR): ditto.

* array.c: use RARRAY_LEN and RARRAY_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:42:08 +00:00
usa 5b5e4a6fc1 * file.c (test_identical, rb_file_s_truncate): use RSTRING_PTR and
RSTRING_STR.

* io.c (pipe_open, rb_io_reopen): ditto.

* process.c (proc_spawn_n, rb_spawn): ditto.

* util.c (ruby_add_suffix): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 11:24:44 +00:00
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00
nobu efff5bc946 * process.c (proc_setuid, proc_setgid, proc_seteuid, proc_setegid):
get rid of bogus implementations on Mac OS X.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10733 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-16 02:46:10 +00:00
akr 1f84a162df ansificated.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-13 09:44:16 +00:00
matz cb657243da * process.c (rb_proc_times): rename hz to hertz to avoid name
crash on AIX.  [ruby-dev:29126]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-25 04:58:15 +00:00
usa 553bba0b47 * process.c (rb_f_system): shouldn't block SIGCHLD if it's not
exist.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-18 14:55:28 +00:00
matz 6b87ac68db * process.c (rb_f_system): block SIGCHLD during the process
execution, like glibc system(3) does.  [ruby-talk:202361]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-18 14:36:15 +00:00
matz ddbebabd25 * process.c (rb_f_system): call rb_sys_fail(0) if rb_last_status
is nil.  [ruby-talk:202361]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-18 05:48:01 +00:00
nobu ac2348271a * process.c (rb_proc_times): use sysconf(_SC_CLK_TCK) value prior to
HZ and CLK_TCK.  fixed: [ruby-talk:200293]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-06 14:30:20 +00:00
akr bd7bd6427b Define Process.getrlimit and Process.setrlimit even if
getrlimit and setrlimit are not exist.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-15 06:43:29 +00:00
matz 9b383bd6cf * sprintf.c (rb_str_format): allow %c to print one character
string (e.g. ?x).

* lib/tempfile.rb (Tempfile::make_tmpname): put dot between
  basename and pid.  [ruby-talk:196272]
* parse.y (do_block): remove -> style block.

* parse.y (parser_yylex): remove tLAMBDA_ARG.

* eval.c (rb_call0): binding for the return event hook should have
  consistent scope.  [ruby-core:07928]

* eval.c (proc_invoke): return behavior should depend whether it
  is surrounded by a lambda or a mere block.

* eval.c (formal_assign): handles post splat arguments.

* eval.c (rb_call0): ditto.

* st.c (strhash): use FNV-1a hash.

* parse.y (parser_yylex): removed experimental ';;' terminator.

* eval.c (rb_node_arity): should be aware of post splat arguments.

* eval.c (rb_proc_arity): ditto.

* parse.y (f_args): syntax rule enhanced to support arguments
  after the splat.

* parse.y (block_param): ditto for block parameters.

* parse.y (f_post_arg): mandatory formal arguments after the splat
  argument.

* parse.y (new_args_gen): generate nodes for mandatory formal
  arguments after the splat argument.

* eval.c (rb_eval): dispatch mandatory formal arguments after the
  splat argument.

* parse.y (args): allow more than one splat in the argument list.

* parse.y (method_call): allow aref [] to accept all kind of
  method argument, including assocs, splat, and block argument.

* eval.c (SETUP_ARGS0): prepare block argument as well.

* lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931]

* eval.c (error_line): print receivers true/false/nil specially.

* eval.c (rb_proc_yield): handles parameters in yield semantics.

* eval.c (nil_yield): gives LocalJumpError to denote no block
  error.

* io.c (rb_io_getc): now takes one-character string.

* string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo
  hashing algorithm.

* string.c (rb_str_aref): str[0] now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* parse.y (parser_yylex): ?c now returns 1 character string,
  instead of a fixnum.	[Ruby2]

* string.c (rb_str_aset): no longer support fixnum insertion.

* eval.c (umethod_bind): should not update original class.
  [ruby-dev:28636]

* eval.c (ev_const_get): should support constant access from
  within instance_eval().  [ruby-dev:28327]

* time.c (time_timeval): should round for usec floating
  number.  [ruby-core:07896]

* time.c (time_add): ditto.

* dir.c (sys_warning): should not call a vararg function
  rb_sys_warning() indirectly.	[ruby-core:07886]

* numeric.c (flo_divmod): the first element of Float#divmod should
  be an integer. [ruby-dev:28589]

* test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.

* re.c (rb_reg_initialize): should not allow modifying literal
  regexps.  frozen check moved from rb_reg_initialize_m as well.

* re.c (rb_reg_initialize): should not modify untainted objects in
  safe levels higher than 3.

* re.c (rb_memcmp): type change from char* to const void*.

* dir.c (dir_close): should not close untainted dir stream.

* dir.c (GetDIR): add tainted/frozen check for each dir operation.

* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
  typo fixed.  a patch from Florian Gross <florg at florg.net>.

* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
  event_hooks.	no guarantee for arbitrary hook deletion.
  [ruby-dev:28632]

* util.c (ruby_strtod): differ addition to minimize error.
  [ruby-dev:28619]

* util.c (ruby_strtod): should not raise ERANGE when the input
  string does not have any digits.  [ruby-dev:28629]

* eval.c (proc_invoke): should restore old ruby_frame->block.
  thanks to ts <decoux at moulon.inra.fr>.  [ruby-core:07833]
  also fix [ruby-dev:28614] as well.

* signal.c (trap): sig should be less then NSIG.  Coverity found
  this bug.  a patch from Kevin Tew <tewk at tewk.com>.
  [ruby-core:07823]

* math.c (math_log2): add new method inspired by
  [ruby-talk:191237].

* math.c (math_log): add optional base argument to Math::log().
  [ruby-talk:191308]

* ext/syck/emitter.c (syck_scan_scalar): avoid accessing
  uninitialized array element.	a patch from Pat Eyler
  <rubypate at gmail.com>.  [ruby-core:07809]

* array.c (rb_ary_fill): initialize local variables first.  a
  patch from Pat Eyler <rubypate at gmail.com>.	 [ruby-core:07810]

* ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
  type_tag.  a patch from Pat Eyler <rubypate at gmail.com>.
  [ruby-core:07808]

* ext/socket/socket.c (make_hostent_internal): accept ai_family
  check from Sam Roberts <sroberts at uniserve.com>.
  [ruby-core:07691]

* util.c (ruby_strtod): should not cut off 18 digits for no
  reason.  [ruby-core:07796]

* array.c (rb_ary_fill): internalize local variable "beg" to
  pacify Coverity.  [ruby-core:07770]

* pack.c (pack_unpack): now supports CRLF newlines.  a patch from
  <tommy at tmtm.org>.	[ruby-dev:28601]

* applied code clean-up patch from Stefan Huehner
  <stefan at huehner.org>.  [ruby-core:07764]

* lib/jcode.rb (String::tr_s): should have translated non
  squeezing character sequence (i.e. a character) as well.  thanks
  to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]

* ext/socket/socket.c: document update patch from Sam Roberts
  <sroberts at uniserve.com>.  [ruby-core:07701]

* lib/mathn.rb (Integer): need not to remove gcd2.  a patch from
  NARUSE, Yui <naruse at airemix.com>.	[ruby-dev:28570]

* parse.y (arg): too much NEW_LIST()

* eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.

* eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
  [ruby-dev:28585]

* parse.y (arg): use NODE_ARGSCAT for placeholder.

* lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
  mathew <meta at pobox.com>.  [ruby-core:07738]

* variable.c (rb_const_set): raise error when no target klass is
  supplied.  [ruby-dev:28582]

* prec.c (prec_prec_f): documentation patch from
  <gerardo.santana at gmail.com>.  [ruby-core:07689]

* bignum.c (rb_big_pow): second operand may be too big even if
  it's a Fixnum.  [ruby-talk:187984]

* README.EXT: update symbol description.  [ruby-talk:188104]

* COPYING: explicitly note GPLv2.  [ruby-talk:187922]

* parse.y: remove some obsolete syntax rules (unparenthesized
  method calls in argument list).

* eval.c (rb_call0): insecure calling should be checked for non
  NODE_SCOPE method invocations too.

* eval.c (rb_alias): should preserve the current safe level as
  well as method definition.

* process.c (rb_f_sleep): remove RDoc description about SIGALRM
  which is not valid on the current implementation. [ruby-dev:28464]

 Thu Mar 23 21:40:47 2006  K.Kosako  <sndgk393 AT ybb.ne.jp>

* eval.c (method_missing): should support argument splat in
  super.  a bug in combination of super, splat and
  method_missing.  [ruby-talk:185438]

* configure.in: Solaris SunPro compiler -rapth patch from
  <kuwa at labs.fujitsu.com>.  [ruby-dev:28443]

* configure.in: remove enable_rpath=no for Solaris.
  [ruby-dev:28440]

* ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior
  of converting  OLE Variant object with VT_ARRAY|VT_UI1 and Ruby
  String object.

* ruby.1: a clarification patch from David Lutterkort
  <dlutter at redhat.com>.  [ruby-core:7508]

* lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
  directories.	a patch from Eric Hodel <drbrain at segment7.net>.
  [ruby-core:07423]

* eval.c (rb_clear_cache_by_class): clearing wrong cache.

* ext/extmk.rb: use :remove_destination to install extension libraries
  to avoid SEGV.  [ruby-dev:28417]

* eval.c (rb_thread_fd_writable): should not re-schedule output
  from KILLED thread (must be error printing).

* array.c (rb_ary_flatten_bang): allow specifying recursion
  level.  [ruby-talk:182170]

* array.c (rb_ary_flatten): ditto.

* gc.c (add_heap): a heap_slots may overflow.  a patch from Stefan
  Weil <weil at mail.berlios.de>.

* eval.c (rb_call): use separate cache for fcall/vcall
  invocation.

* eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local
  functions.

* eval.c (rb_mod_local): a new method to specify newly added
  visibility "local".

* eval.c (search_method): search for local methods which are
  visible only from the current class.

* class.c (rb_class_local_methods): a method to list local methods.

* object.c (Init_Object): add BasicObject class as a top level
  BlankSlate class.

* ruby.h (SYM2ID): should not cast to signed long.
  [ruby-core:07414]

* class.c (rb_include_module): allow module duplication.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-09 21:20:17 +00:00
aamine baf0ba4588 * process.c: new method Process.exec. [ruby-dev:28107]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-27 05:10:38 +00:00
akr a27ce746ad document that fork doesn't copy other threads
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-20 03:30:47 +00:00
matz 22f1926644 * range.c (rb_range_beg_len): should return Qfalse for non-range
object.

* pack.c (EXTEND16): [ruby-dev:27383]

* eval.c (set_trace_func): add rb_secure(4) to prevent adding
  tracing function.

* lib/delegate.rb: document update from James Edward Gray II
  <james@grayproductions.net>.  [ruby-core:05942]

* process.c (proc_daemon): should restrict execution on levels
  higher than $SAFE=2.  suggested by URABE Shyouhei
  <shyouhei@ice.uec.ac.jp>.

* lib/forwardable.rb: replaced by new implementation from
  <Daniel.Berger@qwest.com>.  [ruby-core:05899]

* file.c (path_check_0): disallow sticky world writable directory
  in PATH (and $LOAD_PATH).  [ruby-dev:27226]

* numeric.c (fix_idiv): 1.div(1.0) should return integer value.
  [ruby-dev:27235]

* lib/yaml.rb: require 'yaml/constants'.  [ruby-core:5776]

* lib/xmlrpc/client.rb (XMLRPC::Client::do_rpc): add charset
  information to content-type header.[ruby-core:5127]

* lib/xmlrpc/server.rb (CGIServer::serve): ditto.

* lib/xmlrpc/server.rb (ModRubyServer::serve): ditto.

* lib/xmlrpc/server.rb (WEBrickServlet::service): ditto.

* test/dbm/test_dbm.rb (TestDBM::test_s_open_error): remove
  test_s_open_error test to detect duplicate open.
  [ruby-dev:27202]

* eval.c (splat_value): use to_a to splat non Array object.

* object.c (nil_to_a): remove nil.to_a.  [experimental]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-10-05 16:15:16 +00:00
akr dd5564b5fd * process.c (proc_setrlimit): make the third argument (rlim_max)
optional.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-24 16:36:11 +00:00
ocean ca32aea6a2 * dir.c: changed `foo (*bar)_((boo))' to `foo (*bar)(boo)`.
* enumerator.c, eval.c, gc.c, intern.h, io.c, process.c, ruby.c,
  ruby.h, signal.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 08:30:16 +00:00
ocean 08c1738c51 * bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
  gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
  node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
  rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
  util.c, util.h, variable.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 06:32:32 +00:00
ocean dda5dc00cf * array.c: moved to ANSI function style from K&R function style.
(used protoize on windows, so still K&R remains on #ifdef part of
   other platforms. And  `foo _((boo))' stuff is still there)
   [ruby-dev:26975]

* bignum.c, class.c, compar.c, dir.c, dln.c, dmyext.c, enum.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c,
  io.c, main.c, marshal.c, math.c, numeric.c, object.c, pack.c,
  prec.c, process.c, random.c, range.c, re.c, regcomp.c, regenc.c,
  regerror.c, regexec.c, regparse.c, regparse.h, ruby.c, signal.c,
  sprintf.c, st.c, string.c, struct.c, time.c, util.h, variable.c,
  version.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-12 10:44:21 +00:00
matz 40a77284e5 * merged a patch from Takahiro Kambe <taca@back-street.net> to
support DragonFly BSD.  [ruby-dev:26984]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-08 06:00:56 +00:00
ocean 76d6f560c9 * process.c (proc_detach, proc_setmaxgroups): missing argument type
declaration. (I recomment ANSI-style function)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9057 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-08-31 01:40:56 +00:00
nobu 6524f34a26 * sprintf.c (rb_vsprintf, rb_sprintf): new functions return new String,
using missing/vsnprintf.c.  [ruby-dev:26580]

*  missing/vsnprintf.c: made the output changeable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-07-23 01:02:18 +00:00
matz 639bd5e78f * eval.c (rb_eval): pre-evaluate argument for unambiguous
evaluation order.  [ruby-dev:26383]

* lib/delegate.rb (Delegator::method_missing): forward unknown
  method to the destination.  suggested by
  <christophe.poucet@gmail.com>.  [ruby-talk:146776]

* process.c (detach_process_watcher): terminate process watcher
  thread right after rb_waitpid() succeed.  [ruby-talk:146430]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-30 06:20:09 +00:00
ocean 08133b1344 * dir.c, eval.c, parse.y, process.c, ruby.c: avoid warning "unused
variable" [ruby-dev:26387]

* dir.c (glob_helper): avoid warning "enumeration value `RECURSIVE'
  not handled in switch" [ruby-dev:26392]

(patch from Kazuhiro NISHIYAMA)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-06-28 13:08:32 +00:00
nobu a1ce08c5b3 * process.c (proc_spawn_v): use rb_w32_aspawn on Win32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-16 13:42:59 +00:00
nobu 642ddf7201 * configure.in: Check for the availability of pid_t, gid_t and uid_t and
remove AC_TYPE_UID_T.  fixed: [ruby-core:04745]

* defines.h: Remove pid_t typedef.

* ruby.h: Define rb_pid_t, rb_gid_t and rb_uid_t in accordance with
 the available system types.

* process.c: Change instances of pid_t and gid_t to their rb_*
 counterparts.

* ext/pty/pty.c: Change pid_t to rb_pid_t.

* vms/config.h: Define HAVE_{P,G,U}ID_T to 1.

* win32/Makefile.sub: Remove #define for {g,u}id_t.

* win32/win32.c: Change pid_t to rb_pid_t.

* wince/Makefile.sub: Remove #define for {g,u}id_t.

* wince/sys/types.h: Remove definitions of {p,g,u}id_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-05-14 14:57:53 +00:00
matz 70bbad3cfd * array.c: replace rb_protect_inspect() and rb_inspecting_p() by
rb_exec_recursive() in eval.c.

* eval.c (rb_exec_recursive): new function.

* array.c (rb_ary_join): use rb_exec_recursive().

* array.c (rb_ary_inspect, rb_ary_hash): ditto.

* file.c (rb_file_join): ditto.

* hash.c (rb_hash_inspect, rb_hash_to_s, rb_hash_hash): ditto.

* io.c (rb_io_puts): ditto.

* object.c (rb_obj_inspect): ditto

* struct.c (rb_struct_inspect): ditto.

* lib/set.rb (SortedSet::setup): a hack to shut up warning.
  [ruby-talk:132866]

* lib/time.rb (Time::strptime): add new function.  inspired by
  [ruby-talk:132815].

* lib/parsedate.rb (ParseDate::strptime): ditto.

* regparse.c: move st_*_strend() functions from st.c.  fixed some
  potential memory leaks.

* exception error messages updated.  [ruby-core:04497]

* ext/socket/socket.c (Init_socket): add bunch of Socket
  constants.  Patch from Sam Roberts <sroberts@uniserve.com>.
  [ruby-core:04409]

* array.c (rb_ary_s_create): no need for negative argc check.
  [ruby-core:04463]

* array.c (rb_ary_unshift_m): ditto.

* lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass
  of StandardError class, not Exception class.  [ruby-core:04429]

* parse.y (fcall_gen): lvar(arg) will be evaluated as
  lvar.call(arg) when lvar is a defined local variable. [new]

* object.c (rb_class_initialize): call inherited method before
  calling initializing block.

* eval.c (rb_thread_start_1): initialize newly pushed frame.

* lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE.
  fixed: [ruby-core:04444]

* eval.c (is_defined): NODE_IASGN is an assignment.

* ext/readline/readline.c (Readline.readline): use rl_outstream
  and rl_instream.  [ruby-dev:25699]

* ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check
  [ruby-dev:25675]

* misc/ruby-mode.el: [ruby-core:04415]

* lib/rdoc/generators/html_generator.rb: [ruby-core:04412]

* lib/rdoc/generators/ri_generator.rb: ditto.

* struct.c (make_struct): fixed: [ruby-core:04402]

* ext/curses/curses.c (window_color_set): [ruby-core:04393]

* ext/socket/socket.c (Init_socket): SO_REUSEPORT added.
  [ruby-talk:130092]

* object.c: [ruby-doc:818]

* parse.y (open_args): fix too verbose warnings for the space
  before argument parentheses.  [ruby-dev:25492]

* parse.y (parser_yylex): ditto.

* parse.y (parser_yylex): the first expression in the parentheses
  should not be a command.  [ruby-dev:25492]

* lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330]

* object.c (Init_Object): remove Object#type.  [ruby-core:04335]

* st.c (st_foreach): report success/failure by return value.
  [ruby-Bugs-1396]

* parse.y: forgot to initialize parser struct.  [ruby-dev:25492]

* parse.y (parser_yylex): no tLABEL on EXPR_BEG.
  [ruby-talk:127711]

* document updates - [ruby-core:04296], [ruby-core:04301],
  [ruby-core:04302], [ruby-core:04307]

* dir.c (rb_push_glob): should work for NUL delimited patterns.

* dir.c (rb_glob2): should aware of offset in the pattern.

* string.c (rb_str_new4): should propagate taintedness.

* env.h: rename member names in struct FRAME; last_func -> callee,
  orig_func -> this_func, last_class -> this_class.

* struct.c (rb_struct_set): use original method name, not callee
  name, to retrieve member slot.  [ruby-core:04268]

* time.c (time_strftime): protect from format modification from GC
  finalizers.

* object.c (Init_Object): remove rb_obj_id_obsolete()

* eval.c (rb_mod_define_method): incomplete subclass check.
  [ruby-dev:25464]

* gc.c (rb_data_object_alloc): klass may be NULL.
  [ruby-list:40498]

* bignum.c (rb_big_rand): should return positive random number.
  [ruby-dev:25401]

* bignum.c (rb_big_rand): do not use rb_big_modulo to generate
  random bignums.  [ruby-dev:25396]

* variable.c (rb_autoload): [ruby-dev:25373]

* eval.c (svalue_to_avalue): [ruby-dev:25366]

* string.c (rb_str_justify): [ruby-dev:25367]

* io.c (rb_f_select): [ruby-dev:25312]

* ext/socket/socket.c (sock_s_getservbyport): [ruby-talk:124072]

* struct.c (make_struct): [ruby-dev:25249]

* dir.c (dir_open_dir): new function.  [ruby-dev:25242]

* io.c (rb_f_open): add type check for return value from to_open.

* lib/pstore.rb (PStore#transaction): Use the empty content when a
  file is not found.  [ruby-dev:24561]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-04 06:47:45 +00:00
usa 13388ff264 * process.c (NUM2RLIM, RLIM2NUM): Without SIZEOF_RLIM_T is not error.
fixed: [ruby-dev:25346]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-27 05:39:27 +00:00
nobu a68e68b227 * process.c (SIZEOF_RLIM_T): err if size of rlim_t is not set.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-23 14:43:30 +00:00
nobu 4155f97bb0 * process.c (proc_setgroups): check if the argument lenght is
modified.  fixed: [ruby-dev:25285]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-23 14:36:53 +00:00
eban 19f57ce144 * process.c (rb_spawn): support for DJGPP.
* lib/mkmf.rb (VPATH): specify the implicit path separator for DJGPP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-08 11:14:53 +00:00
matz aa92750f27 * process.c (proc_setgroups): [ruby-dev:25081]
* re.c (rb_reg_eqq): document fix.  [ruby-talk:122541]

* io.c (io_fread): take VALUE argument.

* ext/socket/socket.c (sock_connect): use rb_str_new4().
  [ruby-dev:25052]

* eval.c (rb_yield_0): [ruby-dev:25051]

* io.c (io_write): remove rb_str_locktmp().  [ruby-dev:25050]

* io.c (io_fwrite): takes VALUE string as an argument.
  [ruby-dev:25050]

* ext/socket/socket.c (sock_connect): remove rb_str_locktmp().
  [ruby-dev:25050]

* ext/socket/socket.c (udp_connect): [ruby-dev:25045]

* ext/socket/socket.c (udp_bind): ditto.

* ext/socket/socket.c (udp_send): ditto.

* ext/socket/socket.c (bsock_send): ditto.

* ext/socket/socket.c (s_recvfrom): ditto.

* hash.c (rb_hash_hash): should provide "hash" method where "eql?"
  is redefined.  [ruby-talk:122482]

* ext/socket/socket.c (bsock_setsockopt): [ruby-dev:25039]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06 15:31:26 +00:00
eban ee40e23864 * configure.in (ac_cv_sizeof_rlim_t): setup for DJGPP.
* io.c (is_socket, shutdown): define dummy macros for DJGPP.

* process.c: use SIZEOF_RLIM_T instead of HAVE_RLIM_T for DJGPP.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06 14:04:05 +00:00
akr 04f36c2bba * rubyio.h, intern.h, io.c, file.c, process.c, ext/socket/socket.c,
ext/pty/pty.c, ext/io/wait/wait.c, ext/openssl/ossl_ssl.c:
  Use own buffering mechanism instead of stdio.

* io.c, ext/stringio/stringio.c, test/ruby/ut_eof.rb:
  EOF flag removed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-12-06 08:40:30 +00:00
matz b28b7933a8 * process.c (proc_getpgrp): prohibit for $SAFE=2.
[ruby-dev:24899]

* process.c (get_pid): ditto.  [ruby-dev:24904]

* process.c (get_ppid): ditto.

* array.c (rb_ary_delete): defer rb_ary_modify() until actual
  modification.  [ruby-dev:24901]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-18 03:45:23 +00:00
akr 6c8ffdbf32 * process.c (proc_getrlimit, proc_setrlimit): add rb_secure(2) to
methods of Process.{getrlimit,setrlimit}
  patched by Kazuhiro NISHIYAMA  <zn@mbf.nifty.com>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-17 10:12:19 +00:00
akr 8f1c92af4f * process.c (proc_getrlimit): new function for Process.getrlimit.
(proc_setrlimit): new function for Process.setrlimit.
  [ruby-dev:24834]

* configure.in: check rlim_t and its size.  check setrlimit.

* ruby.h (NUM2ULL): new macro.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7264 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-14 10:06:16 +00:00
eban d84edcfd73 * process.c (rb_f_exec): should check whether prog is NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-11-01 02:49:06 +00:00
matz 8db864c999 * io.c (rb_f_open): create copy of popen specifier. [ruby-dev:24656]
* string.c (rb_str_locktmp): lock string temporarily.

* string.c (str_independent): add tmplock check.

* io.c (io_write): lock output string temporarily.
  [ruby-dev:24649]

* io.c (io_write): use rb_str_locktmp().

* io.c (read_all): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-31 17:37:52 +00:00
naruse a8966861e8 On NetBSD don't use setruid() and setrgid().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-31 14:37:08 +00:00
matz fbb88b011a * io.c (rb_io_mode_flags): preserve append mode flag.
[ruby-dev:24436]

* io.c (rb_io_modenum_mode): do not use external output buffer.

* string.c (rb_str_justify): differ pointer retrieval to prevent
  padding string modification.  [ruby-dev:24434]

* range.c (range_each_func): allow func to terminate loop by
  returning RANGE_EACH_BREAK.

* range.c (member_i): use RANGE_EACH_BREAK. [ruby-talk:114959]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-06 07:40:06 +00:00
matz 1b4d97ddba * string.c (rb_str_sum): string may be altered. [ruby-dev:24381]
* eval.c (rb_f_eval): defer pointer retrieval to prevent unsafe
  sourcefile string modification.  [ruby-dev:24373]

* io.c (io_read): block string buffer modification during
  rb_io_fread() by freezing it temporarily. [ruby-dev:24366]

* io.c (rb_io_s_popen): mode argument may be altered.
  [ruby-dev:24375]

* file.c (rb_file_s_basename): ext argument may be altered.
  [ruby-dev:24377]

* enum.c (enum_sort_by): use NODE instead of 2 element arrays.
  [ruby-dev:24378]

* string.c (rb_str_chomp_bang): StringValue() may change the
  receiver.  [ruby-dev:24371]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6976 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-10-01 15:56:05 +00:00
dave 141dae12c5 Add documentation to fork()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-21 15:13:53 +00:00
akr 44abd80865 * ext/zlib/zlib.c (gzfile_read_raw): call readpartial at first.
(Zlib::GzipReader#readpartial): new method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-19 18:42:32 +00:00
nobu c0a2f6effe * process.c (rb_proc_exec): label cannot precede variable declarations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-09-01 10:28:45 +00:00
nobu e8d486e119 * process.c (rb_proc_exec): strip trailing spaces. [ruby-dev:24143]
* win32/win32.c (CreateChild): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-27 01:14:30 +00:00
matz 67232b2151 * io.c (rb_io_reopen): should clear allocated OpenFile. pointed
out by Guy Decoux. [ruby-core:03288]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6781 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-08-17 09:02:40 +00:00
matz eabd490119 * re.c (rb_reg_match_m): add optional second argugment "pos" to
specify match start point.  [ruby-core:03203]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-17 06:28:10 +00:00
nobu 63dedc7de4 * io.c (rb_io_popen): update the document for the first argument and
exceptions.

* process.c (rb_f_exec, rb_f_system): update the document for
  exceptions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-06-29 01:17:39 +00:00
ocean 45c445941b * process.c: Recover wrongly removed spaces at end of the lines.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-21 02:50:15 +00:00
ocean 1f4513af45 * process.c(rb_spawn): fix SEGV at "p system('command line here')"
(may happen only in bccwin32) [ruby-dev:23380]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-21 01:28:19 +00:00
nobu d0f38773d1 * process.c (pst_success_p): new method Process::Status#success?.
[ruby-dev:23385]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-15 15:02:12 +00:00
nobu b3db09df79 * process.c (pst_success_p): new method Process::Status#success?.
[ruby-dev:23385]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-15 10:53:12 +00:00
nobu d952e33003 * array.c, enum.c, eval.c, file.c, io.c, numeric.c, object.c, prec.c,
process.c, re.c, string.c: typos in RDoc comments.  [ruby-core:02783]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-14 04:06:52 +00:00
nobu 846f087a07 * process.c (rb_exec): follow older behavior if close-on-exec is not
available.

* process.c (rb_fork): protect from exceptions while waiting failed
  process, if status is given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-29 11:17:21 +00:00
nobu 5aad820604 * io.c (pipe_open): erred program name should be reported by
exceptions, instead of the first argument.

* process.c (rb_spawn): ditto.

* process.c (proc_spawn_v): use first argument as program name.

* win32/win32.c (rb_w32_aspawn): ditto.

* win32/win32.c (CreateChild): search executable file if no program
  name given.

* lib/drb/extservm.rb (invoke_service_command): use Process.spawn.
  [ruby-dev:23103]

* lib/rdoc/ri/ri_display.rb (setup_pager): use IO.popen.
  [ruby-dev:23086], [ruby-dev:23103]

* lib/rdoc/diagram.rb (convert_to_png): ditto.

* lib/rdoc/generators/chm_generator.rb (compile_project): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-03-02 07:30:35 +00:00
nobu 1eafe8b157 * process.c (rb_f_exec): get rid of SEGV when exec failed for command
in single string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-25 17:35:13 +00:00
nobu 56e2c5243f * process.c (rb_f_exec): get rid of SEGV when exec failed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-25 17:19:16 +00:00
nobu 03d8c88b87 * configure.in: check functions, fork spawnv.
* io.c (rb_io_s_popen): accept argv not only single command line.

* process.c (rb_proc_exec_n): export.

* process.c (rb_check_argv): check if arguments are safe to invoke.

* process.c (rb_fork): retry to fork.

* process.c (rb_spawn): spawn child process asynchronously.

* process.c (rb_f_system): raise an exception if the command could not
  execute.

* win32/win32.c (rb_w32_argv_size): count necessary size for joined
  arguments.

* win32/win32.c (rb_w32_join_argv): join arguments with quoting.

* win32/win32.c (rb_w32_pipe_exec, rb_w32_spawn, rb_w32_aspawn):
  accept program name adding to command line.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-16 06:45:32 +00:00
nobu 4f5b070378 * process.c (detach_process_watcher): return the last status.
[ruby-dev:22841]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-02-09 07:30:17 +00:00
dave b4d94277bb Add HTML formatter to ri
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-11 17:34:05 +00:00
eban 973c2ad00d * eval.c, object.c, process.c, re.c: don't use C++ style comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-08 02:21:28 +00:00
dave 88c127c19b Finish documenting internal stuff. See Changelog for other details
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-01-02 06:01:12 +00:00
eban 79444dbdb9 * win32/win32.h: define execv() using do_aspawn().
* process.c (proc_exec_v): remove #ifdef's which stopped needing.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-12-10 04:00:07 +00:00
nobu e788706235 * eval.c (rb_f_exit), process.c (rb_f_exit_bang): use VALUEs not but
TYPEs.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-27 15:47:33 +00:00
nobu 99fb5f4871 * eval.c (rb_f_exit), process.c (rb_f_exit_bang): treat true as
success, false as failure.  [ruby-dev:22067]

* eval.c (rb_f_abort, rb_thread_switch), process.c (rb_f_system): use
  ANSI macro instead of hard coded value.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-27 15:34:53 +00:00
matz a4934a42cb * io.c (read_all): fptr->f may be NULL, if IO is closed in the
signal handler.

* io.c (io_read): ditto.

* string.c (get_pat): remove 1.8.0 warning code.

* string.c (rb_str_match): extend warning until 1.8.2.

* string.c (rb_str_match2): ditto.

* class.c (class_instance_method_list): remove 1.8.0 warnings.
  method_list now recurs.  [ruby-dev:21816]

* class.c (rb_obj_singleton_methods): ditto.

* array.c (rb_ary_select): remove select with block.
  [ruby-dev:21824]

* hash.c (rb_hash_select): ditto.

* hash.c (env_select): ditto.

* re.c (match_select): ditto.

* struct.c (rb_struct_select): ditto.

* process.c (check_uid_switch): remove duplicated error messages.

* process.c (check_gid_switch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4892 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-11-04 09:13:57 +00:00
usa f1ab0d3cab * process.c (rb_f_system): fixed lack of security check before
calling do_spawn() on win32. [ruby-talk:84555]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-30 00:34:30 +00:00
matz 1184373d86 * string.c (str_new4): should not preserve FL_TAINT status in the
internal shared string. [ruby-dev:21601]

* string.c (rb_str_new4): ditto.

* eval.c: use EXIT_SUCCESS and EXIT_FAILURE for exit values.

* process.c: ditto. [ruby-dev:38521]

* lib/debug.rb (debug_command): should enter emacs mode when
  assigned any value to the environment variable "EMACS".
  On Meadow, (getenv "EMACS") is "meadow".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4749 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-13 13:05:24 +00:00
nobu 5c547fd3e2 * signal.c (ruby_signal_name): adjust to the prototype.
* process.c (pst_inspect): ditto.

* ext/etc/etc.c (Init_etc): typo.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-10-01 15:14:23 +00:00
akr 77d7066abe * process.c (pst_inspect): describe stopped process "stopped".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-30 02:31:24 +00:00
matz 13ac4447f6 * eval.c (rb_eval): while/until should not capture break unless
they are destination of the break.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-30 00:21:14 +00:00
matz 4699b4afbb * eval.c (rb_thread_atfork): wrong format specifier.
[ruby-dev:21428]

* process.c (pst_inspect): better description.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-09-29 02:44:49 +00:00
eban 6f8f8959b7 * process.c (p_gid_sw_ensure): return VALUE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-31 13:57:38 +00:00
nagai 803a130207 * process.c (p_gid_sw_ensure): lack of function type
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-31 13:29:54 +00:00
nagai 24ff3f4448 * doc/ChangeLog-1.8.0: add changes of Ruby/Tk
* ext/tcltklib/tcltklib.c : some methods have no effect if on slave-IP
* ext/tcltklib/tcltklib.c : can create a interpreter without Tk
* ext/tcltklib/tcltklib.c : bug fix on handling exceptions
* ext/tcltklib/MANUAL.euc : modify
* ext/tk/lib/tk.rb : freeze some core modules
* ext/tk/lib/multi-tk.rb : more secure
* ext/tk/lib/tk.rb: TkVariable.new(array) --> treat the array as the
  Tk's list
* ext/tk/lib/tk.rb: improve accessibility of TkVariable object
* ext/tk/lib/tk.rb, ext/tk/lib/tkfont.rb, ext/tk/lib/tkcanvas.rb,
  ext/tk/lib/tktext.rb : fix bug of font handling
* ext/tk/lib/tkfont.rb TkFont.new() accepts compound fonts
* process.c: bug fix
* process.c: add rb_secure(2) to methods of Process::{UID,GID,Sys}
* process.c: deny handling IDs during evaluating the block given to
  the Process::{UID,GID}.switch method


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-29 08:34:14 +00:00
nagai c1c4b6b501 * modify macro to detect 'MacOS X' based on [ruby-talk:77849]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-03 02:55:52 +00:00
nagai baf02b9a63 * (bug fix) preprocessor errors occur on OpenBSD-current
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-08-01 18:51:10 +00:00
matz 85911c410a * ext/socket/socket.c (tcp_s_gethostbyname): was using
uninitialized size_t value. [ruby-talk:76946]

* Minor cleanups.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-25 05:36:55 +00:00
matz 5dd2b7102c * gcc -Wall clean-up.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4151 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-24 18:33:50 +00:00
nagai fd46a1da0a process.c : unify indentation
configure.in : add --enable-setreuid option
tcltklib.c : TclTkIp.new accepts 'ip-name' and 'options'
             ( e.g. TclTkIp.new('FOO', '-geometry 500x200 -use 0x2200009') )
tk.rb      : support arguments of TclTkIp.new
             ( see TkCore::IP_NAME, TkCore::IP_OPTS )
tk*.rb     : preparations for multi-Tk interpreter support


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-23 16:07:35 +00:00
nagai 3e8d70c95c process.c, configure.in :
* add a module for raw syscalls to control UID/GID
  * add modules for portable UID/GID control


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-23 02:39:46 +00:00
matz 9ef8a2a5db * lib/matrix.rb: remove elements conversion to_f, to_i, to_r.
* lib/cgi/session/pstore.rb: add new file.

* process.c (proc_getgroups, proc_setmaxgroups): fix typo.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-15 07:35:14 +00:00
matz 373a59b95b * lib/irb.rb (IRB::Irb::eval_input): warn and exit if $SAFE >=3
after input evaluation.

* lib/irb.rb (IRB::Irb::eval_input): untaint input string.  now
  irb works for levels 1 and 2.

* ext/syck/rubyext.c (syck_loader_transfer): should not use
  rb_cProc directly, since type_proc may be Proc, Block, or
  Method.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-10 05:22:17 +00:00
nobu 1fe598da35 * configure.in: checks presence of grp.h and setgroups().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-09 10:02:36 +00:00
nobu 31094808f9 * process.c (proc_getgroups, proc_setgroups): raise
NotImplementedError unless available.  [ruby-talk:73014]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3920 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-09 04:27:17 +00:00
matz 9481face42 * parse.y (value_expr0): class and module statements should not be
warned for "void value expression". [ruby-talk:72989]

* gc.c (add_final): should determine type by respond_to?

* gc.c (define_final): ditto.

* io.c (rb_io_ctl): should not depend on respond_to?

* range.c (range_step): rb_check_string_type().

* process.c (proc_setgroups): new functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3918 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-06-07 15:34:31 +00:00
matz 85dd7bb0ef * eval.c (load_dyna): clear ruby_errinfo. (ruby-bugs-ja PR#409)
* io.c (read_all): make str empty if given. (ruby-bugs-ja PR#408)

* io.c (io_read): ditto.

* io.c (rb_io_sysread): ditto.

* range.c: do not override min and max.

* sprintf.c (remove_sign_bits): octal left most digit for negative
  numbers may be '3'. (ruby-bugs-ja PR#407)

* sprintf.c (rb_f_sprintf): should prefix sign bits if bignum is
  negative, using sign_bits().

* eval.c (avalue_to_mrhs): split argument passing and assignment
  conversion.

* eval.c (svalue_to_mrhs): ditto.

* eval.c (avalue_to_svalue): avalue_to_svalue([[1,2]]) should be
  [[1,2]], not [1,2] to wrap-around.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-20 06:27:22 +00:00
matz 9d77639f30 * parse.y (dsym): :"symbol string" style should not contain `\0'.
* process.c (proc_detach): new method Proc#detach(pid) which
  create background watcher thread to issue waitpid. [new]

* process.c (rb_detach_process): utility function to detach
  process from C code.

* ext/pty/pty.c (pty_finalize_syswait): terminate watcher thread,
  and detach child process (by creating new idle waitpid watcher
  thread).

* ext/pty/pty.c (pty_syswait): may lost signal stopped child.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3561 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-03-07 05:59:42 +00:00
michal 9df466b287 Updated Copyrights of Matz to 2003.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-16 07:34:03 +00:00
matz 6d481a4ae4 * hash.c (env_clear): new Hash compatible method.
* hash.c (env_shift): ditto.

* hash.c (env_invert): ditto.

* hash.c (env_replace): ditto.

* hash.c (env_update): ditto.

* array.c (rb_ary_join): dispatch based on "to_str".

* array.c (rb_ary_times): ditto.

* array.c (rb_ary_equal): ditto.

* process.c (rb_f_exec): dispatch based on "to_ary".

* eval.c (umethod_bind): exact class match is not required.  relax
  the restriction to subclasses.

* eval.c (rb_eval): call "inherited" before executing class body.

* class.c (rb_define_class): call "inherited" after defining the
  constant.

* class.c (rb_define_class_under): ditto.

* eval.c (massign): expand first element if RHS is an array and
  its size is 1, and LHS has concrete assignment target (i.e. LHS
  has target(s) other than *var).

* eval.c (massign): avoid unnecessary avalue/svalue conversion.

* eval.c (rb_yield_0): ditto

* array.c (rb_ary_update): do not allocate unused array if rpl is
  nil (i.e. merely removing elements).

* io.c (io_read): should resize supplied string if it's shorter
  than expected.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-07 07:36:40 +00:00
usa a8bb4ed577 * process.c (proc_exec_v): follow to proc_spawn_v(). call do_aspawn()
on Win32.

* process.c (rb_proc_exec): call do_spawn() on Win32.

* win32/win32.c, win32/win32.h (do_spawn, do_aspawn): add mode flag.

* process.c (proc_spawn_v, rb_f_system): follow above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-06 04:30:27 +00:00
usa d80285a9fe * process.c (rb_proc_exec): use same logic as DJGPP on win32 ports.
* process.c (rb_f_system): ditto.

* win32/win32.c, win32/win32.h (do_aspawn): [new]. for arrayed
  arguments.

* win32/win32.c (CreateChild): add new argument for real filename of
  executing process.

* win32/win32.c (NtHasRedirection, pipe_exec): follow above change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-04 06:26:10 +00:00
nobu 41c46ceade * process.c (rb_proc_times): need to initialize first.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-03 13:26:48 +00:00
matz 4d676cf76f * process.c (rb_proc_times): avoid WindowsXP crash using volatile
variables.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-01-01 10:49:14 +00:00
eban 86c90aea36 * Makefile.in, {win32,bcc32}/Makefile.sub: add new target:
what-where, no-install.

* mkconfig.rb: add const: CROSS_COMPILING.

* ext/extmk.rb: no-install support.  add MAKEDIRS macro.

* lib/mkmf.rb: add !ifdef .. !endif for Borland make.

* process.c: improve DJGPP support.  system "ls", "-l".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3259 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-31 12:31:12 +00:00
uema2 b19e36a214 * configure.in, defines.h, dir.c, dir.h, dln.c, error.c,
eval.c, file.c, hash.c, io.c, main.c, missing.c,
      process.c, ruby.c, rubysig.h, signal.c, st.c, util.c, util.h,
      bcc/Makefile.sub, win32/Makefile.sub, win32/win32.h,
      ext/Win32API/Win32API.c, ext/socket/getaddrinfo.c,
      ext/socket/getnameinfo.c, ext/socket/socket.c,
      ext/tcltklib/stubs.c
      : replace "NT" with "_WIN32", add DOSISH_DRIVE_LETTER
* wince/exe.mak : delete \r at the end of lines.
* wince/mswince-ruby17.def : delete rb_obj_become


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-15 03:18:08 +00:00
matz 60b2446bea * sprintf.c (rb_f_sprintf): preceding ".." for negative numbers
still left;  removed.

* sprintf.c (rb_f_sprintf): should not prepend '0' if width > prec
  for example "%5.3d".

* process.c (Init_process): add Process.exit and Process.abort

* pack.c (utf8_to_uv): raise ArgumentError for malformed/redundant
  UTF-8 sequences.

* process.c (last_status_set): add pid attribute to Process::Status.

* pack.c (uv_to_utf8): limit maximum length of the encoded string
  to 6 bytes, even when the platform supports 8 bytes long integers.

* pack.c (utf8_to_uv): do not decode sequences longer than 6 bytes.

* object.c (copy_object): use "copy_object" method, not "become".


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-10 06:23:44 +00:00
matz 90c4dae08f WinCE patch merged
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-12-02 07:57:17 +00:00
michal c7e16e94e4 move struct timeval to missing.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-09-17 13:52:45 +00:00
michal 0d0ae37e50 Int vs Long cleanup #3 (ruby-core:352)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-28 08:05:23 +00:00
michal ffc13a6525 *.c: Int vs Long cleanup
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-08-21 15:47:54 +00:00
matz be1d2c5f68 * string.c (rb_str_slice_bang): if there's no corresponding
substring, slice! should return nil without exception.

* array.c (rb_ary_insert): type fixed.

* string.c (rb_str_split_m): accept separator value nil as well.

* string.c (rb_str_become): was leaking memory.

* class.c (rb_include_module): should not alter other
  classes/modules by inclusion.  by this fix, local order may not
  be preserved for some cases.

* class.c (include_class_new): module may be T_ICLASS; retrieve
  original module information.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-07-11 08:22:18 +00:00
matz eb6118992b * eval.c (rb_clear_cache_by_class): new function.
* eval.c (set_method_visibility): should have clear cache forq
  updated visibility.

* numeric.c (flo_to_s): default format precision to be "%.16g".

* util.c (ruby_strtod): use own strtod(3) implementation to avoid
  locale hell.  Due to this change "0xff".to_f no longer returns 255.0

* eval.c (avalue_to_yvalue): new function to distinguish yvalue
  (no-arg == Qundef) from svalue (no-arg == Qnil).

* eval.c (rb_yield_0): use avalue_to_yvalue().

* eval.c (assign): warn if val == Qundef where it means rhs is
  void (e.g. yield without value or call without argument).

* parse.y (value_expr): need not to warn for WHILE and UNTIL,
  since they can have return value (via valued break).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-05-14 06:22:31 +00:00
matz 2bd0c2bf73 * the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged.

* eval.c (exec_under): changing ruby_class is OK, but should not
  alter cbase.

* eval.c (yield_under_i): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-22 07:26:42 +00:00
matz 86c6af5873 * marshal.c (w_object): module inclusion using extend() should
also be detected.

* eval.c (rb_eval_cmd): cbase should not be NULL; it should be
  either ruby_wrapper or Object.

* enum.c (enum_each_with_index): should return self.

* process.c (proc_setpgrp): should return value for non-void function.

* process.c (proc_getpgid): should raise exception if getpgid() return -1.

* string.c (rb_str_ljust): should return a duplicated string.

* string.c (rb_str_rjust): ditto.

* string.c (rb_str_center): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-11 08:02:04 +00:00
matz 8d456d453c * eval.c (rb_eval): call trace_func for if/while conditions.
* marshal.c (r_object): separate r_regist from proc calling.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-26 06:48:59 +00:00
matz 6d47b8a9cc * eval.c (method_inspect): should not dump core for unbound
singleton methods.

* object.c (rb_mod_to_s): better description.

* hash.c (env_select): should path the assoc list.

* process.c (rb_syswait): thread kludge; should be fixed to
  support native thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-25 09:16:25 +00:00
matz e60deb1555 * file.c (path_check_1): should check directory sticky bits.
* process.c (security): need not to warn twice.

* marshal.c (r_object): complete restoration before calling
  r_regist().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-19 06:43:58 +00:00
matz d77119bfe4 * io.c (rb_io_readlines): avoid calling GetOpenFile() repeatedly.
* io.c (rb_io_each_line): ditto.

* io.c (argf_getline): ditto.

* process.c: should include <time.h> to get proper CLK_TCK.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-02-06 07:30:13 +00:00
matz 85e32dd221 * re.c (match_select): should propagate taintness.
* hash.c (rb_hash_set_default): Hash#default= should return the
  new value.

* string.c (rb_str_to_i): accepts optional base argument. [new]

* numeric.c (rb_fix2str): should not handle negative fixnum values
  int32 via calling sprintf() directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-11 09:18:54 +00:00
matz 459031e5d9 * process.c (rb_f_system): abandon vfork.
* io.c (pipe_open): ditto.

* defines.h: sparc linux needs different FLUSH_REGISTER_WINDOWS

* regex.c (re_search): abandon stclass optimization.

* bignum.c (rb_cstr2inum): deny "0_".

* bignum.c (rb_cstr2inum): allow "0\n" and so on.

* error.c (rb_invalid_str): utility function to show inspect()'ed
  string.

* bignum.c (rb_cstr2inum): prints invalid strings in inspect()'ed
  format.

* object.c (rb_Float): ditto.

* object.c (rb_convert_type): no longer use rb_rescue().

* re.c (rb_reg_search): initialize taint status of match object.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-01-04 14:15:33 +00:00
matz f1fdbf080e * parse.y (str_extend): should check nesting parentheses in #{}.
* process.c (pst_wstopsig): returns nil unless WIFSTOPPED() is
  non-zero.

* process.c (pst_wtermsig): returns nil unless WIFSIGNALED() is
  non-zero.

* process.c (pst_wexitstatus): returns nil unless WIFEXITED() is
  non-zero.

* eval.c (rb_thread_select): tv_sec and tv_usec should not be
  negative.

* signal.c (posix_signal): do not set SA_RESTART for SIGVTALRM.

* parse.y (call_args2): block_arg may follow the first argument in
  call_args2.

* eval.c (stack_check): should avoid stack length check during
  raising SystemStackError exception.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-21 15:42:12 +00:00
matz df96f994f1 * parse.y (parse_regx): should raise error on untermitated
expression interpolation.

* pack.c (pack_unpack): should give length to utf8_to_uv().

* pack.c (utf8_to_uv): add length check.

* massages: replace "wrong #" by "wrong number".

* marshal.c (w_float): output Infinity and NaN explicitly.

* marshal.c (r_object): support new explicit float format.

* eval.c (rb_thread_wait_for): select may cause ERESTART on
  Solaris.

* eval.c (rb_thread_select): ditto.

* array.c (rb_ary_join): dumped core if sep is not T_STRING nor T_NIL.

* array.c (rb_ary_join): buffer size calculattion was wrong.

* array.c (rb_ary_to_s): if rb_output_fs is nil, insert newlines
  between array elements (use rb_default_rs as newline litral)
  [experimental].

* gc.c (init_mark_stack): no need to clear mark_stack.

* gc.c (gc_mark_all): need to handle finalizer mark.

* gc.c (gc_mark_rest): use MEMCPY instead of memcpy.

* gc.c (rb_gc_mark): earlier const check to avoid pusing special
  constants into mark stack.

* numeric.c (fix_to_s): 'to_s' now takes optional argument to
  specify radix. [new]

* bignum.c (rb_big_to_s): ditto. [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-19 05:03:03 +00:00
matz dc98adf839 * process.c (security): always give warning for insecure PATH.
* dir.c (my_getcwd): do not rely on MAXPATHLEN.

* file.c (rb_file_s_readlink): ditto.

* file.c (path_check_1): ditto.

* eval.c (rb_yield_0): should not call rb_f_block_given_p().

* string.c (rb_str_chomp_bang): should terminate string by NUL.

* eval.c (rb_yield_0): better error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-11-08 06:43:14 +00:00
eban 681b54c0bd * process.c (Init_process): activate the case NT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-10-09 09:42:47 +00:00
matz 67245eec71 * eval.c (rb_thread_restore_context): save current value of
lastline and lastmatch in the thread struct for later restore.

* eval.c (rb_thread_save_context): restore lastline and lastmatch.

* numeric.c (flo_to_s): should handle negative float value.

* class.c (rb_include_module): should check whole ancestors to
  avoid duplicate module inclusion.

* string.c (trnext): should check backslash before updating "now"
  position.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-09-08 14:17:53 +00:00
matz f33a61c28d * string.c (rb_str_lstrip_bang): new method.
* string.c (rb_str_rstrip_bang): new method.

* string.c (rb_str_associate): should consider STR_ASSOC too.

* eval.c (rb_undefined): do not recurse if method_missing is
  undefined.

* process.c (proc_waitpid): now all arguments are optional.

* process.c (Init_process): waitpid is now alias to wait.

* process.c (Init_process): waitpid2 is now alias to wait2.

* process.c (rb_waitpid): made public.

* ext/pty/pty.c (pty_getpty): avoid disturbing SIGCHLD using
  thread and rb_waitpid.

* process.c (proc_getpgrp): now takes no argument on all
  platforms.

* process.c (proc_setpgrp): ditto.

* ext/socket/socket.c (sock_s_pack_sockaddr_in): added
  Socket::pack_sockaddr_in(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_un): added
  Socket::pack_sockaddr_un(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_in): added
  Socket::unpack_sockaddr_in(). [new]

* ext/socket/socket.c (sock_s_pack_sockaddr_un): added
  Socket::unpack_sockaddr_un(). [new]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1666 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-08-06 03:05:23 +00:00
nobu 4b7c92fa90 * process.c (last_status_set): nothing returned, should be void.
* ext/socket/socket.c (load_addr_info): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-07-31 08:04:13 +00:00
matz ed6a2bd29f * bignum.c (rb_big2str): t should be protected from GC.
* process.c (rb_proc_times): need not to check retrun value from
  times(2).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-21 04:22:54 +00:00
matz f84f4aa6b3 * array.c (rb_ary_and): should not push frozen key string.
* array.c (rb_ary_or): ditto.

* eval.c (rb_thread_schedule): should save context before raising
  deadlock, saved context for current thread might be obsolete.

* time.c (make_time_t): non DST timezone shift supported (hopefully).

* time.c (make_time_t): strict range detection for negative time_t.

* signal.c: SIGINFO added.

* eval.c (rb_ensure): should not SEGV when prot_tag is NULL.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-16 09:05:54 +00:00
matz fd06a2a7fb * eval.c (block_pass): should not downgrade safe level.
* ext/dbm/extconf.rb: allow specifying dbm-type explicitly.

* ext/dbm/extconf.rb: avoid gdbm if possible, because it leaks
  memory, whereas gdbm.so doesn't.  potential incompatibility.

* string.c (rb_str_insert): new method.

* parse.y (yylex): lex_state after RESCUE_MOD should be EXPR_BEG.

* array.c (rb_ary_insert): new method.

* array.c (rb_ary_update): new utility function.

* io.c (set_outfile): should check if closed before assignment.

* eval.c (rb_eval): should preserve value of ruby_errinfo.

* eval.c (rb_thread_schedule): infinite sleep should not cause
  dead lock.

* array.c (rb_ary_flatten_bang): proper recursive detection.

* eval.c (yield_under): need not to prohibit at safe level 4.

* pack.c (pack_pack): p/P packs nil into NULL.

* pack.c (pack_unpack): p/P unpacks NULL into nil.

* pack.c (pack_pack): size check for P template.

* ruby.c (set_arg0): wrong predicate when new $0 value is bigger
  than original space.

* gc.c (id2ref): should use NUM2ULONG()

* object.c (rb_mod_const_get): check whether name is a class
  variable name.

* object.c (rb_mod_const_set): ditto.

* object.c (rb_mod_const_defined): ditto.

* marshal.c (w_float): precision changed to "%.16g"

* eval.c (rb_call0): wrong retry behavior.

* numeric.c (fix_aref): a bug on long>int architecture.

* eval.c (rb_eval_string_wrap): should restore ruby_wrapper.

* regex.c (re_compile_pattern): char class at either edge of range
  should be invalid.

* eval.c (handle_rescue): use === to compare exception match.

* error.c (syserr_eqq): comparison between SytemCallErrors should
  based on their error numbers.

* eval.c (safe_getter): should use INT2NUM().

* bignum.c (rb_big2long): 2**31 cannot fit in 31 bit long.

* regex.c (calculate_must_string): wrong length calculation.

* eval.c (rb_thread_start_0): fixed memory leak.

* parse.y (none): should clear cmdarg_stack too.

* io.c (rb_fopen): use setvbuf() to avoid recursive malloc() on
  some platforms.

* file.c (rb_stat_dev): device functions should honor stat field
  types (except long long such as dev_t).

* eval.c (rb_mod_nesting): should not push nil for nesting array.

* eval.c (rb_mod_s_constants): should not search array by
  rb_mod_const_at() for nil (happens for singleton class).

* class.c (rb_singleton_class_attached): should modify iv_tbl by
  itself, no longer use rb_iv_set() to avoid freeze check error.

* variable.c (rb_const_get): error message "uninitialized constant
  Foo at Bar::Baz" instead of "uninitialized constantBar::Baz::Foo".

* eval.c (rb_mod_included): new hook called from rb_mod_include().

* io.c (opt_i_set): should strdup() inplace_edit string.

* eval.c (exec_under): need to push cref too.

* eval.c (rb_f_missing): raise NameError for "undefined local
  variable or method".

* error.c (Init_Exception): new exception NoMethodError.
  NameError moved under ScriptError again.

* eval.c (rb_f_missing): use NoMethodError instead of NameError.

* file.c (Init_File): should redifine "new" class method.

* eval.c (PUSH_CREF): sharing cref node was problematic.  maintain
  runtime cref list instead.

* eval.c (rb_eval): copy defn node before registering.

* eval.c (rb_load): clear ruby_cref before loading.

* variable.c (rb_const_get): no recursion to show full class path
  for modules.

* eval.c (rb_set_safe_level): should set safe level in curr_thread
  as well.

* eval.c (safe_setter): ditto.

* object.c (rb_obj_is_instance_of): nil belongs to false, not true.

* time.c (make_time_t): proper (I hope) daylight saving time
  handling for both US and Europe.  I HATE DST!

* eval.c (rb_thread_wait_for): non blocked signal interrupt should
  stop the interval.

* eval.c (proc_eq): class check aded.

* eval.c (proc_eq): typo fixed ("return" was ommitted).

* error.c (Init_Exception): move NameError under StandardError.

* class.c (rb_mod_clone): should copy method bodies too.

* bignum.c (bigdivrem): should trim trailing zero bdigits of
  remainder, even if dd == 0.

* file.c (check3rdbyte): safe string check moved here.

* time.c (make_time_t): remove HAVE_TM_ZONE code since it
  sometimes reports wrong time.

* time.c (make_time_t): remove unnecessary range check for
  platforms where negative time_t is available.

* process.c (proc_waitall): should push Process::Status instead of
  Finuxm status.

* process.c (waitall_each): should add all entries in pid_tbl.
  these changes are inspired by Koji Arai.  Thanks.

* process.c (proc_wait): should not iterate if pid_tbl is 0.

* process.c (proc_waitall): ditto.

* numeric.c (flodivmod): a bug in no fmod case.

* process.c (pst_wifsignaled): should apply WIFSIGNALED for status
  (int), not st (VALUE).

* io.c (Init_IO): value of $/ and $\ are no longer restricted to
  strings.  type checks are done on demand.

* class.c (rb_include_module): module inclusion should be check
  taints.

* ruby.h (STR2CSTR): replace to StringType() and StringTypePtr().

* ruby.h (rb_str2cstr): ditto.

* eval.c (rb_load): should not copy topleve local variables.  It
  cause variable/method ambiguity.  Thanks to L. Peter Deutsch.

* class.c (rb_include_module): freeze check at first.

* eval.c (rb_attr): sprintf() and rb_intern() moved into
  conditional body.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-05-02 04:22:21 +00:00
matz 62261ccb47 * object.c (rb_str2cstr): warn if string contains \0 and length
value is ignored.

* class.c (rb_singleton_class_clone): should copy class constant
  table as well.

* class.c (rb_include_module): sometimes cache was mistakenly left
  uncleared - based on the patch by K.Kosako.

* ruby.h: all Check_SafeStr()'s are replaced by SafeStr() to
  ensure 'to_str' be always effective.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-03-28 08:43:25 +00:00
eban d633fc6b5b * process.c: add W* macro if not available.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-20 14:52:31 +00:00
matz 3ae4fd7258 * eval.c (secure_visibility): visibility check for untainted modules.
* signal.c (sigpipe): sighandler which does nothing.

* signal.c (trap): set sigpipe function for SIGPIPE.

* signal.c (Init_signal): default SIGPIPE handler should be
  sigpipe function.

* array.c (rb_ary_subseq): wrong boundary check.

* parse.y (cond0): integer literal in condition should not be
  compared to lineno ($.).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-19 07:03:06 +00:00
matz e1c29a3f13 * io.c (set_outfile): f should be the FILE* from the assigning value.
* ext/socket/socket.c (tcp_s_open): should not give default value
  to local_host.

* time.c (time_s_times): move to Process::times.

* file.c (rb_file_s_lchmod): new method File::lchmod.

* file.c (rb_file_s_lchown): new method File::lchown.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-16 07:53:21 +00:00
matz 011ed67616 * process.c (proc_waitall): new method based on a patch from Brian
Fundakowski Feldman <green@green.dyndns.org>.

* process.c (last_status_set): objectify $? value (Process::Status).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-02-15 06:01:00 +00:00
matz 2f0faf671d * string.c (str_independent): should not clear str->orig here.
it's too early.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-29 05:10:42 +00:00
matz 81ef4309a2 * m17n baseline.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-10 07:52:46 +00:00
eban 6b5ad7c5b2 setres[ug]id, NORETURN
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1106 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-01-10 07:30:18 +00:00
matz a5dcc4437e matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-12-26 08:08:50 +00:00
matz 99020d6e50 001225
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-12-25 06:29:27 +00:00
matz f54418b71f matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-27 09:23:38 +00:00
eban e9cf3b3bf5 eban
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-11-13 10:11:31 +00:00
matz 4098e5861e matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-10-20 16:37:01 +00:00
matz 1b2d3f81ee 1.6.2 (to be)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-10-17 18:14:05 +00:00
matz 1ce6f065b5 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-10-10 07:03:36 +00:00
matz c67251edb4 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-08-07 05:05:04 +00:00
matz c9accd03e7 matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-07-21 08:45:34 +00:00
matz b8148f4594 2000-06-19
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@767 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-06-19 08:38:11 +00:00
matz 9ee0cafbfe 2000-06-13
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-06-13 09:42:40 +00:00
matz 8b1de0b1ad 2000-05-24
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-24 04:34:26 +00:00
matz 133ff3421a 2000-05-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-17 04:38:19 +00:00
matz 655e96fa59 2000-05-09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-09 04:53:16 +00:00
matz fedf48986d 2000-05-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-05-01 09:42:38 +00:00
matz 31c55301e4 2000-03-13
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2000-03-13 07:18:45 +00:00