JDK-7098530 : tools/javac/javazip/Test.sh can fail on Windows
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: generic
  • Submitted: 2011-10-06
  • Updated: 2012-05-07
  • Resolved: 2012-04-20
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 7 JDK 8
7u4Fixed 8 b12Fixed
Description
Here is an example of the failure:
----------System.out:(9/516)*----------
# create zip/jar files with source code
C:/aurora/sandbox/jdk/bin/jar cf /good.jar -C C:/aurora/sandbox/testbase/tools/javac/javazip/good B.java
java.io.FileNotFoundException: \\good.jar (Access is denied)
	at java.io.FileOutputStream.open(Native Method)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:203)
	at java.io.FileOutputStream.<init>(FileOutputStream.java:95)
	at sun.tools.jar.Main.run(Main.java:190)
	at sun.tools.jar.Main.main(Main.java:1177)
error: unexpected result: command failed
----------System.err:(33/1971)*----------
Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...
       cygpath [-c HANDLE] 
       cygpath [-ADHOPSW] 
       cygpath [-F ID] 
Convert Unix and Windows format paths, or output system path information

Output type options:
  -d, --dos             print DOS (short) form of NAMEs (C:\\PROGRA~1\\)
  -m, --mixed           like --windows, but with regular slashes (C:/WINNT)
  -M, --mode            report on mode of file (binmode or textmode)
  -u, --unix            (default) print Unix form of NAMEs (/cygdrive/c/winnt)
  -w, --windows         print Windows form of NAMEs (C:\\WINNT)
  -t, --type TYPE       print TYPE form: 'dos', 'mixed', 'unix', or 'windows'
Path conversion options:
  -a, --absolute        output absolute path
  -l, --long-name       print Windows long form of NAMEs (with -w, -m only)
  -p, --path            NAME is a PATH list (i.e., '/bin:/usr/bin')
  -s, --short-name      print DOS (short) form of NAMEs (with -w, -m only)
  -C, --codepage CP     print DOS, Windows, or mixed pathname in Windows
                        codepage CP.  CP can be a numeric codepage identifier,
                        or one of the reserved words ANSI, OEM, or UTF8.
                        If this option is missing, cygpath defaults to the
                        character set defined by the current locale.
System information:
  -A, --allusers        use `All Users' instead of current user for -D, -O, -P
  -D, --desktop         output `Desktop' directory and exit
  -H, --homeroot        output `Profiles' directory (home root) and exit
  -O, --mydocs          output `My Documents' directory and exit
  -P, --smprograms      output Start Menu `Programs' directory and exit
  -S, --sysdir          output system directory and exit
  -W, --windir          output `Windows' directory and exit
  -F, --folder ID       output special folder with numeric ID and exit
Try `cygpath --help' for more information.
result: Failed. Execution failed: exit code 1


test result: Failed. Execution failed: exit code 1

Comments
SUGGESTED FIX Change the cygpath call to SCR=`pwd | cygpath -d -f -`
06-10-2011

EVALUATION The problem is this code in Test.sh CYGWIN* ) FS="/" SCR=`pwd | cygpath -d` ;; Piping into cygpath doesn't work. This causes the cygpath error shown in the description, and it causes SCR to be empty. Then Test.sh does this: ...../jar cf "${SCR}${FS}good.jar" ..... which expands to ...../jar cf /good.jar ..... Apparently, this normally works ok, but if / is not writable, then the test fails as shown in the description. The above code has been in this test for more than two years and we have only seen it fail once.
06-10-2011