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

40 Коммитов

Автор SHA1 Сообщение Дата
NAKAMURA Usaku dcb6a6ae3e
Windows simply causes an error to open invalid path 2019-05-01 17:38:45 +09:00
kazu f2dec4ab96 Failed to unlink before close on mswin
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-11 13:00:56 +00:00
normal e22f3bf91f test/test_{tempfile,tmpdir}: get rid of leftover files
I ran out of inodes in $TMPDIR

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-11 08:33:37 +00:00
kazu 91fc0a9103 Use `&.` instead of modifier if and remove needless closed?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-11 14:13:56 +00:00
usa 97d610becd * test/test_tempfile.rb (test_{new,create}_traversal_dir): should not assume `t`
is always set.  if `t` is nil, `NoMethodError` will be raised and the real
  cause will be hidden.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 15:44:56 +00:00
mame 2de0c72947 test/test_tempfile.rb: close a file object created by Tempfile.create
To stop a "Leaked file descriptor" warning.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-04 15:26:11 +00:00
hsbt 10b96900b9 Ignore file separator from tmpfile/tmpdir name.
From: SHIBATA Hiroshi <hsbt@ruby-lang.org>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62990 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-28 10:03:03 +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
kazu 6064132c42 Remove unnecessary `require 'thread'`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00
usa a4d51619e9 Of course, opened file is not able to unlink on Windows
* test/test_tempfile.rb (test_create_with_block): close the tempfile before
  unlink.  fixed a failure on Windows introduced at r58791.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58795 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 12:44:46 +00:00
nobu 3c5344bf30 tempfile.rb: remove in Tempfile.create
* lib/tempfile.rb (Tempfile.create): should not fail even if the
  temporary file has been removed in the block, just ignore.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58791 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-19 09:20:14 +00:00
glass 279d31f11d Fix bug of Tempfile#size if nothing is written [Bug #13198]
* lib/tempfile.rb (Tempfile#size): Fix its behavior when nothing
  is written. Tempfile#size should return 0 in this case.
  The patch is from nobu <nobu@ruby-lang.org>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57972 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-14 12:53:32 +00:00
nobu 640bcdf217 leakchecker.rb: get rid of uninitialized Tempfile
* test/lib/leakchecker.rb (LeakChecker#find_tempfiles): get rid of
  errors on uninitialized Tempfile, which can be left when
  Dir.tmpdir failed or by Tempfile.allocate.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-27 05:01:18 +00:00
kazu 562bbdf995 lib/tempfile.rb: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-21 12:21:05 +00:00
sonots 64f53f0dbf * lib/tempfile.rb: provide default basename parameter
for Tempfile.create. [Feature #11965] Patch by Yuki Kurihara
* test/test_tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-26 05:45:29 +00:00
nobu 4b298ad77a Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
nobu 4ebaed6bee test_tempfile.rb: use assert_file
* test/test_tempfile.rb (test_create_with{,out}_block): use
  assert_file for descriptive failure messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-08 08:24:01 +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 33604da3f6 test_tempfile.rb: use assert_predicate
* test/test_tempfile.rb: use assert_predicate and
  assert_not_predicate for better failure messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31 04:45:10 +00:00
nobu 56ef54338b test_tempfile.rb: use assert_file
* test/test_tempfile.rb: use assert_file for better failure
  messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-31 04:45:02 +00:00
usa cc09968d71 * lib/tempfile.rb (Remover#call): fixed wrong condition introduced at
r50682.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-30 09:05:50 +00:00
ayumin dd2d43d9bd * test/test_tempfile.rb: use assert_file for more descriptive message.
following r49131.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-04 04:41:04 +00:00
nobu 8d7f655261 test_tempfile.rb: assert_file
* test/test_tempfile.rb (test_default_basename): use assert_file
  for more descriptive message.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-04 01:58:49 +00:00
hsbt 05c108cdba * lib/tempfile.rb: provide default basename parameter.
[fix GH-523] Patch by @dissolved
* test/test_tempfile.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49129 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-04 00:18:38 +00:00
akr fb2008a73a * test/lib/envutil.rb: Moved from test/ruby/.
* test/lib/find_executable.rb: Ditto.

* test/lib/memory_status.rb: Ditto.

* test/lib/test/unit.rb: require envutil.

* test/: Don't require envutil in test files.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 16:05:37 +00:00
nobu a718be06fa tempfile.rb: fix r47655
* lib/tempfile.rb (Tempfile#initialize, Tempfile.create): get rid of
  shadowing local variables.

* lib/tmpdir.rb (Dir::Tmpname#make_tmpname): simlify argument
  splitting.

* test/test_tempfile.rb: need thread library for ConditionVariable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21 01:40:21 +00:00
nobu 7800a4b566 test_tempfile.rb: suppress warnings
* test/test_tempfile.rb (test_tempfile_is_unlinked_when_ruby_exits): no error should emit.

* test/test_tempfile.rb (test_tempfile_encoding_ascii8bit): remove unused variable.

* test/test_tempfile.rb (test_tempfile_encoding_ascii8bit2): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-21 09:51:18 +00:00
nobu be903332c6 test_tempfile.rb: fix test on Windows
* test/test_tempfile.rb (test_tempfile_finalizer_does_not_run_if_unlinked):
  open file cannot be deleted on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-06 00:38:34 +00:00
nobu ec2db8decf tempfile.rb: undefine finalizer on unlink
* lib/tempfile.rb (Tempfile#unlink): finalizer is no longer needed
  after unlinking.  patched by by normalperson (Eric Wong) at
  [ruby-core:56521] [Bug #8768]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43110 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-01 13:03:58 +00:00
akr 5388fb64d9 * lib/tempfile.rb (Tempfile.create): New method.
The method name is proposed by Shugo Maeda.  [ruby-dev:47220]
  [ruby-core:41478] [Feature #5707]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-20 13:50:47 +00:00
usa 8eb92a671d * test/test_tempfile.rb: simply ignore platform depedent testcases
instead of skipping.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-04 02:51:17 +00:00
nobu 9e39c618da * ext/etc/etc.c (etc_systmpdir): assume system default tmpdir
safe.  [ruby-dev:42089]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-09 22:29:16 +00:00
usa 97596f36bc * test/test_tempfile.rb: skip some tests on Windows because unlinking is always
delayed till closed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-26 06:37:08 +00:00
nobu 3046fe65af * test/test_tempfile.rb: fixed errors.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-01 22:00:37 +00:00
nobu 5e02a28a8b * lib/tempfile.rb (Tempfile#size): stat by path name when it is
closed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27578 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-01 13:54:01 +00:00
nobu d0cb5c71ce * lib/tempfile.rb (Tempfile#open): re-open with same mode and
options as initialize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-29 06:11:48 +00:00
nobu 55179696b2 * lib/tempfile.rb (Tempfile#initialize): option hash may not be
given.  [ruby-core:26681]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-11 21:42:40 +00:00
nobu 47a1a7b67d * test/test_tempfile.rb: merged from Hongli Lai's fork.
cf [ruby-core:25131].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-26 10:00:03 +00:00
xibbar 679d83e6f2 add test for encoding option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 14:30:47 +00:00
akr 05e52bf46b add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 15:32:07 +00:00