You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This Tempfile.open call attempts to make a temporary file in the current directory and open it as a normal file (since there's a block provided it can just delete the file when finished).
Tempfile.open circles back to Tempfile.initialize (in Java), which calls Dir::Tmpname.create (patched above). That proceeds to call a CallBlock in Tempfile that attempts to open the file:
privateclassTempfileCallbackimplementsBlockCallback {
@OverridepublicIRubyObjectcall(ThreadContextcontext, IRubyObject[] args, Blockblock) {
Rubyruntime = context.runtime;
IRubyObjecttmpname = args[0], opts = args.length > 2 ? args[2] : context.nil;
...
// let RubyFile do its init logic to open the channelTempfile.super.initialize(context, newIRubyObject[]{tmpname, runtime.newFixnum(mode), opts}, Block.NULL_BLOCK);
Tempfile.this.tmpname = tmpname;
Tempfile.this.mode = runtime.newFixnum(mode & ~(OpenFlags.O_CREAT.intValue() | OpenFlags.O_EXCL.intValue()));
Tempfile.this.opts = opts;
returnopts;
It is this Tempfile.super.initialize call that eventually blows up because the file has a "." but does not exist in the current directory. With the old tmpdir logic, the . got expanded based on cwd and worked properly.
The symptom I ran into was that any gems with extensions now fail to install, because that temporary environment-setting file can't be found.
I'll be reverting the tmpdir.rb line above for now.
The text was updated successfully, but these errors were encountered:
headius
changed the title
File.open (and perhaps other forms) does not detect "." and apply cwd
Tempfile.create (and perhaps other paths) does not detect "." and apply cwd
Feb 25, 2016
A recent change to tmpdir.rb caused some problems for extensions installing:
When installing an extension, RubyGems puts some requires and env setup into a temporary Ruby file it then loads:
This
Tempfile.open
call attempts to make a temporary file in the current directory and open it as a normal file (since there's a block provided it can just delete the file when finished).Tempfile.open circles back to Tempfile.initialize (in Java), which calls Dir::Tmpname.create (patched above). That proceeds to call a CallBlock in Tempfile that attempts to open the file:
It is this Tempfile.super.initialize call that eventually blows up because the file has a "." but does not exist in the current directory. With the old tmpdir logic, the . got expanded based on cwd and worked properly.
The symptom I ran into was that any gems with extensions now fail to install, because that temporary environment-setting file can't be found.
I'll be reverting the tmpdir.rb line above for now.
The text was updated successfully, but these errors were encountered: