From: Michael Schuerig Date: 2010-09-14T21:15:11+09:00 Subject: Re: Getting a unique filename? Daniel Berger wrote: >> tf = Tempfile.new(['archive-', '.zip']) >> tempname = tf.path >> tf.close! >> >> Is there a nicer way? > > require 'file/temp' > > fh = File::Temp.new(false) # Keep the file around Thanks, that looks good, but unfortunately doesn't work for me. See below for the trace. Apparently it stumbles because the content of /usr/libc.so is not as expected. I'm running Debian/unstable amd64. Michael # /usr/lib/libc.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf64-x86-64) GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld- linux-x86-64.so.2 ) ) $ rake test (in /var/lib/gems/1.8/gems/file-temp-1.1.2) /usr/bin/ruby1.8 -w -I"lib" "/usr/lib/ruby/1.8/rake/rake_test_loader.rb" "test/test_file_temp.rb" /var/lib/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:61:in `ffi_lib': Could not open library 'libc': libc: cannot open shared object file: No such file or directory. Could not open library 'libc.so': /usr/lib/libc.so: invalid ELF header (LoadError) from /var/lib/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:43:in `map' from /var/lib/gems/1.8/gems/ffi-0.6.3/lib/ffi/library.rb:43:in `ffi_lib' from ./lib/file/temp.rb:47 from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' from ./test/test_file_temp.rb:11 from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5:in `load' from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5 from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5:in `each' from /usr/lib/ruby/1.8/rake/rake_test_loader.rb:5 rake aborted! Command failed with status (1): [/usr/bin/ruby1.8 -w -I"lib" "/usr/lib/ruby...] -- Michael Schuerig mailto:michael@schuerig.de http://www.schuerig.de/michael/