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

79 Коммитов

Автор SHA1 Сообщение Дата
Tanaka Akira 4d9504fe13 Delegates 3 arguments for Pathname.glob.
Thanks for the patch by pocke (Masataka Kuwabara) [Feature #14405].
2019-07-14 17:42:58 +09:00
nobu 4af7f77d0f STATX_BTIME depends on filesystems
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-22 06:43:11 +00:00
nobu 5f08c9e2e0 Do not test File class method
It fails by EPERM for unknown reason.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-20 09:55:25 +00:00
nobu cc6806c76c Skip EPERM
Docker's default seccomp whitelist does not include statx syscall
by the default.  Skipt this error for now.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-20 08:31:17 +00:00
nobu 15a98ab428 Try statx syscall
* file.c (rb_file_s_birthtime): export for pathname to check if
  birthtime is supported.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67097 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2019-02-20 06:54:23 +00:00
akr 78dc3da299 Pathname#relative_path_from uses is_a?
I reconsidered because simpler code would have better maintainablity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66431 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-18 03:09:54 +00:00
akr 4cf828632f Pathname#relative_path_from compatible with mock.
[Fix GH-2049]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-16 12:26:52 +00:00
marcandre dde0e30c2d Pathname: Have #relative_path_from accept String argument.
[Fix GH-1975]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-13 06:20:06 +00:00
mame b496220a1f skip some tests so that no failure occurs in root privilege
Some tests had failed on `sudo make test-all`, mainly because root can
access any files regardless of permission.  This change adds `skip`
guards into such tests.

Note that almost all tests in which `skip` guards is added, already have
"windows" guard.  This is because there is no support to avoid read
access by owner on Windows.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-10 10:39:09 +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
shyouhei b57915eddc Add FrozenError as a subclass of RuntimeError
FrozenError will be used instead of RuntimeError for exceptions
raised when there is an attempt to modify a frozen object. The
reason for this change is to differentiate exceptions related
to frozen objects from generic exceptions such as those generated
by Kernel#raise without an exception class.

From: Jeremy Evans <code@jeremyevans.net>
Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org>


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12 00:46:34 +00:00
hsbt 6693e3e723 Fixed misspelling words.
These are detected by https://github.com/client9/misspell

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 11:27:06 +00:00
kosaki 3e5a25210e test_pathname.rb#test_open should care about umask
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:22:12 +00:00
akr cea5f5aaee Pathname#glob method implemented.
[ruby-core:49373] [Feature #7360] proposed by Alexander E. Fischer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 08:34:49 +00:00
nobu 2875337533 pathname.rb: UNC root pathname needs a separator
* ext/pathname/lib/pathname.rb (Pathname#plus): UNC root pathname
  needs a separator.  File.basename returns "/" on UNC root, as
  well as sole drive letter, even if it does not end with a
  separator.  [ruby-core:80900] [Bug #13515]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-16 14:44:01 +00:00
akr 9373c5efb9 Pathname#empty? implemented.
* ext/pathname/pathname.c (Pathname#empty?): New method.
  [ruby-core:76404] [Feature#12596] Proposed by John Backus.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-05 03:29:08 +00:00
akr 68ebbbfebe * lib/open-uri.rb: Remove indicator for "frozen_string_literal: true".
* lib/pp.rb: Ditto.

* lib/prettyprint.rb: Ditto.

* lib/resolv.rb: Ditto.

* lib/securerandom.rb: Ditto.

* lib/tmpdir.rb: Ditto.

* lib/unicode_normalize/tables.rb: Ditto.

* test/net/ftp/test_buffered_socket.rb: Ditto.

* test/net/ftp/test_mlsx_entry.rb: Ditto.

* test/open-uri/test_open-uri.rb: Ditto.

* test/open-uri/test_ssl.rb: Ditto.

* test/pathname/test_pathname.rb: Ditto.

* test/test_pp.rb: Ditto.

* test/test_prettyprint.rb: Ditto.

* tool/transcode-tblgen.rb: Ditto.

* ext/pathname/lib/pathname.rb: Ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10 11:48:14 +00:00
akr 36ca18b847 Put an line before "frozen_string_literal: true" for emacs.
https://bugs.ruby-lang.org/issues/8976#note-49


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05 22:22:56 +00:00
akr 12c367ca50 specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-05 03:19:30 +00:00
nobu c5b0dc63de test_pathname.rb: fix exception
* test/pathname/test_pathname.rb (has_symlink): now raises ENOENT
  instead of TypeError when symlink is available.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51721 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-29 05:19:49 +00:00
nobu 8879d73ffd test: try File.symlink with invalid paths
* test (have_symlink?): try File.symlink with invalid paths to
  test the administrator privilege, nil just raises an
  ArgumentError before trying the actual API.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-29 01:25:07 +00:00
nobu 5dfc455b72 test: File.symlink needs administrator privilege
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51714 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-28 01:24:36 +00:00
nobu 499120ad6e test_pathname.rb: skip EACCES
* test/pathname/test_pathname.rb (test_realpath): skip EACCES if
  changing mode of a directory may have no effect.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-08-26 14:49:07 +00:00
normal 3e5c21f7cb remove unnecessary enumerator requires
* lib/rinda/tuplespace.rb: remove enumerator require
* test/pathname/test_pathname.rb: ditto

Related to https://bugs.ruby-lang.org/issues/10902
but not a complete fix.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-17 00:59:02 +00:00
akr 8bb581f8dd * ext/pathname/lib/pathname.rb (descend): Blockless form supported.
(ascend): Ditto.
  [ruby-core:68820] [Feature #11052] Patch by Piotr Szotkowski.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 15:14:46 +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 8ae989f6b6 pathname.rb: fix a Pathname#relative_path_from crash on
* ext/pathname/lib/pathname.rb (SAME_PATHS):
  Pathname#relative_path_from uses String#casecmp to compare strings
  on case-insensitive filesystem platforms (e.g., Windows). This can
  return nil for strings with different encodings, and the code
  previously assumed that it always returned a Fixnum.  [Fix GH-713]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15 01:29:21 +00:00
hsbt d80282eecc * test/pathname/test_pathname.rb: added testcase for Pathname#mountpoint.
[fix GH-709]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-04 11:22:20 +00:00
akr b9faaf6a55 * ext/pathname/pathname.c (path_birthtime): New method,
Pathname#birthtime.
  Proposed by Kazuhiro NISHIYAMA.  [ruby-dev:48232] [Feature #9857]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-06-28 13:46:02 +00:00
akr edacb3a94a * ext/pathname/lib/pathname.rb (cleanpath_aggressive): make all
separators File::SEPARATOR from File::ALT_SEPARATOR.
  Reported by Daniel Rikowski.
  Fixed by Nobuyoshi Nakada.  [Bug #9618]

* ext/pathname/lib/pathname.rb (cleanpath_conservative): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 13:09:58 +00:00
akr 391fc2eeec * ext/pathname/lib/pathname.rb (Pathname#/): Aliased to Pathname#+.
Suggested by Alexey Muranov.  [ruby-core:61432] [Feature #9625]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-05 12:49:27 +00:00
kazu 60d4fc9f68 Fix error with empty args.
* ext/pathname/lib/pathname.rb (Pathname#join): Fix error with
  empty args. Reported by ko1 via IRC.

* test/pathname/test_pathname.rb (TestPathname#test_join): Add the
  test for above case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-04-02 02:51:20 +00:00
kazu 6df5f314ac remove unnecessary unshift
* ext/pathname/lib/pathname.rb (Pathname#join): remove unnecessary unshift.
* test/pathname/test_pathname.rb (TestPathname#test_join): add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45407 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-25 14:42:36 +00:00
ktsj df0991f34b * ext/pathname/lib/pathname.rb (Pathname#find): add "ignore_error"
keyword argument defaulted to true as well as Find#find.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-04 15:44:53 +00:00
hsbt 2e1d21f53c * test/pathname/test_pathname.rb: use File.exist? instead of File.exists?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-16 06:05:55 +00:00
akr c3d1fde2b5 * ext/pathname/pathname.c (path_write): New method.
(path_binwrite): Ditto.
  [ruby-core:49468] [Feature #7378]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-04 11:12:12 +00:00
nagachika 42144fc3bb * test/pathname/test_pathname.rb (test_binread): add assertion to
check encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-09 14:44:10 +00:00
naruse 7bde0843a2 * test/pathname/test_pathname.rb: not read but binread.
patched by Benoit Daloze, [ruby-core:42440] [Bug #5984]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-08 19:13:14 +00:00
nobu ed469831e4 * file.c (rb_enc_path_next, rb_enc_path_skip_prefix)
(rb_enc_path_last_separator, rb_enc_path_end)
  (ruby_enc_find_basename, ruby_enc_find_extname): encoding-aware
  path handling functions.
* file.c (rb_home_dir, file_expand_path, rb_realpath_internal)
  (rb_file_s_basename, rb_file_dirname, rb_file_s_extname)
  (rb_file_join): should respect the encodings of arguments than
  file system encoding.  [ruby-dev:45145] [Bug #5919]
* dir.c (check_dirname, ruby_glob0): ditto.
* ext/pathname/pathname.c (path_sub_ext): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-25 02:32:06 +00:00
akr 54f282c2c4 * lib/pathname.rb (Pathname#find): return an enumerator if
no block is given.

* test/pathname/test_pathname.rb: add tests for above.

[ruby-dev:44797] [Feature #5572]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-19 12:52:37 +00:00
akr 19853fc49b * test/ruby/test_io.rb (test_copy_stream_socket): wait a child process
before SIGUSR1 handler is removed.

* test/pathname/test_pathname.rb (define_assertion): use line number
  for test method names.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32099 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-15 03:36:57 +00:00
nobu 7f46fadd9d * lib/test/unit.rb (assert_include): add alias.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-12 14:17:54 +00:00
akr fea0365dea * test/pathname/test_pathname.rb (TestPathname#test_grpowned?): the
group of the created file is inherited from the parent
  directory on BSDs and MacOS X.  Linux also inherit the group if
  the setgid bit of the directory is set.  It causes the test fail.
  fixed by Shota Fukumori.  [ruby-dev:42458]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-29 21:40:09 +00:00
kazu 27727621c4 * test/pathname/test_pathname.rb (TestPathname#test_mkdir): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-20 17:44:31 +00:00
akr 363ed27fa7 * ext/pathname/pathname.c (path_mkdir): Pathname#mkdir translated
from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-15 12:07:43 +00:00
akr bf77099923 * ext/pathname/pathname.c (path_s_getwd): Pathname.getwd and
Pathname.pwd translated from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-14 11:18:37 +00:00
akr 6d9b5fdffc * ext/pathname/pathname.c (path_s_glob): Pathname.glob translated
from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-09-13 20:14:04 +00:00
usa 909d638aec * test/pathname/test_pathname.rb (test_expand_path): should treat drive letter.
* test/pathname/test_pathnamr.rb (test_grpowned?): group onwer is not suppoted
  on DOSISH platforms.

* test/pathname/test_pathnamr.rb (test_world_readable?, test_sticky?,
  test_world_writable?): skip some tests on the assumptions for Unix on
  DOSISH.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29132 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-29 00:50:58 +00:00
akr 526d246f71 * ext/pathname/pathname.c (path_each_line): Pathname#each_line
translated from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-23 14:16:06 +00:00
akr 19fb560d21 * ext/pathname/pathname.c (path_expand_path): Pathname#expand_path
translated from pathname.rb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29058 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-20 01:40:51 +00:00