Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gem for tempfile #7973

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Use gem for tempfile #7973

wants to merge 3 commits into from

Conversation

headius
Copy link
Member

@headius headius commented Oct 20, 2023

It would be one less library to maintain if we just use the standard tempfile gem, but we would lose the benefit of our own Tempfile that does not use delegate.rb to wrap an IO (ours extends IO itself). This PR is to try it out and discuss.

See ruby/tempfile#7.

@headius headius force-pushed the default_tempfile branch 2 times, most recently from 11b57da to b9fe936 Compare October 20, 2023 00:29
headius added a commit to headius/jruby that referenced this pull request Oct 26, 2023
The logic here was incorrectly ported. The original code checks
the vperm pointer passed in to know whether it can be
dereferenced. The broken code in JRuby ends up requiring a
a non-null positional vperm argument in order to use the kwarg,
which then immediately errors anyway.

The new code if the perm kwarg and the positional vperm are both
set, but if only the kwarg is given, it will be used for the new
file.

Fixes failures switching from our own native Tempfile to the
tempfile gem.

See jruby#7973
headius added a commit to headius/jruby that referenced this pull request Oct 26, 2023
The logic here was incorrectly ported. The original code checks
the vperm pointer passed in to know whether it can be
dereferenced. The broken code in JRuby ends up requiring a
a non-null positional vperm argument in order to use the kwarg,
which then immediately errors anyway.

The new code if the perm kwarg and the positional vperm are both
set, but if only the kwarg is given, it will be used for the new
file.

Fixes failures switching from our own native Tempfile to the
tempfile gem.

See jruby#7973
@headius
Copy link
Member Author

headius commented Oct 26, 2023

Remaining failure is due to a fix for https://bugs.ruby-lang.org/issues/11015 applied to CRuby in ruby/ruby@efbfd90. We'll need something similar in IO.copy_stream.

headius added a commit to headius/jruby that referenced this pull request Oct 26, 2023
Tempfile.new under the standard tempfile library returns a
Delegate wrapped around an IO, so it would not have our JI addons.

See jruby#7973
The logic here was incorrectly ported. The original code checks
the vperm pointer passed in to know whether it can be
dereferenced. The broken code in JRuby ends up requiring a
a non-null positional vperm argument in order to use the kwarg,
which then immediately errors anyway.

The new code if the perm kwarg and the positional vperm are both
set, but if only the kwarg is given, it will be used for the new
file.

Fixes failures switching from our own native Tempfile to the
tempfile gem.

See jruby#7973
Tempfile.new under the standard tempfile library returns a
Delegate wrapped around an IO, so it would not have our JI addons.

See jruby#7973
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.

None yet

1 participant