Skip to content

Read errno before calling rb_io_path() - #80

Merged
XrXr merged 1 commit into
ruby:masterfrom
XrXr:errno-clobber
Nov 27, 2024
Merged

Read errno before calling rb_io_path()#80
XrXr merged 1 commit into
ruby:masterfrom
XrXr:errno-clobber

Conversation

@XrXr

@XrXr XrXr commented Nov 26, 2024

Copy link
Copy Markdown
Member

Possible fix for recent crashes seen on CI.

 [BUG] rb_sys_fail_str(<STDIN>) - errno == 0

rb_io_path() calls rb_obj_dup(), which could call initialize_dup in Ruby and clobber errno before rb_sys_fail_str() gets to read errno. So save it out first.

(Using separate statements because order of evaluation in function call list is unspecified, and order is important here.)

Possible fix for recent crashes seen on CI.

     [BUG] rb_sys_fail_str(<STDIN>) - errno == 0

rb_io_path() calls rb_obj_dup(), which could call initialize_dup in Ruby
and clobber errno before rb_sys_fail_str() gets to read errno. So
save it out first.

(Using separate statements because order of evaluation in function call
list is unspecified, and order is important here.)
@XrXr
XrXr requested review from hsbt and mame November 26, 2024 23:43

@mame mame left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed!

@XrXr
XrXr merged commit 0ba400b into ruby:master Nov 27, 2024
@XrXr
XrXr deleted the errno-clobber branch December 2, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants