Skip to content

jruby-1.7.0 Dir::tmpdir returns current directory if it is not world writable. #405

@r4um

Description

@r4um

jruby-1.7.0 via rvm 1.6.20 (stable) on ubuntu linux. Dir::tmpdir never returns "/tmp" if current working directory is not
world writable, this behavior is not seen in 1.6.8. This causes programs to use current working directory as the
temporary directory (Dir::mktmpdir).

$ uname -a 
Linux ul-01.local 2.6.32-45-server #99-Ubuntu SMP Tue Oct 16 16:41:38 UTC 2012 x86_64 GNU/Linux
io/console not supported; tty will not be manipulated
[1] pry(main)> rd
jruby 1.7.0 (1.9.3p203) 2012-10-22 ff1ebbe on Java HotSpot(TM) 64-Bit Server VM 1.6.0_26-b03 [linux-amd64]
=> nil
[2] pry(main)> .pwd
/home/cpk
[3] pry(main)> .id
uid=1000(cpk) gid=1000(cpk) groups=4(adm),20(dialout),24(cdrom),46(plugdev),109(lpadmin),110(sambashare),111(admin),1000(cpk)
[4] pry(main)> Dir::tmpdir
=> "/home/cpk"
[5] pry(main)> .cd /etc
[6] pry(main)> .pwd
/etc
[7] pry(main)> Dir::tmpdir
=> "/tmp"
[8] pry(main)> .cd /home/cpk
[9] pry(main)> .pwd
/home/cpk
[10] pry(main)> Dir::tmpdir
=> "/home/cpk"

From the source looks like File.stat('.').world_writable? returns nil and '.' is returned.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions