<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_dir.rb, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Add error checking to readdir, telldir, and closedir calls in dir.c</title>
<updated>2024-09-12T17:04:10+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2024-09-12T17:04:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f2919bd11c570fc5f5440d1f101be38f61e3d16b'/>
<id>f2919bd11c570fc5f5440d1f101be38f61e3d16b</id>
<content type='text'>
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 &lt;nobu.nakada@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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 &lt;nobu.nakada@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Make Range#step to consistently use + for iteration  (#7444)</title>
<updated>2024-08-18T10:15:18+00:00</updated>
<author>
<name>Victor Shepelev</name>
<email>zverok.offline@gmail.com</email>
</author>
<published>2024-08-18T10:15:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d450f9d6a28f01b7ca6030a925921dbf35cee439'/>
<id>d450f9d6a28f01b7ca6030a925921dbf35cee439</id>
<content type='text'>
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.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #20244] Issue a single `Warning.warn` call</title>
<updated>2024-03-14T09:33:28+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-02-15T01:56:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=5326337d4f15ccf33128b3cf5a8896ba7f91fcc4'/>
<id>5326337d4f15ccf33128b3cf5a8896ba7f91fcc4</id>
<content type='text'>
Make the entire series of message lines a multiline string so that the
`Warning.warn` hook can receive them in a single call.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make the entire series of message lines a multiline string so that the
`Warning.warn` hook can receive them in a single call.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #20244] Show the conflicting another chdir block</title>
<updated>2024-03-14T09:33:28+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-02-07T10:51:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4bb8f8582fe347315f8c9dce87c9bdf4cd8f9027'/>
<id>4bb8f8582fe347315f8c9dce87c9bdf4cd8f9027</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Dir#chdir never yield args, and return block return value</title>
<updated>2023-12-12T06:31:16+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-12-12T01:34:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=f49af3c969eb7ba9937514a229b49e5b7d91f0f1'/>
<id>f49af3c969eb7ba9937514a229b49e5b7d91f0f1</id>
<content type='text'>
If no block is given, return 0 instead of nil for consistency
with Dir.chdir and Dir.fchdir.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If no block is given, return 0 instead of nil for consistency
with Dir.chdir and Dir.fchdir.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Feature #19244] Windows: Prefer USERPROFILE over HOMEPATH on startup as well</title>
<updated>2023-10-27T01:16:18+00:00</updated>
<author>
<name>Lars Kanis</name>
<email>lars@greiz-reinsdorf.de</email>
</author>
<published>2023-10-27T01:16:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9a618b95cdee82b64257a248c31d49ae9f066fea'/>
<id>9a618b95cdee82b64257a248c31d49ae9f066fea</id>
<content type='text'>

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>

</pre>
</div>
</content>
</entry>
<entry>
<title>Add Dir.for_fd</title>
<updated>2023-03-24T18:18:57+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-02-09T21:34:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=836e9a192ba4fdc56a2d3d94f5840869f77fd3bf'/>
<id>836e9a192ba4fdc56a2d3d94f5840869f77fd3bf</id>
<content type='text'>
This returns a Dir instance for the given directory file descriptor.
If fdopendir is not supported, this raises NotImplementedError.

Implements [Feature #19347]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This returns a Dir instance for the given directory file descriptor.
If fdopendir is not supported, this raises NotImplementedError.

Implements [Feature #19347]
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Dir#chdir</title>
<updated>2023-03-24T18:18:57+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-02-09T20:45:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3be65f63c79492908e898d8d7281035445a2b9a1'/>
<id>3be65f63c79492908e898d8d7281035445a2b9a1</id>
<content type='text'>
This uses Dir.fchdir if supported, or Dir.chdir otherwise.

Implements [Feature #19347]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This uses Dir.fchdir if supported, or Dir.chdir otherwise.

Implements [Feature #19347]
</pre>
</div>
</content>
</entry>
<entry>
<title>Test of environment variables order for HOME on Windows</title>
<updated>2022-12-24T14:49:27+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-24T02:21:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=4378de02f9c2c494ae1302c59625e2d126b23f3e'/>
<id>4378de02f9c2c494ae1302c59625e2d126b23f3e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add Dir.home test with encoding</title>
<updated>2022-12-24T13:55:12+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2022-12-23T09:55:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6a55b4601a50144a4c98571a79395b85465fda7f'/>
<id>6a55b4601a50144a4c98571a79395b85465fda7f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
