Announcement

Collapse
No announcement yet.

Updating a file in a zip changes/removes permissions

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Updating a file in a zip changes/removes permissions

    Recently, I've been using Cirrus (build 445) to update the contents of zips.

    I was able to copy a file from one zip to another using the Folder Compare view, and the resulting file was created in the updated zip with permissions set to 644. The source file was 664, not 644, but at leat the file was owner-read&writeable. Changing the group perm from 6 to 4 seems like a bug, but it's tolerable.

    However, I wanted to update an .xml file inside a .zip. In the source zip, linux file permissions were 664. After using the Text Compare editor to change the file, the file in the zip was changed to have permission 000.

    Now, granted, zip files don't normally have permissions as such (unlike a .tar), and on Windows this is irrelevant, but on Linux, setting the file permission to 000 means the file can't be read once unpacked. (Yes, I can run chmod on it after it's unpacked, but that's not user friendly, nor is it expected that you'd have to do so after unzipping an archive.)

    I ran into this problem recently in creating .zip files using Apache's Ant on Linux -- the solution there was to explicitly set the dirmode and filemode when adding files to a zip:

    <zip destfile="${buildDirectory}/${buildLabel}/${SDKZip}" update="true">
    <zipfileset src="${buildDirectory}/${buildLabel}/${masterZip}" dirmode="775" filemode="664" id="SDKZipFiles" />
    </zip>

    Can a similar solution work for creating/updating files in zips?

    Or, simpler, can you just ensure that the permissions before the file-edit or copy-into are maintained in the resulting archive if the available zip implementation is able to store permission data?

  • #2
    By the way, trying to update the permissions on the xml file in the zip yielded this in the log:

    02/17/08 01:12:06 AM Unable to set attributes of feature.xml: Container does not support requested file operation
    02/17/08 01:12:06 AM Failed to set attributes on 1 items. Completed in 0.11 seconds.

    Comment


    • #3
      Our current implementation doesn't support Unix attributes in zips and always assumes the external attributes are DOS attributes. If you send us a small zip with a couple files and a directory that contains Unix attributes I'll see if I can fix that.
      ZoŽ P Scooter Software

      Comment


      • #4
        unix-packed zip with some text files & various permissions

        This zip contains 3 folders and 8 files, all with various permissions.

        http://filebin.ca/zvjbph/tmp.zip

        $ ll *
        -rw-r--r-- 1 nickb users 4 Feb 17 11:58 foo.txt
        -rw-r--r-- 1 nickb users 4 Feb 17 11:58 bar.txt
        drwxrwxr-x 2 nickb users 4.0K Feb 17 11:59 dir1
        drwxrwx--- 2 nickb users 4.0K Feb 17 11:59 dir2
        drwx------ 2 nickb users 4.0K Feb 17 11:59 dir3

        dir1:
        total 8.0K
        -rw-rw-r-- 1 nickb users 4 Feb 17 11:59 foo.txt
        -rw-rw-r-- 1 nickb users 4 Feb 17 11:59 bar.txt

        dir2:
        total 8.0K
        -rwxrwx--- 1 nickb users 4 Feb 17 11:59 foo.txt
        -rwxrwx--- 1 nickb users 4 Feb 17 11:59 bar.txt

        dir3:
        total 8.0K
        -rwx------ 1 nickb users 4 Feb 17 11:59 foo.txt
        -rwx------ 1 nickb users 4 Feb 17 11:59 bar.txt

        Comment


        • #5
          Thanks, Nick. I've logged the issue.
          Aaron P Scooter Software

          Comment

          Working...
          X