JRuby's use of temp files

When we run JRuby in a single JVM, it may be running more than one Web
site’s code. We’d like to have control over where the temp files that
get created for each of the sites are stored, for security purposes.
Setting the Java property java.io.tmpdir isn’t what we are looking
for, because that is JVM-wide and we’re looking for a per-runtime
solution (really, per-Ruby.runNormally() call).

So: does JRuby use temp files when compiling/executing Ruby? If so, is
there any way to control which directory it uses?

It looks like JNA puts temp files in /tmp. Is there a way I can tell
it what directory to use?

Jim

Jim M., [email protected], [email protected]
http://www.io.com/~jimm/


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

2008/9/9 Jim M. [email protected]:

It looks like JNA puts temp files in /tmp. Is there a way I can tell
it what directory to use?

It uses the default java tmp dir (via File.createTempFile()), and
there is (currently) no way to override, other than setting
java.io.tmpdir.

However, you can place libjnidispatch.so somewhere in your
LD_LIBRARY_PATH (or java.library.path) and it will load it from there
instead of extracting the library to /tmp).


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Wayne M. wrote:

LD_LIBRARY_PATH (or java.library.path) and it will load it from there
instead of extracting the library to /tmp).

For JRuby release, perhaps we should consider expand those libraries so
there’s no use of /tmp at all?

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

2008/9/12 Charles Oliver N. [email protected]:

However, you can place libjnidispatch.so somewhere in your
LD_LIBRARY_PATH (or java.library.path) and it will load it from there
instead of extracting the library to /tmp).

For JRuby release, perhaps we should consider expand those libraries so
there’s no use of /tmp at all?

It shouldn’t hurt - on Fedora, the packaged version of JNA has the
native lib in /usr/lib (I think), so unpacking the appropriate native
lib and installing in lib/, then adding that to LD_LIBRARY_PATH in the
jruby script should be ok.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Wayne M. wrote:

However, you can place libjnidispatch.so somewhere in your
LD_LIBRARY_PATH (or java.library.path) and it will load it from there
instead of extracting the library to /tmp).
For JRuby release, perhaps we should consider expand those libraries so
there’s no use of /tmp at all?

It shouldn’t hurt - on Fedora, the packaged version of JNA has the
native lib in /usr/lib (I think), so unpacking the appropriate native
lib and installing in lib/, then adding that to LD_LIBRARY_PATH in the
jruby script should be ok.

http://jira.codehaus.org/browse/JRUBY-2994

The only bit I fear is getting the scripts to work correctly across
platforms (LD_LIBRARY_PATH vs DYLD_LIBRARY_PATH and so on).

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email