| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Raise SystemCallError exception when these functions return an error.
This changes behavior for the following case (found by the tests):
```ruby
dir1 = Dir.new('..')
dir2 = Dir.for_fd(dir1.fileno)
dir1.close
dir2.close
```
The above code is basically broken, as `dir1.close` closed the file
descriptor. The subsequent `dir2.close` call is undefined behavior.
When run in isolation, it raises Errno::EBADF after the change, but
if another thread opens a file descriptor between the `dir1.close`
and `dir2.close` calls, the `dir2.close` call could close the file
descriptor opened by the other thread. Raising an exception is much
better in this case as it makes it obvious there is a bug in the code.
For the readdir check, since the GVL has already been released,
reacquire it rb_thread_call_with_gvl if an exception needs to be
raised.
Due to the number of closedir calls, this adds static close_dir_data
and check_closedir functions. The close_dir_data takes a
struct dir_data * and handles setting the dir entry to NULL regardless
of failure.
Fixes [Bug #20586]
Co-authored-by: Nobuyoshi Nakada <nobu.nakada@gmail.com>
|
|
|
|
|
|
|
|
| |
Make Range#step to consistently use + for iteration [Feature #18368]
Previously, non-numerics expected step to be integer,
and iterated with begin#succ, skipping over step value
steps. Since this commit, numeric and non-numeric iteration
behaves the same way, by using + operator.
|
|
|
|
|
| |
Make the entire series of message lines a multiline string so that the
`Warning.warn` hook can receive them in a single call.
|
| |
|
|
|
|
|
| |
If no block is given, return 0 instead of nil for consistency
with Dir.chdir and Dir.fchdir.
|
| |
|
|
|
|
|
|
|
| |
This returns a Dir instance for the given directory file descriptor.
If fdopendir is not supported, this raises NotImplementedError.
Implements [Feature #19347]
|
|
|
|
|
|
| |
This uses Dir.fchdir if supported, or Dir.chdir otherwise.
Implements [Feature #19347]
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Dir.glob brace pattern with '/' after '**' does not match
paths in recursive expansion process.
We expand braces with '/' before expanding a recursive.
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
This was already documented as being ignored, but it wasn't being
ignored, causing an issue in a particular case where a UTF-8
pattern was provided and a filename was tested that wasn't valid
UTF-8.
Fixes [Bug #14456]
|
|
|
|
| |
Co-authored-by: Jeremy Evans <code@jeremyevans.net>
|
|
|
|
|
| |
... and keep it as a warning (like 2.7) when it is called in the same
thread. [Bug #15661]
|
|
|
|
|
| |
Instead of suppressing all warnings wholly in each test scripts by
setting `$VERBOSE` to `nil` in `setup` methods.
|
| |
|
|
|
|
|
|
|
|
| |
The documentation already stated this was an error in one case
(when it was previously a warning). Describe the other case,
where chdir without block is called inside block passed to chdir.
Fixes [Bug #15661]
|
| |
|
| |
|
|
|
|
| |
`Dir.entries` returns an array.
|
| |
|
|
|
|
|
|
| |
Sort the results which matched single wildcard or character set in
binary ascending order, unless `sort: false` is given. The order
of an Array of pattern strings and braces are not affected.
|
| |
|
|
|
|
|
|
| |
Calling some syscall functions such as Dir.chroot causes SIGSYS instead
of EPERM on Android.
This change skips all tests that stops the test-suite run.
|
| |
|
|
|
|
|
|
|
|
| |
* dir.c (ruby_glob0): expand braces if a glob pattern starts with
brace.
[ruby-core:91728] [Bug #15649]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
* test/ruby/test_dir.rb: r67159 closes all files explicitly
but this change breaks attempt of this test introduced at
r56467. Try another solution which removes all references
from an Array with `#clear`.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
to fix a test failure like
http://ci.rvm.jp/results/trunk-theap-asserts@silicon-docker/1804207
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
|
| |
* dir.c (join_path_from_pattern): add the last slash for directory
matching.
* test/ruby/test_dir.rb (test_glob_recursive_directory): add a test
for above.
[ruby-core:91110] [Bug #15540]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
[Fix GH-2022]
From: MSP-Greg <greg.mpls@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
File.expand_path("~username") uses getpwnam() independently from
Dir.home. [Bug #15324]
From: Chris Seaton <chris@chrisseaton.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65926 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
| |
* dir.c (glob_helper): fix directory glob which resulted in lacking
the first byte. adjust the length of basename to be appended as
well as removing the heading path, not the length of the joined
path. [ruby-dev:50588] [Bug #14899]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* dir.c (rb_push_glob): warn NUL-separated glob patterns.
[Feature #14643]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
|
|
| |
* dir.c (GlobPathValue): should be used in rb_push_glob only.
other methods should use FilePathValue.
https://hackerone.com/reports/302338
* dir.c (rb_push_glob): expand GlobPathValue
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
| |
* dir.c (dir_each_child_m): new instance methods Dir#each_child
and Dir#children. [Feature #13969]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
|
|
| |
This reverts commit r60341,r60342,r60344,r60345.
Breaking compabitility of the order of result breaks many tests.
To avoid such effort to fix tests, the order should be kept.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
The order of resulted array is changed in some cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
This reverts commit r60314.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
This reverts commit r60253 because it causes on error on Linux.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
|
|
| |
The order of resulted array is changed in some cases.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|
|
|
|
| |
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59487 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
|