Skip to main content

[truezip-issues] [JIRA] Created: (TRUEZIP-333) Adding file to zip doesn't work if in the zip park there is symbolic link.

  • From: "pskierczynski (JIRA)" <jira-no-reply@...>
  • To: issues@...
  • Subject: [truezip-issues] [JIRA] Created: (TRUEZIP-333) Adding file to zip doesn't work if in the zip park there is symbolic link.
  • Date: Fri, 18 Oct 2013 11:41:22 +0000 (UTC)
  • Auto-submitted: auto-generated

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

                 Key: TRUEZIP-333
                 URL: https://java.net/jira/browse/TRUEZIP-333
             Project: TrueZIP
          Issue Type: Bug
          Components: TrueZIP Driver ZIP
    Affects Versions: TrueZIP 7.7.4, TrueZIP 7.6.6
         Environment: Linux, Debian Wheezy 64bit, ext4 fs, Oracle JDK 
1.7.0_45, Oracle JDK 1.6.0_45
            Reporter: pskierczynski
            Assignee: Christian Schlichtherle


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()));
            }

        }
    }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://java.net/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


[truezip-issues] [JIRA] Created: (TRUEZIP-333) Adding file to zip doesn't work if in the zip park there is symbolic link.

pskierczynski (JIRA) 10/18/2013
 
 
Close
loading
Please Confirm
Close