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

166 Коммитов

Автор SHA1 Сообщение Дата
Jeremy Evans c5c05460ac Warn on access/modify of $SAFE, and remove effects of modifying $SAFE
This removes the security features added by $SAFE = 1, and warns for access
or modification of $SAFE from Ruby-level, as well as warning when calling
all public C functions related to $SAFE.

This modifies some internal functions that took a safe level argument
to no longer take the argument.

rb_require_safe now warns, rb_require_string has been added as a
version that takes a VALUE and does not warn.

One public C function that still takes a safe level argument and that
this doesn't warn for is rb_eval_cmd.  We may want to consider
adding an alternative method that does not take a safe level argument,
and warn for rb_eval_cmd.
2019-11-18 01:00:25 +02:00
Nobuyoshi Nakada e0a3c547dd
Get rid of toplevel methods 2019-07-08 16:05:04 +09:00
Nobuyoshi Nakada 45ba027d08
Removed unused variables 2019-06-30 08:45:01 +09:00
Takashi Kokubun bef5829482
Add one more retry for win32ole event matcher
to fix
https://ci.appveyor.com/project/ruby/ruby/builds/24438615/job/yld1utsltxag9dr2
2019-05-10 11:54:21 +09:00
k0kubun 72c62dc086 test_win32ole_event.rb: use better retry strategy
because
https://ci.appveyor.com/project/ruby/ruby/builds/21208728/job/lm5k0lxnn51pcljl
seems to fail with just sleeping

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-24 03:50:39 +00:00
k0kubun 3bfd7f02c7 test_win32ole_event.rb: avoid unlimited retries
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-24 03:48:32 +00:00
k0kubun 23ffadad69 test_win32ole_event.rb: retry random failure
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-13 05:59:14 +00:00
k0kubun e31864a8a0 test_win32ole_event.rb: retry #test_s_new_loop with sleep
It seems to fail randomly:
https://ci.appveyor.com/project/ruby/ruby/builds/19963142/job/8gaxepksa0i3b998

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-01 04:20:26 +00:00
suke 2afc2a0581 Merge branch 'modify_test_win32ole' into trunk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 14:34:30 +00:00
suke 4e3e0ac4df refactoring. suppress warning.
* test/win32ole/test_win32ole_record.rb: refactoring. suppress warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 13:16:25 +00:00
suke d02a7ac01c use System Monitor Control to test win32ole
* test/win32ole/test_win32ole_method_event.rb: use System Monitor
  Control to test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 12:21:30 +00:00
suke 2fe69b221c refactoring define AvailableOLE.sysmon_available?
* test/win32ole/test_win32ole_type_event.rb: refactoring. use
  AvailableOLE.sysmon_available?

* test/win32ole/available_ole.rb: define AvailableOLE.sysmon_available?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 11:54:09 +00:00
suke c561284bc2 try to use System Monitor Control
* test/win32ole/test_win32ole_type_event.rb: try to use System Monitor
  Control to test. ADO is not available in AppVeyor(Mingw only?)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 02:24:21 +00:00
k0kubun 8f43080f4b test_win32ole_event.rb: fire message_loop on retry
because it's failing even after sleeping 31s in total.
https://ci.appveyor.com/project/ruby/ruby/builds/19642619/job/pkaj5svr8glk8twt
https://ci.appveyor.com/project/ruby/ruby/builds/19641381/job/spdvrptpaq1d5778

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-20 01:10:09 +00:00
suke 9b5a1329f5 use ADODB.Connection instead of Microsoft Internet Controls.
* test/win32ole/test_win32ole_type.rb: remove test using Microsoft
    Internet Controls.

  * test/win32ole/test_win32ole_type_event.rb: some test uses
    ADODB.Connection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13 03:18:42 +00:00
suke 06e1079d93 remove Microsoft Internet Control
* test/win32ole/test_win32ole_param: remove Microsoft Internet Control.
* test/win32ole/test_win32ole_param_event: use ADODB instead of
  Microsoft Internet Control for test_input?, test_output?

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-13 00:21:59 +00:00
suke 9749bab35e use assert_equal instead of assert
* test/win32ole/test_win32ole_param.rb (test_input?, test_output,
  test_optional, test_retval?): use assert_equal instead of assert.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 23:07:48 +00:00
suke a113da5b18 remove duplicate assertion
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 13:51:21 +00:00
k0kubun 6c415d0163 test/win32ole/test_win32ole_event.rb: wait longer
for unstable spec. I added r64963 but it couldn't rescue:
https://ci.appveyor.com/project/ruby/ruby/builds/19451743/job/hg0tyoxbacrrlnsr

Since #test_on_event is especially unstable,
https://ci.appveyor.com/project/ruby/ruby/builds/19337514/job/0wp2oe9dkr9gt1bi
https://ci.appveyor.com/project/ruby/ruby/builds/19451743/job/hg0tyoxbacrrlnsr
this commit lets it sleep longer as needed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 09:19:49 +00:00
suke eb38472824 use ADODB.connection instead of Microsoft Internet Controls
* test/win32ole/test_win32ole_method.rb: remove test using Microsoft
    Internet Controls.

  * test/win32ole/test_win32ole_method_event.rb: add test using
    ADODB.connection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-12 03:55:21 +00:00
k0kubun 1ce45a446e test_win32ole_event.rb: sleep longer
to increase the possibility of TestWIN32OLE_EVENT_SWbemSink#test_on_event success.
It seems to randomly fail
https://ci.appveyor.com/project/ruby/ruby/builds/19337514/job/0wp2oe9dkr9gt1bi

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-08 11:59:22 +00:00
suke 22de2030c5 * ext/win32ole/lib/win32ole.rb (methods): COM method elements should be
symbol in return value of methods.

* test/win32ole/test_win32ole.rb ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-09-26 09:33:46 +00:00
nobu dd3851d278 Rename test classes to allow stable test count when running test-all -j
[Fix GH-1763]

