JDK-8183351 : Better cleanup for jdk/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.imageio
  • Affected Version: 10
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2017-07-01
  • Updated: 2020-10-12
  • Resolved: 2017-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 10 JDK 8 Other
10 b23Fixed 8u270Fixed openjdk8u272Fixed
Description
BadPluginConfigurationTest.sh creates a directory in ${TMP}

cat -n jdk/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh
  [...]
  172  PLUGINDST_DIR=${TMP}/test_ext
  [...]
   176  if [ ! -d ${PLUGINDST_DIR} ] ; then
   177      mkdir ${PLUGINDST_DIR}
   178  fi

At the end of the test run it cleans up a few files, but does not remove ${PLUGINDST_DIR}.

Comments
8u Fix Request: I would like to backport this patch to 8u, as Oracle 8u271 parity. The original patch applies cleanly.
26-06-2020

Here is a suggested fix, based on some bash scripting I was doing elsewhere. All JDK build systems require mktemp, so it should be available. common/autoconf/basics.m4 contains: BASIC_REQUIRE_PROGS(MKTEMP, mktemp) This tested OK on Solaris amd64. % hg diff BadPluginConfigurationTest.sh diff --git a/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh b/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh --- a/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh +++ b/test/javax/imageio/spi/AppletContextTest/BadPluginConfigurationTest.sh @@ -57,6 +57,7 @@ { echo "The test failed :-(" echo "$*" 1>&2 echo "exit status was $status" + clean exit $status } #end of fail() @@ -65,9 +66,18 @@ pass() { echo "The test passed!!!" echo "$*" 1>&2 + clean exit 0 } #end of pass() +#Clean up the test_ext directory (PLUGINDST_DIR) before leaving +clean() + { + if [ -n "${PLUGINDST_DIR}" -a -d "${PLUGINDST_DIR}" ] ; then + rm -rf "${PLUGINDST_DIR}" + fi + } + # end of subroutines @@ -169,14 +179,9 @@ # app have file read permission for all subdirs of the # scratch dir -PLUGINDST_DIR=${TMP}/test_ext -#PLUGINDST_DIR=${TESTJAVA}/lib/ext +PLUGINDST_DIR=$(mktemp -d ${TMP}/test_ext.XXXXXX) TEST_PLUGIN=dummy.jar -if [ ! -d ${PLUGINDST_DIR} ] ; then - mkdir ${PLUGINDST_DIR} -fi - # remove old service declaration if [ -d META-INF ] ; then rm -rf META-INF
31-08-2017

Checked BadPluginConfigurationTest.sh, ${PLUGINDST_DIR} is not getting deleted. Ran test case in Windows 7 using jtreg and cygwin but was not able to find ${TMP}/test_ext directory.
06-07-2017

Suppose ${PLUGINDST_DIR} already existed, but owned by a different user, or if it was a file instead of a directory...
01-07-2017