Uploaded image for project: 'OODT (Retired)'
  1. OODT (Retired)
  2. OODT-110

TestExternMetExtractor fails if temp directory is mounted noexec

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 0.1-incubating
    • 0.3
    • build proces
    • None
    • Linux with Sun JDK 6 and /tmp mounted with noexec option

    Description

      The setup() method in the test class org.apache.oodt.cas.metadata.extractors.TestExternMetExtractor writes an executable file to the default Java temp directory, which on my system is /tmp. For security reasons, /tmp on my system has been mounted noexec, meaning no files on this partition can be executed (for the most part). When the testExtractor() method then tries to run the executable, it causes a test failure that prevents me from moving further in the build process. That's as far as I've gotten with installation, so I don't know if this is how the program would work in production. The output is as follows:

      Running org.apache.oodt.cas.metadata.extractors.TestExternMetExtractor
      Jan 11, 2011 8:15:58 AM org.apache.oodt.cas.metadata.extractors.ExternMetExtractor extrMetadata
      INFO: Generating met file for product file: [/tmp/metadata5254850749474468821.tests/testfile.txt]
      Jan 11, 2011 8:15:58 AM org.apache.oodt.cas.metadata.extractors.ExternMetExtractor extrMetadata
      INFO: Executing command line: [/tmp/metadata5254850749474468821.tests/testExtractor /tmp/metadata5254850749474468821.tests/testfile.txt /tmp/metadata5254850749474468821.tests/testfile.txt.met -Dtrue=always foo bar /home/scott/test\ boo ] with workingDir: [/tmp/metadata5254850749474468821.tests] to extract metadata
      Jan 11, 2011 8:15:58 AM org.apache.oodt.cas.metadata.extractors.ExternMetExtractor extrMetadata
      WARNING: IOException running met extraction: commandLine: [/tmp/metadata5254850749474468821.tests/testExtractor /tmp/metadata5254850749474468821.tests/testfile.txt /tmp/metadata5254850749474468821.tests/testfile.txt.met -Dtrue=always foo bar /home/scott/test\ boo ]: Message: Cannot run program "/tmp/metadata5254850749474468821.tests/testExtractor" (in directory "/tmp/metadata5254850749474468821.tests"): java.io.IOException: error=13, Permission denied
      Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.387 sec <<< FAILURE!

      I'd also note that org.apache.oodt.cas.metadata.extractors.TestExternMetExtractor.setup() runs a "chmod +x" on the temp executable file. This means the test will likely fail on a non-*nix system and halt the build process. The associated comment in the code is "yes this is ghetto" (line 123).

      I'm not sure if it's possible to change Java's temp directory with an environment variable; so far the only way I've found to change it is by setting -Djava.io.tmpdir. See http://stackoverflow.com/questions/1924136/environment-variable-to-control-java-io-tmpdir

      Attachments

        1. TestExternMetExtractor.patch
          0.6 kB
          Sean McCleese

        Activity

          People

            Unassigned Unassigned
            skonzem Scott Konzem
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: