artclarke / xuggle-xuggler

Xuggle's Xuggler Java API for Video -- DEPRECATED
GNU Lesser General Public License v3.0
360 stars 226 forks source link

Can't execute Xuggle programs using different users #9

Open mbertini opened 11 years ago

mbertini commented 11 years ago

What steps will reproduce the problem?

  1. create a Xuggle-based program on a *nix machine
  2. check that /tmp/xuggle directory is created. At the end of the execution of the program it should e empty (because of https://github.com/xuggle/xuggle-xuggler/blob/master/src/com/xuggle/ferry/JNILibrary.java - private static void deleteTemporaryFiles())
  3. execute the program with a different user (not root!).

What is the expected output? What do you see instead?

Expected output is that the program works again. The outcome is "ERROR ~ could not create temp file: {} java.io.IOException: Permission denied". See http://stackoverflow.com/questions/10449799/java-io-ioexception-permission-denied-with-xuggle#comment18861705_10466550

What operating system and JVM version are you using.

Ubuntu 11.04 with OpenJDK 1.6 and Sun JDK 1.6

Possible solution: In JNILibrary.java there's the method:

private static File getTmpDir() { File tmpdir = new File(System.getProperty("java.io.tmpdir")); File xuggledir = new File(tmpdir, "xuggle"); xuggledir.mkdirs(); return xuggledir.exists() ? xuggledir : tmpdir; }

that creates the temp directory where native libraries are temporarily decompressed. Unluckily the directory where they are decompressed is the same for all. In a multiuser system where a Xuggle-based program may be used by different users this creates problems since the second user does not have rights to write in the directory. It should be enough to change:

File xuggledir = new File(tmpdir, "xuggle"); with something like: http://www.java2s.com/Tutorial/Java/0180__File/Createsanewandemptydirectoryinthedefaulttempdirectoryusingthegivenprefix.htm