Skip to content

Dir.tmpdir returns working directory #4184

@tobymurray-nanometrics

Description

@tobymurray-nanometrics

This may be related to #405, but it seems inconsistent if nothing else. No environment variables presently set for temp directory.

Environment

JRuby version:
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 OpenJDK 64-Bit Server VM 25.91-b14 on 1.8.0_91-8u91-b14-3ubuntu1~16.04.1-b14 +jit [linux-x86_64]

OS:
Linux toby-VirtualBox 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Steps

Dir.tmpdir

Expected Behavior

In JRuby 9.0.5.0 - 9.1.2.0, 1.7.24, as well as MRI 2.3.1p112 (2016-04-26 revision 54768)

jruby-9.0.5.0 :001 > require 'tmpdir'
 => true 
jruby-9.0.5.0 :002 > Dir.tmpdir
 => "/tmp"

Actual Behavior

jruby-9.1.5.0 :001 > require 'tmpdir'
 => true 
jruby-9.1.5.0 :002 > Dir.tmpdir
 => "/home/toby"

Additionally, I tried setting the various environment variables with no success:

toby@toby-VirtualBox:~$ irb
jruby-9.1.5.0 :001 > ENV["TMPDIR"] = "/tmp"
 => "/tmp" 
jruby-9.1.5.0 :002 > require 'tmpdir'
 => true 
jruby-9.1.5.0 :003 > Dir.tmpdir
 => "/home/toby" 
jruby-9.1.5.0 :004 > ENV["TMPDIR"]
 => "/tmp" 
jruby-9.1.5.0 :005 > ENV["TMP"] = "/tmp"
 => "/tmp" 
jruby-9.1.5.0 :006 > Dir.tmpdir
 => "/home/toby" 
jruby-9.1.5.0 :007 > ENV["TEMP"] = "/tmp"
 => "/tmp" 
jruby-9.1.5.0 :008 > Dir.tmpdir
 => "/home/toby"

Note that the following works as expected:

jruby-9.1.5.0 :001 > Etc.systmpdir
 => "/tmp"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions