On Jun 7, 2008, at 23:41 PM, Artie Ziff wrote: >> That's a reasonable assumption, though. It's kind of like saying >> "Perhaps the >> program should check if the home directory actually exists..." > > Is it not good programming practice to check if resource exists before > using? It is a good practice. >> It might be nice to have a user-friendly option about this, > > IMHO, it would be user-friendly if software emits error when required > resource not available (and make program barf). Yes. >> but really, if tmp doesn't exist, you're going to have a lot more >> problems than that one installer. > (Score:5, Insightful) :) > > And very much my experience. > > This is my first week using Ruby, so please tolerate a newbie > question: > > Is it general convention/assumption by all Ruby programmers: a Ruby > program always has valid writable Dir.tmpdir defined, without > verification? RubyGems is using Dir.tmpdir because it is supposed to do the verification, it checks: if dir and File.directory?(dir) and File.writable?(dir) Maybe there is a bug. I have a symlinked /tmp (OS X), but it goes to a valid place: $ ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [universal-darwin9.0] $ ls -al /tmp lrwxr-xr-x@ 1 root admin 11 Nov 15 2007 /tmp@ -> private/tmp $ ruby -e 'p File.directory?("/tmp")' true $ ruby -e 'p File.symlink?("/tmp")' true But if I create a symlink pointing to a nonexistent place: $ ln -s /foo baz $ ls -al baz lrwxr-xr-x 1 drbrain staff 4 Jun 8 01:08 baz@ -> /foo $ ls -al /foo ls: /foo: No such file or directory $ ruby -e 'p File.directory?("baz")' false $ ruby -e 'p File.symlink?("baz")' true So maybe some other bug exists? If you find the bug, can you inform ruby-core?