TrueZIP
  1. TrueZIP
  2. TRUEZIP-333

Adding file to zip doesn't work if in the zip park there is symbolic link.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: TrueZIP 7.6.6, TrueZIP 7.7.4
    • Fix Version/s: None
    • Component/s: TrueZIP Driver ZIP
    • Labels:
      None
    • Environment:

      Linux, Debian Wheezy 64bit, ext4 fs, Oracle JDK 1.7.0_45, Oracle JDK 1.6.0_45

      Description

      I'll can workaround this, but I really think that it should be resolved in the library.

      To reproduce:
      1) create zip file in symlinked directory
      2) create directory in zip
      3) try to create file in directory (in zip)

      Test that fails:
      @Test
      public void testAddingZipFilesInSymlinkedDirectory() throws Exception
      {
      final String OS = System.getProperty("os.name").toLowerCase();
      final boolean isWindows = (OS.contains("win"));

      if (!isWindows)
      {
      final File originalDirectory = Files.createTempDir();
      final File placeForSymlink = Files.createTempDir();

      final String symlinkPath = placeForSymlink.getAbsolutePath();

      try

      { //create symlink instead of directory placeForSymlink.delete(); Runtime.getRuntime().exec(String.format("/bin/ln -s %s %s", originalDirectory.getAbsolutePath(), symlinkPath)); //zip will be in symlink final String zipArchivePath = placeForSymlink + File.separator + "test.zip"; final TFile zipArchive = new TFile(zipArchivePath); zipArchive.mkdirs(); //some directory in zip final TFile innerDirectory = new TFile(zipArchive, "someDir"); innerDirectory.mkdirs(); //and finally try to create file in directory final TFile innerFile = new TFile(innerDirectory, "someFile"); TFileOutputStream fos = new TFileOutputStream(innerFile); }

      finally

      { //trying to clean up after Runtime.getRuntime().exec(String.format("rm %s", symlinkPath)); Runtime.getRuntime().exec(String.format("rm -rf %s", originalDirectory.getAbsolutePath())); }

      }
      }

        Activity

        Hide
        Christian Schlichtherle added a comment -

        Your test runs fine on OS X 10.10 with Oracle JDK 1.7.0_72 and 1.8.0_25. I suppose to update your JDK version. I know that older versions had issues in their I/O implementation.

        Show
        Christian Schlichtherle added a comment - Your test runs fine on OS X 10.10 with Oracle JDK 1.7.0_72 and 1.8.0_25. I suppose to update your JDK version. I know that older versions had issues in their I/O implementation.

          People

          • Assignee:
            Christian Schlichtherle
            Reporter:
            pskierczynski
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: