Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4105472

Extract (x) option for jar inconsistent on WIN32 for verbose and filename format

XMLWordPrintable

    • jar
    • 1.2fcs
    • x86
    • windows_95
    • Not verified

       The JAR tool has an inconsistency with the extract (x) option on WIN32.
      Notice when creating a JAR that the verbose output shows filenames in UNIX style format.
      Notice when listing a JAR that the verbose output shows filesnames in UNIX style format.
      Notice when extracting a JAR that the verbose output shows filenames in WIN32 style format.
      This is inconsistent.

      In the following examples I am using the MKS Toolkit with the Korn Shell on WIN32.

      Also notice you can create a JAR on WIN32 using UNIX style and WIN32 style filenames for example:
      % jar -cvf jar.jar dir/Neko2.java does work
      % jar -cvf jar.jar dir\\Neko2.java does work

      On the other hand you cannot extract files on WIN32 using UNIX style filenames but only WIN32 style filenames for example:
      % jar -xvf jar.jar dir/Neko2.java does not work
      % jar -xvf jar.jar dir\\Neko2.java does work

      This is the problem. With extract the JAR tool should handle UNIX style and WIN32 style filenames
      on WIN32 as it does with create.

      This bug causes my JAR test suite to fail.

      In summary:
      (1) The verbose output for the extract option (x) should print out UNIX style filenames with "/" to be consistent with the create (c) and list (t) options.

      (2) The extract option (x) should accept UNIX style filenames as well as WIN32 style filenames as part of the extract option so "jar -xvf jar.jar dir/Neko2.java" should work just like "jar -xvf jar.jar dir\\Neko2.java" does.

      % jar -cvf jar.jar dir
      adding: dir/ (in=0) (out=0) (stored 0%)
      adding: dir/images/ (in=0) (out=0) (stored 0%)
      adding: dir/images/SCCS/ (in=0) (out=0) (stored 0%)
      adding: dir/images/SCCS/s.awake.gif (in=537) (out=398) (deflated 25%)
      adding: dir/images/SCCS/s.stop.gif (in=573) (out=400) (deflated 30%)
      adding: dir/images/SCCS/s.right1.gif (in=577) (out=399) (deflated 30%)
      adding: dir/images/SCCS/s.right2.gif (in=585) (out=408) (deflated 30%)
      adding: dir/images/SCCS/s.scratch1.gif (in=593) (out=415) (deflated 30%)
      adding: dir/images/SCCS/s.scratch2.gif (in=585) (out=408) (deflated 30%)
      adding: dir/images/SCCS/s.sleep1.gif (in=512) (out=375) (deflated 26%)
      adding: dir/images/SCCS/s.sleep2.gif (in=522) (out=386) (deflated 26%)
      adding: dir/images/SCCS/s.yawn.gif (in=581) (out=409) (deflated 29%)
      adding: dir/images/right1.gif (in=136) (out=141) (deflated -3%)
      adding: dir/images/awake.gif (in=152) (out=157) (deflated -3%)
      adding: dir/images/yawn.gif (in=142) (out=147) (deflated -3%)
      adding: dir/images/stop.gif (in=138) (out=143) (deflated -3%)
      adding: dir/images/right2.gif (in=142) (out=145) (deflated -2%)
      adding: dir/images/scratch1.gif (in=146) (out=151) (deflated -3%)
      adding: dir/images/scratch2.gif (in=141) (out=146) (deflated -3%)
      adding: dir/images/sleep1.gif (in=135) (out=140) (deflated -3%)
      adding: dir/images/sleep2.gif (in=141) (out=146) (deflated -3%)
      adding: dir/SCCS/ (in=0) (out=0) (stored 0%)
      adding: dir/SCCS/s.Neko2$1.class (in=1534) (out=997) (deflated 35%)
      adding: dir/SCCS/s.Neko2$2.class (in=1538) (out=996) (deflated 35%)
      adding: dir/SCCS/s.Neko2.class (in=6298) (out=3455) (deflated 45%)
      adding: dir/SCCS/s.Neko2.html (in=447) (out=286) (deflated 36%)
      adding: dir/SCCS/s.Neko2.java (in=5856) (out=1783) (deflated 69%)
      adding: dir/SCCS/s.ScrollingTextThread.class (in=3526) (out=2065) (deflated 41%)
      adding: dir/Neko2.class (in=4336) (out=2389) (deflated 44%)
      adding: dir/Neko2$1.class (in=879) (out=544) (deflated 38%)
      adding: dir/Neko2$2.class (in=880) (out=545) (deflated 38%)
      adding: dir/Neko2.html (in=130) (out=98) (deflated 24%)
      adding: dir/Neko2.java (in=5539) (out=1605) (deflated 71%)
      adding: dir/ScrollingTextThread.class (in=2314) (out=1360) (deflated 41%)

      % jar -tvf jar.jar
        2313 Wed Jan 21 11:34:56 EST 1998 META-INF/MANIFEST.MF
           0 Tue Jan 20 12:31:44 EST 1998 dir/
           0 Tue Jan 20 12:31:42 EST 1998 dir/images
           0 Tue Jan 20 12:31:42 EST 1998 dir/images/SCCS/
         537 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.awake.gif
         573 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.stop.gif
         577 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.right1.gif
         585 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.right2.gif
         593 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.scratch1.gif
         585 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.scratch2.gif
         512 Tue Jan 20 12:31:40 EST 1998 dir/images/SCCS/s.sleep1.gif
         522 Tue Jan 20 12:31:42 EST 1998 dir/images/SCCS/s.sleep2.gif
         581 Tue Jan 20 12:31:42 EST 1998 dir/images/SCCS/s.yawn.gif
         136 Tue Jan 20 12:31:40 EST 1998 dir/images/right1.gif
         152 Tue Jan 20 12:31:40 EST 1998 dir/images/awake.gif
         142 Tue Jan 20 12:31:42 EST 1998 dir/images/yawn.gif
         138 Tue Jan 20 12:31:40 EST 1998 dir/images/stop.gif
         142 Tue Jan 20 12:31:40 EST 1998 dir/images/right2.gif
         146 Tue Jan 20 12:31:40 EST 1998 dir/images/scratch1.gif
         141 Tue Jan 20 12:31:42 EST 1998 dir/images/scratch2.gif
         135 Tue Jan 20 12:31:42 EST 1998 dir/images/sleep1.gif
         141 Tue Jan 20 12:31:42 EST 1998 dir/images/sleep2.gif
           0 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/
        1534 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/s.Neko2$1.class
        1538 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/s.Neko2$2.class
        6298 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/s.Neko2.class
         447 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/s.Neko2.html
        5856 Tue Jan 20 12:31:42 EST 1998 dir/SCCS/s.Neko2.java
        3526 Tue Jan 20 12:31:44 EST 1998 dir/SCCS/s.ScrollingTextThread.class
        4336 Tue Jan 20 12:31:42 EST 1998 dir/Neko2.class
         879 Tue Jan 20 12:31:42 EST 1998 dir/Neko2$1.class
         880 Tue Jan 20 12:31:42 EST 1998 dir/Neko2$2.class
         130 Tue Jan 20 12:31:42 EST 1998 dir/Neko2.html
        5539 Tue Jan 20 12:31:44 EST 1998 dir/Neko2.java
        2314 Tue Jan 20 12:31:44 EST 1998 dir/ScrollingTextThread.class

      Notice that the extract (x) output prints out filenames in WIN32 filename format using "\". It should print out using UNIX filename format using "/" to be consistent with create (c) and listing (t) options.
      % jar -xvf jar.jar
       extracted: META-INF\MANIFEST.MF
         created: dir created: dir\images created: dir\images\SCCS extracted: dir\images\SCCS\s.awake.gif
       extracted: dir\images\SCCS\s.stop.gif
       extracted: dir\images\SCCS\s.right1.gif
       extracted: dir\images\SCCS\s.right2.gif
       extracted: dir\images\SCCS\s.scratch1.gif
       extracted: dir\images\SCCS\s.scratch2.gif
       extracted: dir\images\SCCS\s.sleep1.gif
       extracted: dir\images\SCCS\s.sleep2.gif
       extracted: dir\images\SCCS\s.yawn.gif
       extracted: dir\images\right1.gif
       extracted: dir\images\awake.gif
       extracted: dir\images\yawn.gif
       extracted: dir\images\stop.gif
       extracted: dir\images\right2.gif
       extracted: dir\images\scratch1.gif
       extracted: dir\images\scratch2.gif
       extracted: dir\images\sleep1.gif
       extracted: dir\images\sleep2.gif
         created: dir\SCCS extracted: dir\SCCS\s.Neko2$1.class
       extracted: dir\SCCS\s.Neko2$2.class
       extracted: dir\SCCS\s.Neko2.class
       extracted: dir\SCCS\s.Neko2.html
       extracted: dir\SCCS\s.Neko2.java
       extracted: dir\SCCS\s.ScrollingTextThread.class
       extracted: dir\Neko2.class
       extracted: dir\Neko2$1.class
       extracted: dir\Neko2$2.class
       extracted: dir\Neko2.html
       extracted: dir\Neko2.java
       extracted: dir\ScrollingTextThread.class

      Notice that trying to extract (x) a file specified using UNIX filename format does not work. It should work because you can create (c) using UNIX filename format.
      % jar -xvf jar.jar dir/Neko2.java

      The following works on WIN32 using WIN32 filename style format.
      % jar -xvf jar.jar dir\\Neko2.java
       extracted: dir\Neko2.java

      In summary you should be able to extract files on WIN32 using either UNIX filename format or WIN32 filename format to be consistent with being able to create JAR's using UNIX filename format or WIN32 filename format.

            zlisunw Zhenghua Li (Inactive)
            aefreche Alan Frechette (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: