<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/dir.c, branch v4.0.4</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Combine rb_imemo_tmpbuf_auto_free_pointer and rb_imemo_tmpbuf_new</title>
<updated>2025-09-15T13:25:20+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2025-09-13T18:10:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b0ce1fd549a3227ef4d9f65e4cdf0df93e4adeb0'/>
<id>b0ce1fd549a3227ef4d9f65e4cdf0df93e4adeb0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #21128] Include fcntl.h before checking for O_CLOEXEC</title>
<updated>2025-02-17T04:05:18+00:00</updated>
<author>
<name>Collin Funk</name>
<email>collin.funk1@gmail.com</email>
</author>
<published>2025-02-12T05:07:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c1c7934b63d7682216fed9dd7c9ddff5b72fea89'/>
<id>c1c7934b63d7682216fed9dd7c9ddff5b72fea89</id>
<content type='text'>
On glibc O_CLOEXEC is defined in fcntl.h and not unistd.h so this change
prevents the macro from being redefined.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On glibc O_CLOEXEC is defined in fcntl.h and not unistd.h so this change
prevents the macro from being redefined.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix constant documents (#12357)</title>
<updated>2024-12-17T02:58:00+00:00</updated>
<author>
<name>Soutaro Matsumoto</name>
<email>matsumoto@soutaro.com</email>
</author>
<published>2024-12-17T02:58:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=c7a638747ae4c2cf7eee17b07e782b1ee446ec82'/>
<id>c7a638747ae4c2cf7eee17b07e782b1ee446ec82</id>
<content type='text'>
Delete duplicated `Document-const:` directives

Those directives are attached to `rb_define_const` and `rb_file_const` where we don’t need them because the functions are supported by RDoc.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Delete duplicated `Document-const:` directives

Those directives are attached to `rb_define_const` and `rb_file_const` where we don’t need them because the functions are supported by RDoc.</pre>
</div>
</content>
</entry>
<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>Add a macro to initialize `struct getattrlist_args`</title>
<updated>2024-07-17T03:00:27+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2024-07-17T03:00:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=05502c1ddad8ab78ce1d45baf241af598d53a7d1'/>
<id>05502c1ddad8ab78ce1d45baf241af598d53a7d1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Release GVL around {,f}getattrlist calls in dir.c</title>
<updated>2024-07-17T02:20:17+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2024-07-17T02:20:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=dabb6c49aa561ba8a222e8b9baf2cbf2e1a1608d'/>
<id>dabb6c49aa561ba8a222e8b9baf2cbf2e1a1608d</id>
<content type='text'>
Fixes [Bug #20587]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Fixes [Bug #20587]</pre>
</div>
</content>
</entry>
<entry>
<title>Release GVL around system calls in dir.c</title>
<updated>2024-07-14T19:02:00+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2024-07-14T19:02:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=8ade9994bffddfd7cb3c0c4d517448620ac3727f'/>
<id>8ade9994bffddfd7cb3c0c4d517448620ac3727f</id>
<content type='text'>
* Release GVL for fdopendir calls
* Release GVL for readdir calls
* Release GVL for chdir call in dir_chdir0
* Release GVL for fchdir call in dir_fchdir
* Release GVL for chroot calls
* Release GVL for lstat calls
* Release GVL for stat calls
* Release GVL for fstatat calls
* Release GVL for getpwnam call in rb_home_dir_of
  (technically in file.c, but called from dir.c)

This does not release GVL for readdir/stat/lstat on Windows,
as that causes issues because the emulation functions that
are called in win32.c require the GVL.

This also removes some explicit casts either to or from void *,
which are allowed implicitly.  The remaining casts to or from
void * are part of function pointer casts, which are not
allowed implicitly and will generate a warning.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Release GVL for fdopendir calls
* Release GVL for readdir calls
* Release GVL for chdir call in dir_chdir0
* Release GVL for fchdir call in dir_fchdir
* Release GVL for chroot calls
* Release GVL for lstat calls
* Release GVL for stat calls
* Release GVL for fstatat calls
* Release GVL for getpwnam call in rb_home_dir_of
  (technically in file.c, but called from dir.c)

This does not release GVL for readdir/stat/lstat on Windows,
as that causes issues because the emulation functions that
are called in win32.c require the GVL.

This also removes some explicit casts either to or from void *,
which are allowed implicitly.  The remaining casts to or from
void * are part of function pointer casts, which are not
allowed implicitly and will generate a warning.</pre>
</div>
</content>
</entry>
<entry>
<title>[DOC] Fix a typo in dir.c</title>
<updated>2024-06-12T10:42:01+00:00</updated>
<author>
<name>Yudai Takada</name>
<email>t.yudai92@gmail.com</email>
</author>
<published>2024-06-12T10:42:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=278a7cb057cd7fed2a6284f727c38a1182a31668'/>
<id>278a7cb057cd7fed2a6284f727c38a1182a31668</id>
<content type='text'>
s/Retruns/Returns/</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
s/Retruns/Returns/</pre>
</div>
</content>
</entry>
<entry>
<title>Eliminate internal uses of `Data_Wrap_Struct`</title>
<updated>2024-06-02T11:59:11+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>jean.boussier@gmail.com</email>
</author>
<published>2024-05-30T16:12:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=7c121692309d0a4d1183ace406b0c4a2848e6da6'/>
<id>7c121692309d0a4d1183ace406b0c4a2848e6da6</id>
<content type='text'>
Ref: https://github.com/ruby/ruby/pull/10872

These should be the last internal uses of the old `Data` API
inside Ruby itself. Some use remain in a couple default gems.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Ref: https://github.com/ruby/ruby/pull/10872

These should be the last internal uses of the old `Data` API
inside Ruby itself. Some use remain in a couple default gems.
</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>
</feed>