From: MSP-Greg <MSP-Greg@users.noreply.github.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-13 06:29:02 +00:00
ko1 c39bdb798d `$SAFE` as a process global state. [Feature #14250]
* vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to
  `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state.

* vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc`
  objects don't need to keep `$SAFE` at the creation.
  Also make `is_from_method` and `is_lambda` as 1 bit fields.

* cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation.

* eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access
  `vm->safe_level_` directly.

* eval_jump.c: End procs `END{}` doesn't keep `$SAFE`.

* proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c.

* safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes.

* safe.c (safe_setter): use `rb_set_safe_level()`.

* thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`.
  It should be obsolete.

* transcode.c (load_transcoder_entry): `rb_safe_level()` only returns
  0 or 1 so that this check is not needed.

* vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc.

* vm.c (rb_proc_create): renamed to `proc_create`.

* vm.c (rb_proc_dup): moved from proc.c.

* vm.c (vm_invoke_proc): do not need to set and restore `$SAFE`
  for `Proc#call`.

* vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer
  meaning.

* lib/drb/drb.rb: restore `$SAFE`.

* lib/erb.rb: restore `$SAFE`, too.

* test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests.

* test/rubygems/test_gem.rb: do not set `$SAFE = 1`.

* bootstraptest/test_proc.rb: catch up this change.

* spec/ruby/optional/capi/string_spec.rb: ditto.

* test/bigdecimal/test_bigdecimal.rb: ditto.

* test/fiddle/test_func.rb: ditto.

* test/fiddle/test_handle.rb: ditto.

* test/net/imap/test_imap_response_parser.rb: ditto.

* test/pathname/test_pathname.rb: ditto.

* test/readline/test_readline.rb: ditto.

* test/ruby/test_file.rb: ditto.

* test/ruby/test_optimization.rb: ditto.

* test/ruby/test_proc.rb: ditto.

* test/ruby/test_require.rb: ditto.

* test/ruby/test_thread.rb: ditto.

* test/rubygems/test_gem_specification.rb: ditto.

* test/test_tempfile.rb: ditto.

* test/test_tmpdir.rb: ditto.

* test/win32ole/test_win32ole.rb: ditto.

* test/win32ole/test_win32ole_event.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-28 20:09:24 +00:00
usa 9178645dbc Thread.current.report_on_exception = false
* test/win32ole/test_win32ole.rb: set report_on_exception = false in threads
  which are expected to be throw some exceptions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-14 06:38:47 +00:00
suke 6bac2765a7 ext/win32ole/lib/win32ole.rb (metods): rescue WIN32OLEQueryInterfaceError.
test/win32ole/test_win32ole.rb: add test for WIN32OLE#methods


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-05 01:02:04 +00:00
suke 62cec32902 test/win32ole/test_win32ole_method.rb: remove redundant assertions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-05 00:36:37 +00:00
suke 6f889b50d9 ext/win32ole/win32ole.c (fole_missing): set receiver in NoMethodError.
test/win32ole/test_win32ole.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:57:10 +00:00
suke f10646970b test/win32ole/test_word.rb: word quit without confirmation dialog to save
files. [Bug #13894] Thanks to h.shirosaki.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-13 13:24:59 +00:00
nobu 2bedfc6627 test/win32ole/test_win32ole_variant.rb: use other than Integer
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55046 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 02:05:30 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu 739d9a37cb win32ole.c: check argument type
* ext/win32ole/win32ole.c (ole_vstr2wc): check argument type, vstr
  must be a String here.  reported by Marcin 'Icewall' Noga of
  Cisco Talos.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53074 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-13 09:19:20 +00:00
nobu 898fd2ed2a use rb_check_arity [ci skip]
* ext: use rb_check_arity and rb_error_arity to raise
  ArgumentError.  [Feature #9025]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-25 00:43:06 +00:00
nobu d3b3eff1a9 test_win32ole_event.rb: fix typo [ci skip]
* test/win32ole/test_win32ole_event.rb: fix typo.
  swbemsink_avairable? => swbemsink_available?  [Fix GH-1025]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-21 11:53:41 +00:00
nobu 822c3999d0 test_win32ole_event.rb: skip message
* test/win32ole/test_win32ole_event.rb (exec_notification_query_async):
  add skip message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-30 07:15:52 +00:00
nobu e7d578bf58 test_win32ole_event.rb: skip 80041008
* test/win32ole/test_win32ole_event.rb (exec_notification_query_async):
  skip error with OLE error code:80041008, which seems to occur when
  logging in as a non admistrator user.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-30 06:46:16 +00:00
suke 11ac08676d * test/win32ole/test_word.rb: use skip method to skip test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-10 22:54:39 +00:00
suke d9bc7904fa * test/win32ole/test_win32ole_record.rb: remove test using .NET
Framework 3.5 because it is not included in Windows 8/8.1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 13:17:22 +00:00
suke a654ee3128 * test/win32ole/test_win32ole_record.rb
(test_ole_instance_variable_get): correct VT_RECORD type and
  instance variables.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-07 04:37:11 +00:00
svn 2f4570e742 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-22 12:31:59 +00:00
suke 14c5bd12ad * test/win32ole/test_win32ole_event.rb: some tests are
executed on standard Windows OS without ADO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-22 12:31:45 +00:00
suke 03a6d033af * test/win32ole/test_win32ole_event.rb: test_s_new_exception is
executed on standard Windows OS without ADO.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-21 01:56:04 +00:00
suke afe1bbeb4e test/win32ole/test_win32ole_variant.rb
(test_conversion_time2date_with_msec): test by using only
assert_in_delta  to avoid to fail when converting Time object with
999999999 nanoseconds into VT_DATE Variant.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-22 11:01:22 +00:00
suke 8bb93fc8ae ext/win32ole/win32ole.c (rbtime2vtdate, vtdate2rbtime): fix
the bug in conversion of milliseconds. [Bug #10258]

test/win32ole/test_win32ole_variant.rb
(test_conversion_dbl2date_with_msec,
test_conversion_time2date_with_msec): use assert_in_delta instead
of assert_equal to treat an acceptable error range.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 02:18:37 +00:00
suke 6057695c87 * ext/win32ole/win32ole_variant.c (ole_val2variant_err,
ole_val2variantdata, Init_win32ole_variant): support VT_ERROR
  variant with error code. add WIN32OLE_VARIANT::NoParam.
* test/win32ole/test_win32ole_variant.rb(test_c_noparam,
  test_vt_error_noparam): ditto.
* ext/win32ole/win32ole.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-06 07:52:04 +00:00
suke c5487618f5 * ext/win32ole/win32ole.c (rbtime2vtdate): try to convert millisecond
of Time object to millisecond of VT_DATE VARIANT.
* test/win32ole/test_win32ole_variant.rb
  (test_conversion_time2date_with_msec): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-01 11:16:57 +00:00
suke ef7b9bf382 * ext/win32ole/win32ole.c (vtdate2rbtime): try to convert millisecond
of VT_DATE VARIANT to nsec of Time object.
* test/win32ole/test_win32ole_variant.rb
  (test_conversion_dbl2date_with_msec): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-27 10:57:28 +00:00
suke 108c4e4495 * ext/win32ole/win32ole.c(fole_s_connect, fole_initialize): raise a
security error with the tainted string object.
* ext/win32ole/win32ole_event.c(ev_advise): ditto.
* test/win32ole/test_win32ole.rb(test_s_new_exc_svr_tainted,
  test_s_new_exc_host_tainted): ditto.
* test/win32ole/test_win32ole_event.rb(test_s_new_exc_tainted): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-25 11:18:17 +00:00
suke 707ff7bfb7 * ext/win32ole/win32ole_typelib.c (foletypelib_version): return
version string.

* test/win32ole/test_win32ole_typelib.rb (test_version): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-07 12:52:25 +00:00
suke 2906d58a10 * test/win32ole/test_win32ole_record.rb: add for WIN32OLE_RECORD
test(need .NET Framework 3.5 to run test).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-04 12:52:56 +00:00