Skip to content

Use gem for tempfile#7973

Merged
headius merged 6 commits intojruby:9.5-devfrom
headius:default_tempfile
Jun 19, 2024
Merged

Use gem for tempfile#7973
headius merged 6 commits intojruby:9.5-devfrom
headius:default_tempfile

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
headius added a commit to headius/jruby that referenced this pull request Nov 8, 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 Nov 8, 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
headius added a commit to headius/jruby that referenced this pull request Jun 18, 2024
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 Jun 18, 2024
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
@headius headius force-pushed the default_tempfile branch from f9aac38 to 5c60dd7 Compare June 18, 2024 01:09
headius added 3 commits June 19, 2024 11:39
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
@headius headius changed the base branch from master to 9.5-dev June 19, 2024 16:40
@headius headius force-pushed the default_tempfile branch from 5c60dd7 to 732d114 Compare June 19, 2024 16:40
@headius
Copy link
Member Author

headius commented Jun 19, 2024

Rebased to 9.5-dev since this will involve a fairly major change to a standard library, plus the recent logic in IO.copy_stream requires changes from 3.2.0 (ruby/ruby#6867).

@headius headius added this to the JRuby 10.0.0.0 milestone Jun 19, 2024
@headius headius force-pushed the default_tempfile branch from 732d114 to a7de515 Compare June 19, 2024 17:27
@headius headius merged commit 97b07e9 into jruby:9.5-dev Jun 19, 2024
@headius headius deleted the default_tempfile branch June 19, 2024 18:01
@headius headius mentioned this pull request Jul 1, 2024
32 tasks
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.

1 participant